Advanced Search

Author Topic: The "How do I make a weapon do that?" thread  (Read 91836 times)

0 Members and 1 Guest are viewing this topic.

March 09, 2014, 08:35:13 PM
Reply #480

Offline Beed28

  • MM8BDM Extender

  • Putting the 'bounce' into your world.
  • ***
  • Date Registered: June 20, 2011, 08:07:58 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #480 on: March 09, 2014, 08:35:13 PM »
How would I be able to make it so that when a player does something, all players around a certain distance from him receive an item?

March 09, 2014, 11:27:33 PM
Reply #481

Offline Russel

  • MM8BDM Extender

  • Doc Croc
  • **********
  • Date Registered: December 17, 2010, 11:11:25 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #481 on: March 09, 2014, 11:27:33 PM »
ACS...more specifically something similar to:

Code: [Select]
int atid = activatorTID();
int p = 0;
for(int i=0; i<64; i++)
{
p = 1000+i;
if(xyzDistance(atid, p)<[number of units goes here])GiveActorInventory(p, "item", number);
}

[xyzDistance is a function defined in the GLOBAL.acs file since MM8BDM-v3a]
[This loop is played 64 times...it would be wise to use the variable ALSO defined in GLOBAL called max_players or something similar.]

That's incredibly simplified, but basically what it does is it loops through all possible players [64] and checks their distance from the activator, and if they are in that distance, give that player the item. Since all players in 8BDM have a thing id based on their player number, this is and easy feat to accomplish.

March 18, 2014, 06:51:57 AM
Reply #482

Offline lol

  • Standard Member
  • Date Registered: February 28, 2011, 11:55:45 PM

    • View Profile
    • http://www.youtube.com/user/christheawesome2423
BUMP: The "How do I make a weapon do that?" thread
« Reply #482 on: March 18, 2014, 06:51:57 AM »
I'm pretty much a complete novice when it comes to coding, so...

Question: Is there a way to use the zoom factor via using inventory?

I know I can simply use the "Altfire" state, but the weapon I am creating is already using the alternative fire for another purpose.

May 09, 2014, 11:49:32 PM
Reply #483

Offline Ceridran

  • MM8BDM Extender
  • **
  • Date Registered: April 07, 2012, 01:08:52 AM

    • View Profile
    • http://ceridran.tumblr.com/
Re: The "How do I make a weapon do that?" thread
« Reply #483 on: May 09, 2014, 11:49:32 PM »
A page back, I asked how to implement ammo regeneration in a somewhat different way.. Well, the answer I got didn't tell me WHAT I should be doing and HOW I should be doing this. This time, I'd like to ask how to give a class ammo regeneration in general.

Alot of times I've looked at the code of classes like Viz, and I'm confused how the ammo regeneration even gets on the class, because there's nothing that seems to support it in the class file. (The part that defines class name, given items, armor and speed, etc.)

May 10, 2014, 12:15:24 AM
Reply #484

Offline Gummywormz

  • Standard Member

  • Air Man Tile Enthusiast
  • Date Registered: December 23, 2010, 01:05:44 AM

    • View Profile
    • Github Page
Re: The "How do I make a weapon do that?" thread
« Reply #484 on: May 10, 2014, 12:15:24 AM »
There are a few options. Most actually define ammo regeneration in the class' weapon. The easiest method is to stick on ammo regeneration to the ready state of the weapon like so.

Code: [Select]
TRHU A 3 A_WeaponReady
COOW B 0 A_GiveInventory("BlueFireAmmo",2)
//it's important to stick your wait time on the A_WeaponReady part and not the A_GiveInventory part because otherwise your weapon will only fire some of the time

The downside is that you have to not fire your weapon to get ammo. Viz implements his ammo regen through a flash state like so.

Code: [Select]
Ready:
OBUS A 0 ACS_ExecuteAlways(998,0,600)
OBUS A 0 A_GunFlash

...

Flash:
TNT1 A 0 A_JumpIfInventory("VizPadTimer", 1, 2)
TNT1 A 0 A_GiveInventory("VoltLaserAmmo", 1)
TNT1 A 35
loop

Calling A_GunFlash enters the "Flash" state. This is where ammo regen occurs, independent of movement or firing your weapon. Ammo is always regenerated.

May 17, 2014, 04:49:56 PM
Reply #485

Offline skully

  • Standard Member
  • Date Registered: June 18, 2011, 06:11:17 AM

    • View Profile
    • http://steamcommunity.com/id/dryfclr5
Re: The "How do I make a weapon do that?" thread
« Reply #485 on: May 17, 2014, 04:49:56 PM »
So, i am making a weapon that if the projectile hits the floor, it creates another ripping projectile for others to step in, the thing is i cannot make the second projectile despawn, it is ripping though. halp?

May 17, 2014, 04:56:36 PM
Reply #486

Offline Russel

  • MM8BDM Extender

  • Doc Croc
  • **********
  • Date Registered: December 17, 2010, 11:11:25 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #486 on: May 17, 2014, 04:56:36 PM »
You know how your set animations? Just make a full animation time [something like TNT1 A 35 which is an invisible sprite that lasts one second] and call stop at the end of the spawn state instead of loop.

May 17, 2014, 07:26:37 PM
Reply #487

Offline skully

  • Standard Member
  • Date Registered: June 18, 2011, 06:11:17 AM

    • View Profile
    • http://steamcommunity.com/id/dryfclr5
Re: The "How do I make a weapon do that?" thread
« Reply #487 on: May 17, 2014, 07:26:37 PM »
Tried, didn't work.
(click to show/hide)
Removing the names just incase.
This actually last forever.

LeEdit: Herpderp, i put'd the loop in here. look!
(i start to feel like an idiot now xP)
(click to show/hide)

May 27, 2014, 10:04:58 PM
Reply #488

Offline Badz

  • Standard Member
  • Date Registered: May 30, 2013, 08:30:32 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #488 on: May 27, 2014, 10:04:58 PM »
How could I make it so that, if a player is damaged by a particular projectile, it gives a type of ammo to whoever shot the projectile?

May 27, 2014, 10:35:41 PM
Reply #489

Offline Gummywormz

  • Standard Member

  • Air Man Tile Enthusiast
  • Date Registered: December 23, 2010, 01:05:44 AM

    • View Profile
    • Github Page
Re: The "How do I make a weapon do that?" thread
« Reply #489 on: May 27, 2014, 10:35:41 PM »
Make a pain state and use A_GiveToTarget.

June 22, 2014, 02:53:35 PM
Reply #490

Offline Ceridran

  • MM8BDM Extender
  • **
  • Date Registered: April 07, 2012, 01:08:52 AM

    • View Profile
    • http://ceridran.tumblr.com/
Re: The "How do I make a weapon do that?" thread
« Reply #490 on: June 22, 2014, 02:53:35 PM »
At this point, I don't even know what to do. My Brawler's Bullet Punch quickly turns into pure awful when you use it in multiplayer. After a moment of working properly, it starts to only fire projectiles and drain no ammo, then it fires no projectiles and drains your ammo.

What I'm asking is-- what's wrong here?

Code: [Select]
Altfire:
FIST A 0 A_JumpIfNoAmmo("NoAmmo")
//FIST A 0 A_GiveInventory("Fury",1)
FIST A 0 SetPlayerProperty(0,1,4)
Goto Althold
Althold:
FIST A 0 A_TakeInventory("Fury",1)
FIST A 0 A_FireCustomMissile("BulletPunchAttack",8,-4,11,6)
FIST BCD 1 A_PlaySoundEx("weapon/pshot","Weapon")
FIST A 0 A_FireCustomMissile("BulletPunchAttack",-4,8,11,-10)
FIST BCD 1 A_PlaySoundEx("weapon/pshot","Weapon")
FIST A 0 A_FireCustomMissile("BulletPunchAttack",-8,4,11,4)
FIST BCD 1 A_PlaySoundEx("weapon/pshot","Weapon")
FIST A 0 A_FireCustomMissile("BulletPunchAttack",4,-8,11,-8)
FIST BCD 1 A_PlaySoundEx("weapon/pshot","Weapon")
FIST A 0 SetPlayerProperty(0,0,4)
FIST A 0 A_Refire
Goto Ready+1
NoAmmo:
FIST B 1 ACS_Execute(979,0)
Goto Ready+1
}
}

June 22, 2014, 07:10:21 PM
Reply #491

Offline Gummywormz

  • Standard Member

  • Air Man Tile Enthusiast
  • Date Registered: December 23, 2010, 01:05:44 AM

    • View Profile
    • Github Page
Re: The "How do I make a weapon do that?" thread
« Reply #491 on: June 22, 2014, 07:10:21 PM »
Did you try not using the althold state? It's a bit finicky sometimes.

July 10, 2014, 06:59:59 PM
Reply #492

Offline Jdude330

  • Standard Member
  • Date Registered: July 22, 2013, 12:57:40 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #492 on: July 10, 2014, 06:59:59 PM »
How Do I create weapon pickups for my weapons?

July 10, 2014, 07:05:11 PM
Reply #493

Offline Russel

  • MM8BDM Extender

  • Doc Croc
  • **********
  • Date Registered: December 17, 2010, 11:11:25 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #493 on: July 10, 2014, 07:05:11 PM »
As in...the pickup sprites?
Those are native. The Spawn state defines what the weapon looks like in the field.

July 14, 2014, 10:44:47 AM
Reply #494

Offline Gummywormz

  • Standard Member

  • Air Man Tile Enthusiast
  • Date Registered: December 23, 2010, 01:05:44 AM

    • View Profile
    • Github Page
Re: The "How do I make a weapon do that?" thread
« Reply #494 on: July 14, 2014, 10:44:47 AM »
Quote from: "Badz"
How could I make it so that, if a player is damaged by a particular projectile, it gives a type of ammo to whoever shot the projectile?

Welp, it turns out A_GiveToTarget does not work in pain states. Are there any workarounds or can we just not give items when you hit another player?