Author Topic: VCE slot machine not working  (Read 797 times)

So I'm trying to make a slot machine that will set the player's health to either 1 or 100, and it doesn't seem to work all the time.

Can someone tell me what I'm doing wrong?

At a quick glance, it looks like it might be that it's using 0, 1, and 2, as the numbers it can draw from the roll, but it only has functionality for 1 and 2. It's probably rolling 0 occasionally. I'm not exactly sure as I'm not too familiar with VCE offhand.

Other than the fact that this can be done in under six lines, a lot.
Code: [Select]
[0] [0] OnActivate>self>VCE_ModVariable>brick [dice] set [1]
[1] [0] OnActivate>self>VCE_ModVariable>brick [dice] random [2]
[2] [0] OnActivate>self>VCE_ifVariable>brick [dice] == [1] [3 6]
[3] [0] OnVariableTrue>player>setHealth [1]
[4] [0] OnVariableFalse>player>setHealth [100]
[5] [0] OnVariableTrue>client>CenterPrint [blah]
[6] [0] OnVariableFalse>client>CenterPrint [blah]

Other than the fact that this can be done in under six lines, a lot.
Code: [Select]
[0] [0] OnActivate>self>VCE_ModVariable>brick [dice] set [1]
[1] [0] OnActivate>self>VCE_ModVariable>brick [dice] random [2]
[2] [0] OnActivate>self>VCE_ifVariable>brick [dice] == [1] [3 6]
[3] [0] OnVariableTrue>player>setHealth [1]
[4] [0] OnVariableFalse>player>setHealth [100]
[5] [0] OnVariableTrue>client>CenterPrint [blah]
[6] [0] OnVariableFalse>client>CenterPrint [blah]
I was actually planning on adding more variable checks to the dice roll, not just those two events... That can work for now, I guess.

Not sure if the order of events is enough but you set the variable rolldice to both 0 and a random number at the same time.

Not sure if the order of events is enough but you set the variable rolldice to both 0 and a random number at the same time.
order is enough
I was actually planning on adding more variable checks to the dice roll, not just those two events... That can work for now, I guess.
if you want to chain multiple if's together
input>self>ifvariable
onvariabletrue>duck
onvariablefalse>self>ifvariable
onvariabletrue>quack
onvariablefalse>self>ifvariable
onvariabletrue>maggots

The line 6 and 11 IfVariables don't have ranges.

The line 6 and 11 IfVariables don't have ranges.
Ah, this seems to have fixed it for now! Thanks, now I'm going to lock the thread...