Kill then spawn trigger

punwisp

New Member
Reaction score
34
Not too familiar with the triggers on Galaxy but this is basically what I'm wanting.

If player 1 kills a unit owned by any other player, a marine spawns at player 1s spawn region, every 5 kills a marauder spawns at Player 1s spawn region.

And I want to be able to have another unit spawn every 10 kills, another every 20 kills, etc.

Could someone cook up a trigger for this? Would really appreciate it, no idea how to work this on this editor :/
 

Dave312

Censored for your safe viewing
Reaction score
269
When the player makes 5 kills, does a marine and a marauder spawn or does the marauder spawn instead of the marine?

Also is this designed to only work for player 1 or for every player?
 

punwisp

New Member
Reaction score
34
Suppose to work for 12 players, and every kill you gain a marine, but every 5 kills you also get a different unit (Marauder). So

Kill 1- Marine
Kill 2- Marine
Kill 3- Marine
Kill 4- Marine
Kill 5- Marine, Marauder
Kill 6- Marine
Kill 7- Marine
Kill 8- Marine
Kill 9- Marine
Kill 10- Marine, Ghost
 

Dave312

Censored for your safe viewing
Reaction score
269
Ok I will work something out. I assume that this is a FFA type match so I don't need to worry about killing allies units to set it off?
 

punwisp

New Member
Reaction score
34
Yep, FFA match. 12 players, when a player kills a unit, they gain a marine, And gain special units at x kills.
 

Dave312

Censored for your safe viewing
Reaction score
269
Map attached. Let me know if that isn't quite what you were after.
 

Attachments

  • SpawnOnKill.zip
    12.3 KB · Views: 154

punwisp

New Member
Reaction score
34
Not sure how I would edit that, but thats pretty much perfect :p Now, how do I set this up for 12 players? Lol wow I really cant read these triggers :3, take me forever to figure them out xD
 

Dave312

Censored for your safe viewing
Reaction score
269
Not sure how I would edit that, but thats pretty much perfect :p Now, how do I set this up for 12 players? Lol wow I really cant read these triggers :3, take me forever to figure them out xD

In order for it to work for 12 players, just add the additional spawn locations to the SpawnPoints Variable.
I'll try to explain the main trigger below:
Trigger:
  • Unit Killed
    • Events
      • Unit - Any Unit dies
    • Local Variables
      • BonusUnitType = Marine <Game Link - Unit>
      • GiveBonusUnit = false <Boolean>
      • SpawnPoint = No Point <Point>
    • Conditions
      • (Triggering player) != (Killing player)
    • Actions
      • Variable - Modify PlayerKills[(Killing player)]: + 1
      • Variable - Set SpawnPoint = SpawnPoints[(Killing player)]
      • ------- Spawn Marine
      • Unit - Create 1 Marine for player (Killing player) at SpawnPoint using default facing (No Options)
      • ------- Check if bonus spawn is required
      • ------- Checks must be in order of highest to lowest to work properly
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (PlayerKills[(Killing player)] mod 20) == 0
          • GiveBonusUnit == false
        • Then
          • ------- Is a 20th Kill
          • Variable - Set GiveBonusUnit = true
          • Variable - Set BonusUnitType = Thor
        • Else
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (PlayerKills[(Killing player)] mod 10) == 0
          • GiveBonusUnit == false
        • Then
          • ------- Is a 10th Kill
          • Variable - Set GiveBonusUnit = true
          • Variable - Set BonusUnitType = Ghost
        • Else
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (PlayerKills[(Killing player)] mod 5) == 0
          • GiveBonusUnit == false
        • Then
          • ------- Is a 5th Kill
          • Variable - Set GiveBonusUnit = true
          • Variable - Set BonusUnitType = Marauder
        • Else
      • ------- Spawn Bonus Unit
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • GiveBonusUnit == true
        • Then
          • Unit - Create 1 BonusUnitType for player (Killing player) at SpawnPoint using default facing (No Options)
        • Else

The trigger is designed that it will only run when a unit dies and the killing player does not own the unit that died. This stops the player from killing their own units to cause the effect.

The first 3 actions (ignoring comments) increases the kill count and gets the spawning location for the killing player. It then spawns a marine to replace the unit that died.

The next thing that occurs is that it determines if a bonus unit is to be spawned. It first checks if the kill count is a multiple of 20 (it divides and checks if the remainder is zero, mod or modulus). It will also check to see if the GiveBonusUnit variable is true. If true then a bonus unit has already been selected for spawning, so we don't want to spawn a weaker class unit. So in order for this to work properly, we need to have the higher level bonus' at the top so they are checked first.

So if these checks pass, it sets the BonusUnitType to the unit that we want to spawn, and it sets the GiveBonusUnit to true so that it won't override with a weaker unit. It will then go through the remainder of the bonus units.

The last part is it checks to see if a bonus it is to be created and if so, it creates it. Hopefully that cleared things up a bit for you. Any questions and I'm happy to answer.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top