Author Topic: VCE Help Needed (Randomizing)  (Read 569 times)

I'm trying to have a variable given a random number (will be 1-50, but in testing is 1-3).  This number is then being used via if_modvariable to assign the player to a certain (random) place for spawning.  I cannot seem to either get modvariable Random to work, or am using it incorrectly.  Help?

If pictures would be helpful let me know, I can easily post some.

Meant to say "VCE_ifvariable" not "if_modvariable"

You have to set a variable to the minimum number then do the random for max number e.g

Code: [Select]
OnActivate - client - Vcemodvariable - [randomspawn] set [1]
OnActivate - client - Vcemodvariable - [randomspawn] random [50]

When activated, this will set the variable "randomspawn" a random number between 1 and 50. You can change the variable name, it doesn't really matter.

To use for spawning you would have to do


Code: [Select]
OnActivate - client - Vcemodvariable - [randomspawn] set [1]
OnActivate - client - Vcemodvariable - [randomspawn] random [50]
OnActivate - client - VceIfvariable - [randomspawn] == [1] [3 4]
Onvariabletrue - namedbrick - [asdf] setplayertransform
Onvariablefalse - client - vceifvariable [randomspawn] == [2] [5 6]
Onvariabletrue - namedbrick - [asdf2] setplayertransform
Onvariablefalse - client - vceifvariable [randomspawn] == [3] [7 8]
Onvariabletrue - namedbrick - [asdf3] setplayertransform
Onvariablefalse - client - vceifvariable [randomspawn] == [4] [9 10]

etc..

Thanks!  :cookieMonster: It works perfectly! Unfortunately 50 different spawns exceeds 100 lines of eventing, so I have to limit it, but it works like a charm!

Thanks!  :cookieMonster: It works perfectly! Unfortunately 50 different spawns exceeds 100 lines of eventing, so I have to limit it, but it works like a charm!
You could:
1. Change the number of max events
2. Check if the var is over 25, if yes continue at a different brick (trigger by relay)
3. Use a script instead