Difference between revisions of "Kill to Cash"

From HIVE
Jump to navigation Jump to search
(Added Data Editor method.)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
'''Kill to Cash''' systems are used to award resources to a player for killing an enemy unit. In StarCraft 1, this was primarily done through the use of [[Triggers]] and "Kill Score." In [[StarCraft II]], we have the option to do this easily through the [[Data Editor]] as well. Examples of both methods are below.
 
'''Kill to Cash''' systems are used to award resources to a player for killing an enemy unit. In StarCraft 1, this was primarily done through the use of [[Triggers]] and "Kill Score." In [[StarCraft II]], we have the option to do this easily through the [[Data Editor]] as well. Examples of both methods are below.
  
=Kills to Cash with Triggers=
+
=Kills to Cash with the [[Data Editor]]=
 +
The Data Editor method has the advantage of being less time-consuming.
 +
 
 +
===Step-by-Step===
 +
Go into the Data Editor (F7) and under "Data Type:" select "Units." Select the unit that you want to award resources for killing.
 +
*In the box on the right, find "Combat - Kill Resource" and double-click the space on the right to open an Object Values window.
 +
*Select any of the resources and change the value to what you want the reward to be for killing this unit.
 +
*Click "OK" to close the window.
 +
 
 +
Congratulations, you will now resources when you kill this unit.
 +
 
 +
 
 +
=Kills to Cash with [[Triggers]]=
 +
The advantage of doing that kind of system with triggers is that it is much more versatile, in the sense that you can easily modify the conditions of the reward.
 +
 
 
==Basic Theory==
 
==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:
 
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:
Line 15: Line 29:
  
  
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).
+
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).
  
  
Line 31: Line 45:
  
 
==Trigger Reference==
 
==Trigger Reference==
This '''commented''' trigger has been taken from the Open Source project "[http://www.staredit.net/starcraft2maps/47-Swarmed-Heroes Swarmed Heroes]".
+
Here is a '''commented''' trigger that shows you how to achieve such a system.
  
 
[[File:Kill to Cash trig.png]]
 
[[File:Kill to Cash trig.png]]
Line 37: Line 51:
  
 
==Adjustments==
 
==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.
+
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.
 
 
=Kills to Cash with the Data Editor=
 
Go into the Data Editor (F7) and under "Data Type:" select "Units." Select the unit that you want to award resources for killing.
 
*In the box on the right, find "Combat - Kill Resource" and double-click the space on the right to open an Object Values window.
 
*Select any of the resources and change the value to what you want the reward to be for killing this unit.
 
*Click "OK" to clse the window.
 
 
 
Congratulations, you will now resources when you kill this unit.
 
  
 
[[Category:StarCraft II]]
 
[[Category:StarCraft II]]
 +
[[Category:Data Editor]]
 
[[Category:Triggers]]
 
[[Category:Triggers]]
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
 
[[Category:Reference]]
 
[[Category:Reference]]

Latest revision as of 02:36, 27 November 2010

Kill to Cash systems are used to award resources to a player for killing an enemy unit. In StarCraft 1, this was primarily done through the use of Triggers and "Kill Score." In StarCraft II, we have the option to do this easily through the Data Editor as well. Examples of both methods are below.

Kills to Cash with the Data Editor

The Data Editor method has the advantage of being less time-consuming.

Step-by-Step

Go into the Data Editor (F7) and under "Data Type:" select "Units." Select the unit that you want to award resources for killing.

  • In the box on the right, find "Combat - Kill Resource" and double-click the space on the right to open an Object Values window.
  • Select any of the resources and change the value to what you want the reward to be for killing this unit.
  • Click "OK" to close the window.

Congratulations, you will now resources when you kill this unit.


Kills to Cash with Triggers

The advantage of doing that kind of system with triggers is that it is much more versatile, in the sense that you can easily modify the conditions of the reward.

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>
Please take note that this value (12) has been chosen arbitrary.
  • 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

Here is a commented trigger that shows you how to achieve such a system.

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.