I need some help making a trigger for money to kills. It needs to be like once a player has 10 kills player then gets 1 mineral and so. Help?
None.
An artist's depiction of an Extended Unit Death
Have you looked at GalaxyWiki? There's an article on kills to cash here:
http://www.galaxywiki.net/index.php?title=Kill_to_Cash- Event: Any Unit Dies
- Condition: Triggering Unit's Owner == Player from Unit Group "Enemies"
Using this, you can have a counter for the player, and when the player's counter reaches 10, you give them a mineral and reset the counter to zero.
I follow the link and did mostly what it said, but it still doesn't seem to be working.
- Not sure how to post the image on here so there's the files.
Attachments:
1.jpg
Hits: 4 Size: 193.47kb
2.jpg
Hits: 2 Size: 201.84kb
None.
An artist's depiction of an Extended Unit Death
I'm not sure what you're trying to do with all those actions; I thought you wanted a simple "Kill 10 units, get 1 mineral" system.
Assuming the units to kill for money are owned by player 7:
KillScore
Events
Unit - Any Unit dies
Local Variables
KillingPlayer = (Killing player) <Integer>
Conditions
(Owner of (Triggering unit)) == 7
Actions
Variable - Modify Score_Array[KillingPlayer]: + 1
General - If (Conditions) then do (Actions) else do (Actions)
If
Score_Array[KillingPlayer] >= 10
Then
Player - Modify player KillingPlayer Minerals: Add 1
Variable - Modify Score_Array[KillingPlayer]: - 10
Else
Score_Array is a global variable: an array of integers that represents each player (it can be any size; I chose 8). KillingPlayer is set to the player that actually kills the unit. Each time a player kills one of player 7's units, their value in Score_Array increases by one. When their score is 10 or more, the score is subtracted by 10 (resetting it) and they receive one mineral.
Hope this helps.
Post has been edited 1 time(s), last time on Oct 26 2011, 4:46 am by rayne.
What do you mean global variable? How do I use it?
None.
http://www.galaxywiki.net/VariablesVariables are variable things that can change. In this case it is just as Roy explained, "Score_Array is a global variable: an array of integers that represents each player (it can be any size; I chose 8). KillingPlayer is set to the player that actually kills the unit. Each time a player kills one of player 7's units, their value in Score_Array increases by one. When their score is 10 or more, the score is subtracted by 10 (resetting it) and they receive one mineral."
EDIT:
In looking at your Triggers, you seem to have the right idea trying to use "Local Variables" but you're using them incorrectly and should be using a Global Variable instead (by right clicking on the list of Triggers on the left and selecting "Create Variable" or something).
I get what you're trying to do, though. Basically you want the amount of minerals earned to be based on the amount of players in the game, right? The issue with your trigger is that it starts when any unit owned by player 7 dies, but then nothing happens because nothing is set to happen. You have a ton of "If, then" Actions that modify the "Currency" Variable, but no Action to actually add the Minerals based on that Variable amount. Your last "If, then" Action (which looks to be disabled) has an "If" statement that doesn't quite make sense, and the "Then" portion just adds minerals regardless of the modified "Currency" number.
EDIT2:
My suggestion would be to break it up into two separate Triggers. Have one modify the "Currency" Variable (except make it a Global Variable) based on the players in the game. Then create Roy's above Trigger, except modify "Player - Modify player KillingPlayer Minerals: Add 1" so that the "1" is actually the "Currency" Variable.
Post has been edited 4 time(s), last time on Oct 26 2011, 7:15 am by DevliN.
Currently Working On: My Overwatch addiction.
In looking at your Triggers, you seem to have the right idea trying to use "Local Variables" but you're using them incorrectly and should be using a Global Variable instead (by right clicking on the list of Triggers on the left and selecting "Create Variable" or something).
I get what you're trying to do, though. Basically you want the amount of minerals earned to be based on the amount of players in the game, right? The issue with your trigger is that it starts when any unit owned by player 7 dies, but then nothing happens because nothing is set to happen. You have a ton of "If, then" Actions that modify the "Currency" Variable, but no Action to actually add the Minerals based on that Variable amount. Your last "If, then" Action (which looks to be disabled) has an "If" statement that doesn't quite make sense, and the "Then" portion just adds minerals regardless of the modified "Currency" number.
Yeah it works now, thanks a lot for explaining the variables so much.
None.