Need help with triggering

aaron79

New Member
Reaction score
1
I always wanted to know how to make units respawn with out a costom script but i tried so many ways and it doesnt seem to work.if anyone got a simple trigger that can respawn units every minut that would be great.
 

und34d-rul3

New Member
Reaction score
12
Code:
Unit Dies
    Events
        Unit - A unit Dies
    Conditions
    Actions
        Set DeadUnits[unitnumber] = (Dying unit)
        Set Location[unitnumber] = (Position of (Dying unit))
        Set owner[unitnumber] = (Owner of (Dying unit))
        Set unitnumber = (unitnumber + 1)

Code:
Respawn
    Events
        Time - Every 60.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 0 to unitnumber, do (Actions)
            Loop - Actions
                Unit - Create 1 (Unit-type of DeadUnits[(Integer A)]) for owner[(Integer A)] at Location[(Integer A)] facing Default building facing degrees
        Set unitnumber = 0

WARNING - This code has memory leaks in the Respawn trigger. I was unsure how to get rid of the variables when they are an array, I'm not that experienced in JASS at all. Assuming you can fix this memory leaks this should revive units every minute.
 

Lightstalker

New Member
Reaction score
55
Code:
Unit Dies
    Events
        Unit - A unit Dies
    Conditions
    Actions
        Set DeadUnits[unitnumber] = (Dying unit)
        Set Location[unitnumber] = (Position of (Dying unit))
        Set owner[unitnumber] = (Owner of (Dying unit))
        Set unitnumber = (unitnumber + 1)

Code:
Respawn
    Events
        Time - Every 60.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 0 to unitnumber, do (Actions)
            Loop - Actions
                Unit - Create 1 (Unit-type of DeadUnits[(Integer A)]) for owner[(Integer A)] at Location[(Integer A)] facing Default building facing degrees
        Set unitnumber = 0

WARNING - This code has memory leaks in the Respawn trigger. I was unsure how to get rid of the variables when they are an array, I'm not that experienced in JASS at all. Assuming you can fix this memory leaks this should revive units every minute.

JASS:
call RemoveLocation(udg_Your_Variable_Name[YourVariableIndex])


Replace YourVariableIndex with the integer of the array you wish to destroy.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top