Respawn problem ;S

kasilopana

New Member
Reaction score
1
Ey', I'm pretty new to the Editor, and I've got a minor problem here. I can't see what the problem is in this these triggers.

I want a unit owned by player 12 (brown) to be respawned after some time (RPG MAP) .
Trigger:
  • Posis of unit
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 12 (Brown)
            • Then - Actions
              • Set Creep_Point[1] = (Position of (Picked unit))
            • Else - Actions


Trigger:
  • when dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Player 12 (Brown)
    • Actions
      • Set Temp_Integer = 1
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Integer Greater than 0
        • Then - Actions
          • Wait 10.00 seconds
          • Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at Creep_Point[1] facing Default building facing degrees
        • Else - Actions
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, one problem I'm seeing is that you are creating 100 + Number of units in (Playable map area) owned by Player 12 - 1 leaks a second with that first trigger ?!

But then I can't seem to understand what you're trying to do there :S
You pick all units every 0.01 seconds, and check if they're owned by Brown, and if they are you overwrite the variable called Creep_Point[1] with that value...

And then, when a unit owned by Brown dies, and some variable which is set to 1 is greater than 0 (Hmm, is 1 greater than 0 ? :S) then you wait 2 seconds, and then you respawn that unit at one of these places which keeps getting overwritten every 0.01 seconds with new points...

Any of this seem odd to you ? :eek:
 

kasilopana

New Member
Reaction score
1
Well, one problem I'm seeing is that you are creating 100 + Number of units in (Playable map area) owned by Player 12 - 1 leaks a second with that first trigger ?!

But then I can't seem to understand what you're trying to do there :S
You pick all units every 0.01 seconds, and check if they're owned by Brown, and if they are you overwrite the variable called Creep_Point[1] with that value...

And then, when a unit owned by Brown dies, and some variable which is set to 1 is greater than 0 (Hmm, is 1 greater than 0 ? :S) then you wait 2 seconds, and then you respawn that unit at one of these places which keeps getting overwritten every 0.01 seconds with new points...

Any of this seem odd to you ? :eek:

hm.. Maybe. But it's not "Every 0.01 seconds" .. Its elapsed game time, and not periodic.
 

Moridin

Snow Leopard
Reaction score
144
Does dying unit still remain a possible option after a wait? I'm not too sure. Try storing the unit into a variable and using the variable instead.

Also, you really don't need that condition in the second trigger. You're setting the integer right before you check if it's greater than 0, so it will always be greater than 0.
 

eric92

New Member
Reaction score
3
Check this out bro its what i use in my map. after 90 seconds it will respawn for u.


Trigger:
  • Spawns
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Wait 90.00 seconds
      • Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Position of (Dying unit)) facing Default building facing degrees
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
this is how your trigger should look like. simple, leak free and working.

Trigger:
  • Spawns
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Wait xx.xx seconds
      • set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • custom Script: call RemoveLocation (udg_TempPoint)

TempPoint is a point variable, it is needed in order to clean memory leaks.
leaks are a really important topic in wc3 triggering if you dont know what they are i advice you to read some turtorials about them. in short a memory leak slows down your computer each time it happens.


one thing though, this is not a professional respawn trigger, that means there is a chance that this will not work.
if you set the wait duration too long the unit will be removed due to its decay. in this case there is no "position of triggering unit" anymore and the unit will not be created.
if you need long respawn timings you need to set the decay time in the gameplay constants to a high value as well, or a good respawning system.

also note that you have to use (Triggering unit) and NOT (Dying unit) because the variable dying unit is not MUI and does therefor not work after a wait properly.
 

Moridin

Snow Leopard
Reaction score
144
also note that you have to use (Triggering unit) and NOT (Dying unit) because the variable dying unit is not MUI and does therefor not work after a wait properly.

That's what I was looking for :p.

one thing though, this is not a professional respawn trigger, that means there is a chance that this will not work.
if you set the wait duration too long the unit will be removed due to its decay. in this case there is no "position of triggering unit" anymore and the unit will not be created.
if you need long respawn timings you need to set the decay time in the gameplay constants to a high value as well, or a good respawning system.

Another way to easily respawn without fear of decaying is to store the points and use timers. However, you would need an array of 13 to get MPI and maybe 100 to achieve MUI with that.
 

kasilopana

New Member
Reaction score
1
this is how your trigger should look like. simple, leak free and working.

Trigger:
  • Spawns
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Wait xx.xx seconds
      • set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • custom Script: call RemoveLocation (udg_TempPoint)

TempPoint is a point variable, it is needed in order to clean memory leaks.
leaks are a really important topic in wc3 triggering if you dont know what they are i advice you to read some turtorials about them. in short a memory leak slows down your computer each time it happens.


one thing though, this is not a professional respawn trigger, that means there is a chance that this will not work.
if you set the wait duration too long the unit will be removed due to its decay. in this case there is no "position of triggering unit" anymore and the unit will not be created.
if you need long respawn timings you need to set the decay time in the gameplay constants to a high value as well, or a good respawning system.

also note that you have to use (Triggering unit) and NOT (Dying unit) because the variable dying unit is not MUI and does therefor not work after a wait properly.

When using that trigger, the unit will just respawn the place where the unit died. I need the unit to respawn where it originally stood..
 

Moridin

Snow Leopard
Reaction score
144
When using that trigger, the unit will just respawn the place where the unit died. I need the unit to respawn where it originally stood..

Then save the point variable in the beginning instead of in this trigger. Have a trigger with either Map Init, or Game Elapsed time 0.5 seconds. :)
 

Sevion

The DIY Ninja
Reaction score
413
Trigger:
  • InitSpawn
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by Player 12 (Brown)) and do (Actions)
        • Loop - Actions
          • Set Creep_Point[Count] = (Position of (Picked unit))
          • Unit - Set the custom value of (Picked unit) to Count
          • Set Count = (Count + 1)


Trigger:
  • Spawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
    • Actions
      • Wait 10.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 12 (Brown) at Creep_Point[(Custom value of (Triggering unit))] facing Default building facing degrees


Should Work.
 

Tyman2007

Ya Rly >.
Reaction score
74
Trigger:
  • InitSpawn
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by Player 12 (Brown)) and do (Actions)
        • Loop - Actions
          • Set Creep_Point[Count] = (Position of (Picked unit))
          • Unit - Set the custom value of (Picked unit) to Count
          • Set Count = (Count + 1)


Trigger:
  • Spawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
    • Actions
      • Wait 10.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 12 (Brown) at Creep_Point[(Custom value of (Triggering unit))] facing Default building facing degrees


Should Work.

Almost.. You forget to set the custom value of the newly created unit to the custom value of the dying unit :p
 

Sevion

The DIY Ninja
Reaction score
413
Why would you use Dying Unit when you can use Trigger Unit universally?

Edit: Bleh. Forgot about that... But, yeah. After the change, it should work flawlessly.
 
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