Aesthetic randomising?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Aesthetic randomising?

Post by Hidden Hands »

I have an issue. I have two variants of the IMP from doom and I do not want one to replace the other. I want both at once. I can easily add the monster, that's not the issue. What I want however, it DOOM II to randomly pick which version it will spawn in a hoard of them. Does this make sense? Sometimes it will spawn classic doom imp, next time it might spawn my custom imp. Any advice please? I think METADoom did this, but I'm not certain.

Thanks in advance.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Aesthetic randomising?

Post by wildweasel »

ZDoom actually has a feature specifically meant for this - you want a RandomSpawner.

Code: Select all

ACTOR RollMeUpAnImp : RandomSpawner replaces DoomImp
{
   DropItem "DoomImp2" // A new actor that does nothing but inherit from the original DoomImp.
   DropItem "NewDoomImp" // Your new Imp actor.
}
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Aesthetic randomising?

Post by Matt »

I think our OP wants to have, like, all of the imps be one or the other, but never a mix of them.

If this is on a per-level basis, it should be possible to set up an eventhandler that sets a level-scope(?) variable that each imp can read at postbeginplay, then spawn something else (or not) depending on the variable.

Even without ZScript you can even spawn a random number of invisible objects at (0,0) upon the map opening and the imps can wait 1 tic before checking to see how many of that object exists and spawn its alternate (or remain as is) accordingly.
Post Reply

Return to “Scripting”