Author Topic: Win weapons for points?  (Read 578 times)

Is there any possible way that I can use events to make it to where, for example, in a Zombie Mini-game, where someone kills a zombie and gets a point, then he can go to the glass case and buy a gun for a point? If so, please post an answer in the comments.

Well, on a Zombie spawn. You must event the following order: Needed Events[color=: Variables or IfPlayerPoints


Variable

OnZombieDeath / Player / AddVariable / [Variable] [Number earned]
OnZombieDeath / Client / DisplayVariable / [Variable]

So Then heres the Events for the Item giving.

OnActivate / Self / IfVariable / [Variable] [Amount to spend]   EXAMPLE: You need 50 Points so, [50] in amount to Spend.

VariableTrue / Client / DisplayVariable / [Variable]
VariableTrue / Player / AddWeapon / [Choose Weapon]



And the Points is the same thing but you will need:
OnZombieDeath / Client / AddScore / [Number of Points]

Now, then you will need to put this in the Buying Brick.

Onactivate / Self / IfPlayerPoints / [Number]
VariableTrue / Player / Addweapon / [Weapon]
VariableFalse / Client / MiddleClient: Not Enough Points



Hoped this helped :D

You can do it like what kobe said, or you can use Score, as in the default score that when you open the player list you see.
You need the mod Variables, VCE works but it is a tad, not much, more complicated.





If you are going to use Variables V4 this is a good formula. Score is easier to use.
If you are using score, your score goes up when you kill a zombie unless the mini game creator changes it.
If the mini game creator didn't change it, use this for the gun case:

Onactivate>self>ifplayerscore>Greater Equals> (However much score you want it to cost)

Onvariablefalse>client>Centerprint(or chat or bottom)>You don't have enough score!

Onvariabletrue>client>incscore>-(The amount you want it to cost, make sure you use -)

Onvariabletrue>player(or self)> additem(or spawnitem)> (The Weapon you want)

Onvariabletrue>client>Centerprint(or chat or bottom)>You got a (Weapon name)!





If you are using VCE it will make it take a few extra moments
Here is the events for the gun case using score:

Onactivate>client>VCEIfVariable> <var:client(or cl):score> >= (However much you want it)

Onvariablefalse>client>centerprint(or chat or bottom) You don't have enough score for this!

Onvariabletrue>player(or self for spawnitem)>additem(or spawnitem for self) (Item)

Onvariabletrue>client>incscore> (However much the item costs)

Onvariabletrue>client>CenterPrint(or chatmessage or bottom) You spent (Cost) score on (item)!



Hope that helps!

Thank you both, but there's one thing I realized while trying to put Kobewarrior's method in. There wasn't an:
OnZombieDeath / Player / AddVariable / [Variable] [Number earned]

OnZombieDeath / Client / DisplayVariable / [Variable]

Those didn't appear for some reason. Is it an Add-on or something?

Is there any possible way that I can use events to make it to where, for example, in a Zombie Mini-game, where someone kills a zombie and gets a point, then he can go to the glass case and buy a gun for a point? If so, please post an answer in the comments.
I know how to do this cuz i host a zombie server, and you can buy weps with points. Heres events: (If u use VCE v5.4)

Code: [Select]
Line: 0  OnActivate -> Client -> Prompt -> Ok/Cancel -> "Buy A Desert Eagle For 60 Points?"
Line: 1  OnPromptAccept -> Self -> VCEifValue -> [<var:cl:score>] >= [60] 2 4
Line: 2  OnVariableTrue -> Client -> IncScore -> -60
Line: 3  OnVariableTrue -> Player -> addItem -> D-Eagle
Line: 4  OnVariableFalse -> Client -> CenterPrint -> <color:ffffff>Not Enough Points!
I have like a weapons case that you activate, then a prompt comes up, when you accept it, it checks if your points are greater or equal to the cost of the weapon, then, events on lines 2 - 4 are played. If the variable was true, then it takes away 60 points, and gives you the weapon. If the variable was false, it doesnt take away any points, and displays: "Not Enough Points!" Across the screen. Hope that helped you out!

Gah, no edit button, oh well...
In VCE v5.4, you don't need to have
Code: [Select]
OnZombieDeath -> Player -> AddVariableBecause you can just have the it check your score. I use the score as the points to buy the weps with the code
Code: [Select]
OnPromptAccept -> Self -> VCEifVariable -> [<var:cl:score>] >= [60] 2 4 The Line <var:cl:score> Is the line that checks your score. The >= means: "Greater or Equal To"
If you have anymore questions, pm me.

This topic was officially ended by Evar678.
Please lock it now legofanatic.

Thanks Evar. Locking... When I get home. I'm doing this from my phone lol.