Mulitple RandomSpawner?

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, 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.
Post Reply
User avatar
Exosphere
Posts: 168
Joined: Sun Jun 11, 2017 11:42 am
Location: New England, US

Mulitple RandomSpawner?

Post by Exosphere »

Is there a way to replace multiple items using the RandomSpawner like this? (Obviously not what I wrote code-wise, but at least produce the action I am implying.)

Code: Select all

//Example
ACTOR CheatSpawner : RandomSpawner replaces Stimpak, replaces Medikit, replaces HealthBonus 
{ 
DropItem "Megasphere" 
DropItem "InvulnerabilitySphere"  
}
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: Mulitple RandomSpawner?

Post by Gez »

No, each actor can only have one "replaces".

You can, however, use the MAPINFO allocation of editor numbers to replace actors by another without using the replaces keyword. (Then it will obviously only work for things that are placed in the map editor; not things that are spawned during the game, but that's not too much of a problem because vanilla/limit-removing/Boom maps never spawn map things in-game besides ammo dropped by zombies and monsters spawned by the icon of sin.)

It is also possible to have identical but separate randomspawners replacing each of these items. e.g. CheatSpawner1 : RandomSpawner replaces Stimpack; CheatSpawner2 : RandomSpawner replaces Medikit; and so on.
User avatar
Exosphere
Posts: 168
Joined: Sun Jun 11, 2017 11:42 am
Location: New England, US

Re: Mulitple RandomSpawner?

Post by Exosphere »

Gez wrote:No, each actor can only have one "replaces".
Darn. But, thank ya for pointing it out.
Gez wrote:It is also possible to have identical but separate randomspawners replacing each of these items. e.g. CheatSpawner1 : RandomSpawner replaces Stimpack; CheatSpawner2 : RandomSpawner replaces Medikit; and so on.
This is what I was technically already doing. But I wanted to see if what I was suggesting would be possible just so I could cut down on code.
Gez wrote:You can, however, use the MAPINFO allocation of editor numbers to replace actors by another without using the replaces keyword. (Then it will obviously only work for things that are placed in the map editor; not things that are spawned during the game, but that's not too much of a problem because vanilla/limit-removing/Boom maps never spawn map things in-game besides ammo dropped by zombies and monsters spawned by the icon of sin.)
So for this, just to clairfy, it would only work if I am in GZDoom Builder and not just automatically replace the assets with my own when I load a game with my mod?

One other thing, how would I make it so that certain items dont spawn? For example, if I didnt want to have the Armor and Health Bonuses, would I just make a spawner for the Bonuses that drops nothing?
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: Mulitple RandomSpawner?

Post by Gez »

The vanilla game does not feature any instance of spawning stimpacks, medikits, or health bonuses during the game -- these things appear only when they are spawned at map load. There isn't any enemy that drops one of them when they die, or anything of the sort.

However, it is possible to spawn them dynamically with scripts (in ACS or FraggleScript, or with custom actors). So it's possible to get to play a map for ZDoom (or potentially for Doom Legacy I guess) where a medikit or health bonus would be spawned dynamically during the game. Then that item wouldn't be replaced.

To disable some items entirely, you don't need to replace them with a RandomSpawner. Just replace them with an actor that does nothing and disappear immediately. The DoomBuilderCamera actor works well for that purpose.
Post Reply

Return to “Mapping”