• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Respawn issue

Status
Not open for further replies.
Level 2
Joined
Dec 16, 2016
Messages
14
So im using a respawn trigger i found in this forum. The issue with the trigger is it respawns all the monsters with the same time. I want 2 different respawn timers atleast, one for normal monsters then bosses.

I tried to fix it by configuring the script by adding another if, then, else function, if it's either a hero or not a hero instead of just a neutral hostile.. The issue now is that when i kill certain monster a boss will spawn multiple times.

Yr4qTFB.png

zUbercj.png


Someone know what the issue can be. I can upload the map aswell if you wanna see.
Kill monster surrounding my test unit "Rifleman". Watch the frog boss.
 

Attachments

  • teestest.w3x
    45.6 MB · Views: 118
Level 39
Joined
Feb 27, 2007
Messages
5,023
You can actually simplify the trigger:
  • Events
    • Unit - A unit owned by Neutral Hostile dies
  • Conditions
  • Actions
    • If (All conditions) then (actions) else (actions)
      • If - Conditions
        • (Triggering Unit) is a Hero equal to true
      • Then - Actions
        • Wait 90.00 seconds
      • Else - Actions
        • Wait 15.00 seconds
    • Unit - Create 1 GraveyardUnits[...] ...
    • Unit - Set the custom value of...
Could be not working because "Dying unit" isn't working after a wait. I'm unsure if it's supposed to, but you can try using "triggering unit" instead (and should use TU in most cases if you can)
 
Level 14
Joined
Nov 30, 2013
Messages
926
Because the Dying Unit is a variable that will change every time a unit dies. (It isn't ideal when there's a wait action in your trigger)

You can use a local variable that stores the dying unit before triggering the wait action then creates a unit through your unit-type array with a custom value of that local variable.

  • Custom script: local unit <Name> = GetDyingUnit()
 
Level 2
Joined
Dec 16, 2016
Messages
14
I can add, that before i added the new if, then else function. It worked perfectly. But when i add a condition checking if it was a hero or not, instead of just a unit. It started to bugg out.
Im curious if it could be a very specific bugg that is happening. If the monster im killing have the same custom value as the boss or something that like that. So when it tries to respawn the monster it causes the boss to respawn instead.
 
Level 2
Joined
Dec 16, 2016
Messages
14
You can actually simplify the trigger:
  • Events
    • Unit - A unit owned by Neutral Hostile dies
  • Conditions
  • Actions
    • If (All conditions) then (actions) else (actions)
      • If - Conditions
        • (Triggering Unit) is a Hero equal to true
      • Then - Actions
        • Wait 90.00 seconds
      • Else - Actions
        • Wait 15.00 seconds
    • Unit - Create 1 GraveyardUnits[...] ...
    • Unit - Set the custom value of...
Could be not working because "Dying unit" isn't working after a wait. I'm unsure if it's supposed to, but you can try using "triggering unit" instead (and should use TU in most cases if you can)

I had that thought aswell. But the trigger worked earlier when it only checked if the unit that died was a neutral hostile even tho the wait action was still there, instead of either it's a hero or not.
 
Level 2
Joined
Dec 16, 2016
Messages
14
Depending on some unit settings and perhaps other triggers it may be the case that the unit is not existant anymore after your wait duration.
I mean not only "dead" but really "removed". And you can not refer any longer to removed units, so new creation of "old unit type" and such will fail if not stored either way.

I dont think thats the issue since it worked earlier. But i guess i can try to fix it by storing the unit in a variable before the wait function. But im at work right now so cant try it.
 
Level 11
Joined
May 16, 2016
Messages
730
I tried to fix it by configuring the script by adding another if, then, else function, if it's either a hero or not a hero instead of just a neutral hostile.. The issue now is that when i kill certain monster a boss will spawn multiple times.
Taadaa! I fixed respawn system. (P.S I changed to 5 second respawn command but you can change it back to 90 and 15 sec)
 

Attachments

  • teestest editted.w3x
    45.6 MB · Views: 39
Level 2
Joined
Dec 16, 2016
Messages
14
Taadaa! I fixed respawn system. (P.S I changed to 5 second respawn command but you can change it back to 90 and 15 sec)

Oh thanks! I can't test it right now. Will try later tonight.

Also a question without looking at the fix, is it possible to add more different wait types then just 2?
Right now i have normal unit which will be around 20 seconds. A more easier boss 90 seconds. then hard bosses maybe 150. and unique bosses 240?

Do you get what im saying, so there will be 4-7 categories of monster that all have different respawn timers? :)
 
Level 11
Joined
May 16, 2016
Messages
730
Oh thanks! I can't test it right now. Will try later tonight.

Also a question without looking at the fix, is it possible to add more different wait types then just 2?
Right now i have normal unit which will be around 20 seconds. A more easier boss 90 seconds. then hard bosses maybe 150. and unique bosses 240?

Do you get what im saying? :)
I improved your map. I added trigger "Respawn SET TIMER" where you can choose real[3] which store respawn time for unit's classifications (in my example if hero then 15 sec, else 90 sec. you can add more options)
 

Attachments

  • teestest editted (various timers).w3x
    45.6 MB · Views: 89
A tip for adding different respawn times for different units is to use the units point value as respawn time, this way you can give each unit an individual respawn time in the object editor. The only drawback of this is that the score screen will display the wrong scores, but this is usually a non-issue. You have to convert the point value from integer to real in the trigger.
 
Level 2
Joined
Dec 16, 2016
Messages
14
A tip for adding different respawn times for different units is to use the units point value as respawn time, this way you can give each unit an individual respawn time in the object editor. The only drawback of this is that the score screen will display the wrong scores, but this is usually a non-issue. You have to convert the point value from integer to real in the trigger.

Could you give an example on how the action would look like? Im not that experienced with world editor yet.
 
Level 2
Joined
Dec 16, 2016
Messages
14
He means every unit in Object Editor has own point value (id: upoi). You can change point values and in trigger editor just replace stored timer with real(Integer(Point value of unit))
Yeah that i understand. the first part. It's the second part im worried about. But thanks gonna try that!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
The initial issue was likely caused by the boss units being removed before respawn and hence all reference to their data was lost.

A unit only has a custom value while it exists. If you wait long enough after death that it fully decays then that custom value is lost as the unit is removed. Hence getting the custom value of a removed unit returns all kinds of nonsense and certainly not what you wanted. The solution is to store the custom value at the start of the trigger in a local variable and use that variable after the wait.
 
Level 2
Joined
Dec 16, 2016
Messages
14
I improved your map. I added trigger "Respawn SET TIMER" where you can choose real[3] which store respawn time for unit's classifications (in my example if hero then 15 sec, else 90 sec. you can add more options)
When trying to open the map in world editor i get a bunch of "Trigger function does not exist in database: Create timer" :/
 
Level 2
Joined
Dec 16, 2016
Messages
14
Looks like your editor desn't support some actions, nevermind. try this one
That dosnt work either :/
It says trigger CreateTimerBj this time, but only that trigger and critical error.

I've tried different types of world editor. Jassnewgen, Jass 2.0 and NewGen 5d, also tried patching the game to 1.26a, 1.27a and 1.27b.
 
Level 2
Joined
Dec 16, 2016
Messages
14
Sounds like a corrupt install, then. You should reinstall the whole program; I recommend the standalone installer from the Battle.net website.
Warcraft 3 or the editor?
The editor i use i didnt install. I just extract the Jass newgen 2.0 on the desktop
 
Level 11
Joined
May 16, 2016
Messages
730
That dosnt work either :/
It says trigger CreateTimerBj this time, but only that trigger and critical error.

I've tried different types of world editor. Jassnewgen, Jass 2.0 and NewGen 5d, also tried patching the game to 1.26a, 1.27a and 1.27b.

ALL right this is 100 % variant I changed all to custom scripts so your wc3 client wouldn't conflict anymore. I checked with my old version clients.
 

Attachments

  • teestest editted (various timers).w3x
    45.6 MB · Views: 162
Level 2
Joined
Dec 16, 2016
Messages
14
ALL right this is 100 % variant I changed all to custom scripts so your wc3 client wouldn't conflict anymore. I checked with my old version clients.
Yeyy! It works! What causes the errors?
When i searched the forum for similar errors i saw another guy had the same issue that got a map from you.

Jesus christ dude this is complicated script you made. Thanks alot.
 
Level 11
Joined
May 16, 2016
Messages
730
Yeyy! It works! What causes the errors?
When i searched the forum for similar errors i saw another guy had the same issue that got a map from you.

Jesus christ dude this is complicated script you made. Thanks alot.
It is a problem of WE versions. I used my own version to avoid Custom Script writing. That's annoying.
Anyway all you have to do is move to Respawn SET TIMER and set timers (real[3]) for each unit[0] type (or class). Only. Other respawn actions the game will do automatically.
 
Level 2
Joined
Dec 16, 2016
Messages
14
It is a problem of WE versions. I used my own version to avoid Custom Script writing. That's annoying.
Anyway all you have to do is move to Respawn SET TIMER and set timers (real[3]) for each unit[0] type (or class). Only. Other respawn actions the game will do automatically.
I think i understand how to implement more respawn timers. But this is abit embarassing. What i can't find is where to set a units classification in object editor.
Either that or if i cant edit the trigger easily by taking the point value from the monster and set as respawn timer as another user said.
  • Respawn SET TIMER
    • Events
    • Conditions
    • Actions
      • -------- TIMERS FOR EACH UNIT ACCORDING TO DANGER LEVEL --------
      • -------- YOU CAN STORE TIMERS FOR EACH PICKED UNIT TYPE IF YOU WANT --------
      • -------- real[3] - RESPAWN TIME --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Set real[3] = (Real((Point-value of (Unit-type of unit[0]))))
        • Else - Actions
      • Hashtable - Save real[3] as 3 of integer2 in HASHDEATH
This seems to work actually!
 
Last edited:
Status
Not open for further replies.
Top