| Blockland Forums > Help |
| VCE Help Needed (Randomizing) |
| (1/1) |
| Popeye (T.S.M.):
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. |
| Popeye (T.S.M.):
Meant to say "VCE_ifvariable" not "if_modvariable" |
| CheeseDragon:
You have to set a variable to the minimum number then do the random for max number e.g --- Code: ---OnActivate - client - Vcemodvariable - [randomspawn] set [1] OnActivate - client - Vcemodvariable - [randomspawn] random [50] --- End code --- 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: ---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] --- End code --- etc.. |
| Popeye (T.S.M.):
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! |
| Zeblote:
--- Quote from: Popeye (T.S.M.) on January 07, 2013, 08:45:39 PM ---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! --- End quote --- 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 |
| Navigation |
| Message Index |