Staredit Network > Forums > SC2 Assistance > Topic: [SOLVED] Money for Kills
[SOLVED] Money for Kills
This topic is locked. You can no longer write replies here.
Oct 26 2011, 2:56 am
By: Striker  

Oct 26 2011, 2:56 am Striker Post #1



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.

Oct 26 2011, 3:02 am Roy Post #2

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

Quote
  • 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.




Oct 26 2011, 3:56 am Striker Post #3



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.

Oct 26 2011, 4:39 am Roy Post #4

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.




Oct 26 2011, 6:17 am Striker Post #5



What do you mean global variable? How do I use it?



None.

Oct 26 2011, 6:59 am DevliN Post #6

OVERWATCH STATUS GO

http://www.galaxywiki.net/Variables

Variables 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.



\:devlin\: Currently Working On: \:devlin\:
My Overwatch addiction.

Oct 26 2011, 9:59 pm Striker Post #7



Quote
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.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:09 pm]
Ultraviolet -- let's fucking go on a madmen rage bruh
[10:01 pm]
Vrael -- Alright fucks its time for cake and violence
[2024-5-07. : 7:47 pm]
Ultraviolet -- Yeah, I suppose there's something to that
[2024-5-06. : 5:02 am]
Oh_Man -- whereas just "press X to get 50 health back" is pretty mindless
[2024-5-06. : 5:02 am]
Oh_Man -- because it adds anotherr level of player decision-making where u dont wanna walk too far away from the medic or u lose healing value
[2024-5-06. : 5:01 am]
Oh_Man -- initially I thought it was weird why is he still using the basic pre-EUD medic healing system, but it's actually genius
[2024-5-06. : 3:04 am]
Ultraviolet -- Vrael
Vrael shouted: I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
With the modern EUD editors, I don't think they're calculating nearly as many offsets as you might imagine. Still some fancy ass work that I'm sure took a ton of effort
[2024-5-06. : 12:51 am]
Oh_Man -- definitely EUD
[2024-5-05. : 9:35 pm]
Vrael -- I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
[2024-5-05. : 9:35 pm]
Vrael -- that is insane
Please log in to shout.


Members Online: Oh_Man, Roy, jun3hong