Author Topic: Event_Variable HELP  (Read 877 times)

I just got Event_Variables and I was making an olden days RPG
Like you click on a tree and it dissapears and you get 1 wood.

So I made a river with fish in it. When you get the fish you have to find a fire and cook them
I wanted for it to say "You dont have a fish to cook" if you have 0. and when it hit 0 it just goes

Raw Fish is -1
Cooked Fish is 1

How do I make it stop at 0?




Add these event lines to your fire or whatever it is you are cooking on.
Let me know if this works.

Quote
delay[0]       onActivate -> Self -> ifVariable -> [Client] Raw Fish [GreaterEquals] 1

delay[0]       VariableTrue -> Self -> setRaycasting [ ]

delay[0]       VariableTrue -> Client -> AddVariable -> [Client] Cooked Fish [1]

delay[0]       VariableTrue -> Client -> AddVariable -> [Client] Subtract [1]

delay[0]       VariableTrue -> Self -> SubVarFromVar ->  [Client] Raw Fish [Client] Subtract

delay[0]       VariableTrue -> Client -> displayVariable -> BottomPrint -> Raw Fish [3]

delay[0]       VariableTrue -> Client -> CenterPrint -> You have cooked fish! [3]

delay[3000] VariableTrue -> Client -> displayVariable -> BottomPrint -> Cooked Fish

delay[3000] VariableTrue -> Client -> setVariable -> Subtract 0

delay[3000] VariableTrue -> Self -> setRaycasting


delay[0]       VariableFalse -> Client -> centerPrint -> You don't have a fish to cook [3]

*note: If you don't enter in the delay times exactly like i have it, it won't work.
*note2: There is a rule against making duplicate threads.
« Last Edit: November 13, 2008, 10:45:08 AM by LoserHero »

Add these event lines to your fire or whatever it is you are cooking on.
Let me know if this works.

*note: If you don't enter in the delay times exactly like i have it, it won't work.
*note2: There is a rule against making duplicate threads.

Why not make it so you can cook all your fish at once? I guess it wouldn't be realistic, but lazy people could use it ;).
Code: [Select]
delay[0]       onActivate -> Self -> ifVariable -> [Client] Raw Fish [GreaterEquals] 1

delay[0]       VariableTrue -> Self -> setRaycasting [ ]

delay[0]       VariableTrue -> Client -> AddVarToVar -> [Client] Raw Fish [Client] Cooked Fish

delay[0]       VariableTrue -> Self -> SubVarFromVar ->  [Client] Raw Fish [Client] Raw Fish

delay[0]       VariableTrue -> Client -> displayVariable -> BottomPrint -> Raw Fish [3]

delay[0]       VariableTrue -> Client -> CenterPrint -> You have cooked fish! [3]

delay[3000] VariableTrue -> Client -> displayVariable -> BottomPrint -> Cooked Fish

delay[3000] VariableTrue -> Client -> setVariable -> Subtract 0

delay[3000] VariableTrue -> Self -> setRaycasting

delay[0]       VariableFalse -> Client -> centerPrint -> You don't have a fish to cook [3]

« Last Edit: November 14, 2008, 03:53:04 AM by Destiny/Zack0Wack0 »

why is this in coding?

Sorry for the bump, but this can be helpful.