• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Respawn only ONCE

Status
Not open for further replies.
Level 3
Joined
Sep 6, 2013
Messages
36
Hi all, please help me. I have a problem with Respawn Trigger.
I tried to make simple respawn trigger, so when anyone kill a monster in my map, the monster will respawn again.
And then I create the trigger and test my map. And when I killed the monster, the monster respawn after 5 secs. But when I killed it again, the monster didn't respawn. Can you help me?
This is a screenshot of my trigger:

Sorry for my bad English.
Thank you before :)
 
You refer to a specific unit.
Once this unit dies you cannot refer to it again.

Use:
  • Test
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Enchanted Skeleton
    • Actions
      • Wait 5.00 seconds
      • Set Temp_Point = (Center of (Region 009 <gen>))
      • Unit - Create 1 Enchanted Skeleton for Player 1 (Red) at Temp_Point facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
 
Use the trigger above.
The explanation why yours doesn't work is that when the skeleton dies it will change his number so the trigger won't fire a second time.
Anyway for a respawn trigger i think it is better to use this
  • Set Temp_Point = (Position of (Triggering unit) )

Indeed.

But only if the unit should spawn where it died and not where its original location was.
 
Level 3
Joined
Sep 6, 2013
Messages
36
Thank you for all your answers.. i already read all, but i still confuse with several things:
1. If I want my unit to respawn on it original location, what trigger i must use?
2. I can't find Set Temp_Point on 'Actions', can you guide me there?

Once again, thank you and sorry for my bad English :D
 
Level 21
Joined
Mar 2, 2010
Messages
3,069
if you want the unit to respawn where it dies i should be able to post an example map for you. i have worked on that kind of script myself so just wait for me to update this post. here it is. what i did was that i used a unit group variable to store the unit then, i used a condition to find out that the unit is in that unit group. the unit is added to the unit group at the start of the game through the Initialization trigger. i also placed a wait before the action so that it takes a few seconds for it to respawn. it works perfectly.
 

Attachments

  • respawn example.w3x
    16.8 KB · Views: 71
Level 16
Joined
Aug 7, 2009
Messages
1,403
if you want the unit to respawn where it dies i should be able to post an example map for you. i have worked on that kind of script myself so just wait for me to update this post. here it is. what i did was that i used a unit group variable to store the unit then, i used a condition to find out that the unit is in that unit group. the unit is added to the unit group at the start of the game through the Initialization trigger. i also placed a wait before the action so that it takes a few seconds for it to respawn. it works perfectly.

Yea, this seems to be a good solution.

Alternatively, what I thought of is a dummy ability based on "Sphere" with no visual. When a unit is respawned, you'd give it this dummy ability (and make it permanent so that they wouldn't lose it if they morph, for example, via hex). When something dies, simply check whether they have this ability or not, and only respawn them if they don't.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You shouldn't use waits. Look at my tutorial things a GUIer should know.

Spawn new unit at position of triggering unit. Then hide the unit.
Wait 5 seconds.
Unhide unit.

I think waits are ok when used in a respawn system. The inaccuracy is quite low percentage-wise as the waits are relatively long.

Hidden units consume processing power so it is better to create the unit after a delay, not instantly.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
I think waits are ok when used in a respawn system. The inaccuracy is quite low percentage-wise as the waits are relatively long.

Hidden units consume processing power so it is better to create the unit after a delay, not instantly.

Inaccuracy is not the problem waits face when using long intervals.
The problem is that they continue to count down when the player disconnect dialog pops up. They also have this problem with a few other things. It gives an unfair advantage to players that know how to cheat the system.
 
Level 3
Joined
Sep 6, 2013
Messages
36
if you want the unit to respawn where it dies i should be able to post an example map for you. i have worked on that kind of script myself so just wait for me to update this post. here it is. what i did was that i used a unit group variable to store the unit then, i used a condition to find out that the unit is in that unit group. the unit is added to the unit group at the start of the game through the Initialization trigger. i also placed a wait before the action so that it takes a few seconds for it to respawn. it works perfectly.

use Variable to track the unit.

Yea, this seems to be a good solution.

Alternatively, what I thought of is a dummy ability based on "Sphere" with no visual. When a unit is respawned, you'd give it this dummy ability (and make it permanent so that they wouldn't lose it if they morph, for example, via hex). When something dies, simply check whether they have this ability or not, and only respawn them if they don't.

I think waits are ok when used in a respawn system. The inaccuracy is quite low percentage-wise as the waits are relatively long.

Hidden units consume processing power so it is better to create the unit after a delay, not instantly.

Inaccuracy is not the problem waits face when using long intervals.
The problem is that they continue to count down when the player disconnect dialog pops up. They also have this problem with a few other things. It gives an unfair advantage to players that know how to cheat the system.

why dont we let the topic starter decide rather than argue.

Thanks all for the answers and sorry for the late reply.
I already learned and tried andreasaspenberg respawn trigger, and it works. But i still confuse about variable. But, overall, all of your answers are very helpful. Thank you again :)
 
Level 3
Joined
Sep 6, 2013
Messages
36
i knew that my trigger worked because i tested it myself. you are welcome to ask me to explain the variable.

andreasaspenberg, i already tried your trigger, but it didn't work for me. I use it to respawn some monsters, but the monsters won't spawn. But when i disable the condition, the trigger is work, but the monsters just respawn only once. After i killed the monsters again, they didn't respawn again.

Can you show the triggers.
You can see my trigger on the 1st post, and for andreasaspenberg's trigger:
  • Events
  • Unit - A unit Dies
  • Conditions
  • ((Dying unit) is in group1) Equal to True
  • Actions
  • Wait 5.00 seconds
  • Unit - Replace (Dying Unit) with a Ogre Lord using The new unit's max life and mana
  • Unit Group - Add (Last replaced unit) to group1
I want to try Solu9 and Malhorne trigger, but i don't know how to create Set Temp Point trigger.
 
Level 25
Joined
Sep 26, 2009
Messages
2,395
I want to try Solu9 and Malhorne trigger, but i don't know how to create Set Temp Point trigger.
It's the "Set variable" action found in -General- submenu of the "Action" menu.

TempPoint is a point variable. Variables allow us to store things in them - a point variable allows you to store point/location in it.
To use a variable, you have to create it beforehand - that is done in Variable editor.
Variable editor can be accessed through Trigger Editor. When you have opened Trigger Editor, look for an icon of yellow/golden "X" (or press CTRL+B).

In the variable editor, you have to create new variable, define its type, give it a name and that's it.
 
Level 3
Joined
Sep 6, 2013
Messages
36
It's the "Set variable" action found in -General- submenu of the "Action" menu.

TempPoint is a point variable. Variables allow us to store things in them - a point variable allows you to store point/location in it.
To use a variable, you have to create it beforehand - that is done in Variable editor.
Variable editor can be accessed through Trigger Editor. When you have opened Trigger Editor, look for an icon of yellow/golden "X" (or press CTRL+B).

In the variable editor, you have to create new variable, define its type, give it a name and that's it.

Thank you, i'll try it :)

each of the units you want to respawn need to be in a unit group. i suggest checking another of the triggers in the map for that. you need to add each unit to a unit group through a trigger.

Umm, how can I insert each unit to a unit group through a trigger? and when I see your variable via Object manager, It shown like this:
  • Variables[1]
  • -Unit Group [1]
    • -group1
      • -Triggers [2]
        • -Initialization [2]
          • Melee Initialization
          • respawn
But when i see my trigger at object manager, it only shown Variables until group1. Seems I forget to do some steps?
Btw, thankyou :D
 
Level 3
Joined
Sep 6, 2013
Messages
36
just use unit group add unit for each unit or you could place a region then add all units in that region. just place it at the bottom of the initialization trigger. i can provide an example if you want.

It work! I forget to add Unit Groups Action at Melee Initialization Trigger.
But once more, the delay respawn time only 4 seconds. I tried >4 seconds and the unit won't respawn. What shoul I do? Am I missing something??
Btw. thanks again mr andreasaspenberg :)
 
andreasaspenberg, i already tried your trigger, but it didn't work for me. I use it to respawn some monsters, but the monsters won't spawn. But when i disable the condition, the trigger is work, but the monsters just respawn only once. After i killed the monsters again, they didn't respawn again.


You can see my trigger on the 1st post, and for andreasaspenberg's trigger:
  • Events
  • Unit - A unit Dies
  • Conditions
  • ((Dying unit) is in group1) Equal to True
  • Actions
  • Wait 5.00 seconds
  • Unit - Replace (Dying Unit) with a Ogre Lord using The new unit's max life and mana
  • Unit Group - Add (Last replaced unit) to group1
I want to try Solu9 and Malhorne trigger, but i don't know how to create Set Temp Point trigger.

What? Dying Unit? Shouldn't that be the local GetTriggerUnit()? Not MUI if you ask me. Also doesn't spawn on a desired region, just the same as the other triggers.
 
Status
Not open for further replies.
Top