Author Topic: How to make a mystery box.  (Read 6409 times)

Nope

Onactivate- self- vcemodvariable- Brick [dice] set [1]
Onactivate- self- vcemodvariable- Brick [dice] add [4]
Onactivate- self- vcemodvariable- Brick [dice] randomnum [4] (not sure if this line is correct)


That is dice.

Then, to call it up in eventing you would use:

<Var:brick:dice>
For example:
Onactivate- client- chatmsg [Hey, I got a <var:brick:dice>!]

Please, correct me if I'm wrong.




I made this last year or somewhere around then for someone when i was new to VCE so its a tad very basic ^^ but it should still work, when i opened it up in my server to save it the weapons were missing so just change to suit you needs:
Code: [Select]
X 0ms onActivate Player VCE_ifVariable money >= 950 1 2 21
X 0ms onVariableFalse Client ChatMessage You dont have enough money to use the random item box, You require 950
X 33ms onVariableTrue Self fireRelay
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 1 9 10
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 2 11 12
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 3 13 14
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 4 15 16
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 5 17 18
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 6 19 20
X 0ms onVariableTrue Client CenterPrint You got a 30 cal machine gun 3
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Client CenterPrint You got a shotgun! 3
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Client CenterPrint You got a alien blaster 3
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Client CenterPrint You racived an M4A1 3
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Client CenterPrint You got an SMG 3
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Client CenterPrint You got an Molotov roostertail 3
X 100ms onVariableTrue Player VCE_modVariable money Subtract 950

I made this last year or somewhere around then for someone when i was new to VCE so its a tad very basic ^^ but it should still work, when i opened it up in my server to save it the weapons were missing so just change to suit you needs:
Code: [Select]
X 0ms onActivate Player VCE_ifVariable money >= 950 1 2 21
X 0ms onVariableFalse Client ChatMessage You dont have enough money to use the random item box, You require 950
X 33ms onVariableTrue Self fireRelay
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 1 9 10
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 2 11 12
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 3 13 14
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 4 15 16
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 5 17 18
X 0ms onRelay Self VCE_retroCheck ifRandomDice == 6 19 20
X 0ms onVariableTrue Client CenterPrint You got a 30 cal machine gun 3
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Client CenterPrint You got a shotgun! 3
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Client CenterPrint You got a alien blaster 3
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Client CenterPrint You racived an M4A1 3
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Client CenterPrint You got an SMG 3
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Player addItem Hammer
X 0ms onVariableTrue Client CenterPrint You got an Molotov roostertail 3
X 100ms onVariableTrue Player VCE_modVariable money Subtract 950

Thank you soooo much,but could you also tell me how this works? I know I can just copy it but I still want to know how it works.

tell me how to make or the :cookieMonster: will eat all your  :cookie:'s

Why don't you just make a function with VCE so you can call it anytime without all that crazy stuff?

But could you also tell me how this works?
Sorry for the late reply, didnt see your question.

Initaly it checks if the player varible in this case money is = to or more than 950 and if true fires a relay (although player score would work better but at the time i was a eventing newb so :S)
then the brick it checks if the random dice is = to 1, 2 3 etc utnill 6.
When the varible is = to 1 than it triggers event  9 and 10 which say you got a machine gun and give you a  hammer (becuase of missing addons :S, although as said can be easly changed) it works on the same principle for all the others.
and at the end of this it removes the money that the spent on the item box (again would of worked better with score but meh)

Overlooking this, there is a few issues with it, but still works :D