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,463
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.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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