Unit Spawn Help

Exogenesis

New Member
Reaction score
0
Trigger:
  • Events
    • Map initialization
    • Conditions
    • Actions
      • Unit - Create 3 Gnoll for Neutral Hostile at (Center of Region 021 <gen>) facing Default building facing degrees
      • Unit - Set Rally-Point for (Last created unit) to (Position of (Last created unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Last created unit) is dead) Equal to True
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Last created unit)) for Neutral Hostile at (Rally-Point of (Last created unit) as a point) facing Default building facing degrees
        • Else - Actions
          • Do nothing


It does create the units but doesnt create the units after they are killed.....
 

neckface

terrain contest winner! :) dance contest loser. :(
Reaction score
34
create each gnoll individually, and set each one to a unit variable: Gnoll1, Gnoll2, Gnoll3
Then you can check to see if Gnoll1 is dead, and do the actions create 1 unit type of Gnoll1 etc...
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
When a unit dies, check if it's a gnoll. If so, create another one at the dying gnoll's position.
 

Exogenesis

New Member
Reaction score
0
Guys I'm planning to add other units to this trigger. Like
Trigger:
  • Events
    • Map initialization
    • Conditions
    • Actions
      • Unit - Create 3 Gnoll for Neutral Hostile at (Center of Region 021 <gen>) facing Default building facing degrees
      • Unit - Set Rally-Point for (Last created unit) to (Position of (Last created unit))
      • Unit - Create 3 Warlocks for Neutral Hostile at (Center of Region 022 <gen>) facing Default building facing degrees
      • Unit - Set Rally-Point for (Last created unit) to (Position of (Last created unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Last created unit) is alive) Equal to False
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Last created unit)) for Neutral Hostile at (Rally-Point of (Last created unit) as a point) facing Default building facing degrees
        • Else - Actions
 

1346610

New Member
Reaction score
6
You need two triggers, in this one just remove the if then else with his action then create

Trigger:
  • Event - A unit Dies
    • Condition - dying unit equal to
    • Action - create unit etc...
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
The trigger will only detect its conditions at the moment it runs. The action won't wait until the created units die to do whatever, and since they were just created, they can't be dead, so those actions never run.

You need another trigger for the death event.
 

Exogenesis

New Member
Reaction score
0
Aight so I added another event within that trigger:
Trigger:
  • Events
    • Map initialization
    • Actions
      • Unit - Create 3 Gnoll for Neutral Hostile at (Center of Region 021 <gen>) facing Default building facing degrees
      • Unit - Set Rally-Point for (Last created unit) to (Position of (Last created unit))
      • Trigger - Add to (This trigger) the event (Unit - A unit Dies)
      • If ((Dying unit) Equal to (Last created unit)) then do (Unit - Create 1 (Unit-type of (Dying unit)) for Neutral Hostile at (Rally-Point of (Last created unit) as a point) facing Default building facing degrees) else do (Do nothing)


But now it just keeps creating gnolls. Like after I kill 1 a billion just show up.....
 

1346610

New Member
Reaction score
6
The trigger will only detect its conditions at the moment it runs. The action won't wait until the created units die to do whatever, and since they were just created, they can't be dead, so those actions never run.

You need another trigger for the death event.

You are wrong, that trigger works 100% also please stop contradicting me
 

Dirac

22710180
Reaction score
147
You are wrong, that trigger works 100% also please stop contradicting me
That comment wasn't directed to you, but to the OP's new version of the code

@Exogenesis
You seem to be extremely confused on what a trigger is, you should read some basic crash courses on triggering and try using what you learnd. I'm no GUI man but the trigger should look like this

Trigger 1

Events - Map Init
Conditions
Actions - Create 3 gnolls somewhere in the map

***********************

Trigger 2

Events - Unit dies
Conditions - Is Dying unit type gnoll
Actions - Create new gnoll to replace it
 

Exogenesis

New Member
Reaction score
0
That comment wasn't directed to you, but to the OP's new version of the code

@Exogenesis
You seem to be extremely confused on what a trigger is, you should read some basic crash courses on triggering and try using what you learnd. I'm no GUI man but the trigger should look like this

Trigger 1

Events - Map Init
Conditions
Actions - Create 3 gnolls somewhere in the map

***********************

Trigger 2

Events - Unit dies
Conditions - Is Dying unit type gnoll
Actions - Create new gnoll to replace it

I know what a trigger is....
If I would use 2 separate triggers, then that would mean I would have to make a whole bunch of triggers per unit group.
Using your first trigger I would have to spawn all of the units in the map. Then I would have to make alike a ton of new triggers for each unit group.
What I'm trying to do is: The unit spawns. I kill the last created unit. That last created unit will spawn at the rally point of position.
It's not "spawn specific unit" but rather "spawn the killed unit." Basically I'm trying to put it into 1 trigger rather than having like 60 other triggers.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Don't add the event A unit dies. That causes the trigger to run once every time a unit dies, regardless of what it is. Added multiple times, the event fires multiple times at once.

Try this:
Trigger:
  • Spawn
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TempPoint = (Random point in (Playable map area))
      • Unit - Create 3 Gnoll for Neutral Hostile at TempPoint facing Default building facing degrees
      • Set TempUnitGroup = (Last created unit group)
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Trigger - Add to Recreate <gen> the event (Unit - (Picked unit) Dies)
          • Unit - Set Rally-Point for (Picked unit) to TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyGroup(udg_TempUnitGroup)


Trigger:
  • Recreate
    • Events
    • Conditions
    • Actions
      • Set TempPoint = (Rally-Point of (Triggering unit) as a point)
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at TempPoint facing Default building facing degrees
      • Trigger - Add to (This trigger) the event (Unit - (Last created unit) Dies)
      • Custom script: call RemoveLocation(udg_TempPoint)
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
@PokemonFreak from Malaysia

I don't think dead units have a "Rally-Point".

Edit: Also instead of using the Set TempUnitGroup = Last create unit group, it would be better to use:
"custom script: set udg_TempUnitGroup = bj_lastCreatedGroup", and that way the call DestroyGroup won't be needed.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top