Kill to Cash

From HIVE
Revision as of 23:03, 25 November 2010 by Payne (talk | contribs) (Created page with "'''Kill to Cash''' systems are used to reward players with a certain currency based on their Kill Score. ==Basic Theory== Basically, what we want is to detect whenever a Unit Di...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Kill to Cash systems are used to reward players with a certain currency based on their Kill Score.

Basic Theory

Basically, what we want is to detect whenever a Unit Dies, and make sure it's an enemy for the player we run the trigger for. This requires two things:

  • Event: Any Unit Dies
  • Condition: Triggering Unit's Owner == Player from Unit Group "Enemies"


Then, while there are multiple ways to obtain such a system, this tutorial will use two different Variables:

  • Local Variable: Currency = 12 <Integer>
  • Global Variable: Score = 0 <Integer[5]>
To know why there are 5 arrays while there are only 4 players, see General_Mapping_Tips#The_Array_Trick.


For the rest of the trigger (actions), the different "sections" will be highlighted (and you can see the final result in the "Trigger Reference" section).


Changing the Currency value based on the difficulty

In this case, the difficulty value will be determinated by the number of players that are in-game.

Basically, we want to use the "Modify Variable (Integer)" action to multiply the "Currency" variable by an arbitrary number. We'll also use an "If-Then-Else": "Ifs" will use a Comparison of the "Number of Player in Player Group", using the "Active Players" Player Group.

Store Kill Score into a Variable

For each player, you'll want to use a "Set Variable" to store their individual "Kill Score" in an array corresponding to each player. This requires you to use the "Player Score Value (Integer)" Function and set the Score value to be "Total Unit Score".

Rewarding players

You can decide to reward players based on different conditions. See the Trigger Reference section just below and read the comments inside the last "Pick Each Integer" loop: they explain pretty well how this part of the trigger works.


Trigger Reference

This commented trigger has been taken from the Open Source project "Swarmed Heroes".

Kill to Cash trig.png


Adjustments

If you want to adjust the number of Score points the death of a unit gives to a player, you'll want to modify the "Stats - Score - Kill" field value to whatever you want. This field can be found in the Data Editor under the "Units" tab. Each different unit has its own Kill Score.