Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Cyanide

How do I replace an actor with a randomly chosen actor?

Question

How do I replace all Imps with the same random monster from a list? This should happen when starting a level, and replace ALL Imps with the SAME replacement.

I'm trying to make a monster replacer, that doesn't crowd levels with 10 variants of the same actor.

 

Thanks.

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 1

https://zdoom.org/wiki/Classes:RandomSpawner

 

All Imps with the same replacement? I guess you'd have to call an ACS script at the beginning of a map to set a global variable to a random value, then check this value via a script called from each Imp and spawn another monster in its place depending on the value.

Share this post


Link to post
  • 1

Even if you want independent random spawners for multiple monster types, you should only need 2 ACS scripts in total: One to set random values to multiple global variables, and one to fetch value of a specific one of these variables given by the script's parameter. Each monster type would fetch a particular one of these variables through the latter script, each using a unique parameter. Or, if you don't mind correlation between the randomized types of several monster types, you can even have several monster types check the same variable (but react to its value differently), to reduce the number of global variables.

Edited by scifista42

Share this post


Link to post
  • 0

Thanks scifista42!

I'm guessing this isn't very hard to implement on all other monsters, as the ACS and scripts would be virtually identical.

 

Does that make sense?

 

Share this post


Link to post
  • 0

I was thinking of pairing Pain Elemental variants and Lost Soul variants, so they would always match. So you just answered a question I didn't get to ask. Thanks a lot, dude! :D

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×