• 🏆 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!

[Trigger] Creeps respawn

Status
Not open for further replies.
Level 5
Joined
Sep 12, 2009
Messages
82
Hello there!I have one more problem! I created creeps respawn like this:

  • Event
  • Unit - A unit owned by Player 11 (Dark Green) Dies
  • Conditions
  • And - All (Conditions) are true
    • Conditions
      • (Unit-type of (Dying unit)) Not equal to Forest Spider
      • (Unit-type of (Dying unit)) Not equal to Black Spider
      • (Unit-type of (Dying unit)) Not equal to Granite Golem
      • (Unit-type of (Dying unit)) Not equal to Forest Troll
      • (Unit-type of (Dying unit)) Not equal to Forest Troll Warlord
      • (Unit-type of (Dying unit)) Not equal to Quillboar Hunter
  • Actions
    • Wait 99.00 seconds
    • Unit - Create 1 (Unit-type of (Dying unit)) for Player 11 (Dark Green) at (Position of (Dying unit)) facing 360.00 degrees
:eekani:



I attached demo of my map that i am currently creating!
 

Attachments

  • Hapykiller.w3x
    387 KB · Views: 94
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
You have tons of leaks in the map. Location- and unit group leaks.

http://www.hiveworkshop.com/forums/triggers-and-scripts-269/things-that-leak-35124/


  • Conditions
    • And - All (Conditions) are true
      • Conditions
        • (Unit-type of (Dying unit)) Not equal to Forest Spider
        • (Unit-type of (Dying unit)) Not equal to Black Spider
and

  • Conditions
    • (Unit-type of (Dying unit)) Not equal to Forest Spider
    • (Unit-type of (Dying unit)) Not equal to Black Spider
are the same thing, since conditions are behind AND function by default.
 
Level 4
Joined
Feb 17, 2007
Messages
121
:hohum: I maked those mobs not equal cuz they are quest mobs! :con:

EDIT: And post me correct full trigger that will work,not like this :sad:


Try something like this, I reduce the trigger and made it smaller. It works for me and should work for you
Just change the units and player owner

Give reps if useful


  • Goomba
    • Events
      • Unit - A unit owned by Player 11 (Dark Green) Dies
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to Goomba Level 1
    • Actions
      • Wait 10.00 seconds
      • Unit - Create 1 (Unit-type of (Dying unit)) for Player 11 (Dark Green) at (Position of (Dying unit)) facing 360.00 degrees
This only works for one unit so just copy paste trigger and change the units name
" (Unit-type of (Dying unit)) Equal to Goomba Level 1 "
 
erm i think i have spotted the problem tho i am not certain however if you look down at the 'dying unit' part, by the time that has executed the dying unit could be a differant unit, like this: i kill spider, wait 99 seconds it comes back.
i kill a spider, then a gnoll, wait 99 seconds, gnoll comes back. you need to save the dying unit in a variable the variable should then increase so each one i unique you then also need to remove the variable once it has respawned. also your locations leak, i shall show you what u must do here:

Lets just be very simple here: Dont use a trigger, to revive simply give the desired resawning unit ank of reincarnation if you want it to respawn then use a trigger to add exp, money and what not
if you want these units to be on another persons side but not respawn then make a dublicate unit, somehting like that would be like this in a trigger to give gold and whatnot:

  • Last hitter setting
    • Events
      • Unit - a unit is attacked
    • Conditions
    • Actions
      • Setvariable(last hitter) to (attacking unit)
  • exp and gold on 'kill'
    • Events
      • Unit - a unit starts the effect of an ability
    • Conditions
      • Ablity being cast equal to revival
    • Actions
      • Unit - add (amount of exp that would be earned using a formulae eg. level of unit x 10/ number of units equal to unit type of matching unit equal to (your heros) within so much distance of triggering unit and owner of matching unit not equal to owner of unit triggering unit
      • Player - add (so much gold or lumber to owner of unit (lasthitter)
I shall now give an example of what this will do:
example:
5 ghouls, two heros vs a footman
everytime a unit is attacked it becomes the 'last hitter'
as no unit can attack at exactly the same time it will always be one unit.
footman is 'killed' so the effect of the revival abilitiy is activated
then the exp is added, lets say a footman gives 100 exp, unsing my example formulae it means the footman was level 10.
as there are two heros next to him the exp is devided by two, so both heros 50 exp each, then the resources would go the the 'last hitter' witch ofcource would have been the unit witch killed the footman, then 99 seconds later the fotman would be revived.
 
Level 5
Joined
Sep 12, 2009
Messages
82
erm i think i have spotted the problem tho i am not certain however if you look down at the 'dying unit' part, by the time that has executed the dying unit could be a differant unit, like this: i kill spider, wait 99 seconds it comes back.
i kill a spider, then a gnoll, wait 99 seconds, gnoll comes back. you need to save the dying unit in a variable the variable should then increase so each one i unique you then also need to remove the variable once it has respawned. also your locations leak, i shall show you what u must do here:

And how to do that?
(Sorry i am begginer to triggering,i mean i know how to create variable,but i dont know like that?):sad:
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
Use triggering unit instead of dying unit in the action and it will work I think. Also you should learn how to not leak locations.

Make variable called "tmp_loc"

Then do actions:

tmp_loc = (Position of (Dying unit))
//Then create the unit at tmp_loc instead
do a custom script action that does:
call RemoveLocation(udg_tmp_loc)

Then it wont leak either.
 
Level 9
Joined
Oct 17, 2007
Messages
547
I think it would be best and easiest for you to look for a unit respawn system in the resource section here. Saving a dying unit to a variable to respawn it after X seconds will be very hard especially for someone new to triggering. It's also a very long and hectic way of doing it. You will have to keep track of the time and unit types of the ones that are killed which is very hard in GUI.
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
A small wait pluss the unit type of triggering unit-thing is all that is necessary in GUI. If you want to save the original location of the units, that's a little bit harder – but still totally doable for someone new to GUI.
 
Level 9
Joined
Oct 17, 2007
Messages
547
It's very ennoying to do it in variables. Sure you can use the wait but unless u make a new variable for EVERY unit it will not work, even for units with same types. Arrays won't help since its not possible to keep track of which unit is saved when. Try to make GUI triggers for just 3-5 units and you will understand what i mean.
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
Yup, that's how you do it. The name of the variable really doesn't matter though. I named it tmp_loc because tmp = temporary and loc = location – so temporary location.

If you don't do it the way I suggested your map will get laggy.

Here how your trigger should look:

  • Respawn
    • Events
      • Unit - A unit owned by Player X Dies
    • Conditions
    • Actions
      • Wait x seconds
      • Set tmp_loc = (Position of (Triggering unit))
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Player X at tmp_loc facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_tmp_loc)
The reason why you should do this is that if locations in warcraft III are not destroyed, they will still be there and cause lag. Imagine that every time your trigger runs that location is being saved on your computer. In the end that will be a lot of locations, right?
 
Level 9
Joined
Oct 17, 2007
Messages
547
Your script will only work if one unit die per time. If a footman die and has 50 sec repawn time and a grunt die with 60 sec repawn time, at 50 sec the grunt will be respawned since it is the last "dying unit" the map will have less and less mobs the longer the game is played. Not to mention the spawn location will be set at the grunt's last position since its after the wait. Try it out if you gon't believe me, I've been down the same road a few yrs back.
 
'Originally Posted by Tank-Commander
erm i think i have spotted the problem tho i am not certain however if you look down at the 'dying unit' part, by the time that has executed the dying unit could be a differant unit, like this: i kill spider, wait 99 seconds it comes back.
i kill a spider, then a gnoll, wait 99 seconds, gnoll comes back. you need to save the dying unit in a variable the variable should then increase so each one i unique you then also need to remove the variable once it has respawned. also your locations leak, i shall show you what u must do here:'

i forgot to change that, just ignore that. all you need to do is make triggers as i have specified and it should work, but remember to make a revival ability based off the tueren cheiftains reincarnation and give it the correct casting time, and give it to the desired units, sorry for that i'm a little forgetful :S
 
Status
Not open for further replies.
Top