"Randomizing weapons"

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Jimmy
 
 
Posts: 4726
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

"Randomizing weapons"

Post by Jimmy »

How do I get a weapon to spawn one of a set of different weapons while it's on the ground? Like DBT did in Aeons of Death. 8-)
User avatar
Phobus
Posts: 5984
Joined: Thu May 05, 2005 10:56 am
Location: London
Contact:

Post by Phobus »

You make an actor that is invisible and dissappears after it's done it's job. You make it A_Jump with a chance (or even a string of A_Jump lines), and at each possible outcome (ie, the jump doesn't happen or there's nowhere left to go) you have it spawn a weapon, then dissappear (to stop it doing anymore)
User avatar
Zeg-Vok
Posts: 60
Joined: Tue Nov 23, 2004 2:57 pm

Post by Zeg-Vok »

Look in omgwpns.wad, that has several examples of that, with both weapons and monsters
User avatar
Jimmy
 
 
Posts: 4726
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Post by Jimmy »

OK, thanks for the advice :wink: , but I'm not getting the results I wanted, I get that weird exclamation mark in the red box thingy, and no weapons. :shock: I can't post the decorate yet ('cos I'm at school :cry: ) can someone plz post a piece of decorate so that I can work from it? 8-)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Look at the console. It should contain an error message.
User avatar
Jimmy
 
 
Posts: 4726
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Post by Jimmy »

I did :shock:, it said

Code: Select all

_Shotgun at (xxxx,xxxx) has no frames
where (xxxx,xxxx) is the coordinates (that I can't remember, but it's the shotgun in Entryway)

I changed the frames for _Shotgun (in decorate) from NULL A to SHOT A and I only get a shotgun, not a HeavyShotgun, not a RiotGun or a DoubleBarrelHandgun. I'll post the decorate as soon as I get home. :wink:
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Post by Ryan Cordell »

Did you specify it's Spawn state?
User avatar
Jimmy
 
 
Posts: 4726
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Post by Jimmy »

Yep. :o

OK, I'm home now, here's teh decorate: :wink:

Code: Select all

Forget it, I changed it.
I have defined all the sprites and decorate for these weapons. :D
Last edited by Jimmy on Fri Jun 30, 2006 1:45 pm, edited 1 time in total.
asdf
Posts: 193
Joined: Mon Jun 19, 2006 1:50 pm

Post by asdf »

they need to be a_jump 3, i believe, because what you have, will always do a normal shotgun,,,
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

They need to jump 2 states each.
User avatar
Anakin S.
Posts: 1067
Joined: Fri Nov 28, 2003 9:39 pm
Location: A long time ago in a galaxy far, far away...

Post by Anakin S. »

Goto, Loop, and Stop are all ignored in jump statements.
asdf
Posts: 193
Joined: Mon Jun 19, 2006 1:50 pm

Post by asdf »

waits so it would be A_Jump(136,2) it would land on stop.... oh, they it would just skip the stop?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Anakin S. wrote:Goto, Loop, and Stop are all ignored in jump statements.
Not ignored. They don't generate states so they don't count.
User avatar
Jimmy
 
 
Posts: 4726
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Post by Jimmy »

Here's the new decorate, it's still only spawning an IDShotgun.

Code: Select all

actor _Shotgun 2001
{
  States
  {
  Spawn:
    SHOT A 0 A_Jump(136,2)
    SHOT A 1 A_SpawnItem("IDShotgun")
    Stop
    SHOT A 0 A_Jump(136,2)
    SHOT A 1 A_SpawnItem("IDSuperShotgun")
    Stop
    SHOT A 0 A_Jump(136,2)
    SHOT A 1 A_SpawnItem("M16AssaultRifle")
    Stop
    SHOT A 0 A_Jump(136,2)
    SHOT A 1 A_SpawnItem("HeavyShotgun")
    Stop
    SHOT A 0 A_Jump(136,2)
    SHOT A 1 A_SpawnItem("RiotGun")
    Stop
    SHOT A 1 A_SpawnItem("DoubleBarrelHandgun")
    Stop
  }
}
User avatar
Anakin S.
Posts: 1067
Joined: Fri Nov 28, 2003 9:39 pm
Location: A long time ago in a galaxy far, far away...

Post by Anakin S. »

The first frame in the state doesn't execute its code pointer. Put an extra frame before it.
Locked

Return to “Editing (Archive)”