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

[Solved] Problem Reviving Computer's Hero

Status
Not open for further replies.
Level 4
Joined
Dec 3, 2012
Messages
51
Hi, I have been having issues trying to get a revive hero trigger to work properly. It has been stable and working for all user controlled slots, but it only revives computer heroes once. After they die the second time, they are not revived. Player 5 is the computer, players 3 and 4 are user controlled, but revive at a different altar (using a different trigger that does works). Again, when player 5's hero dies, it revives one time, but after that will not revive.

Here is the trigger
  • Hero Revive
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Wait 10.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (((Triggering unit) is A Hero) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 4 (Purple))
          • (((Triggering unit) is A Hero) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 3 (Teal))
          • (((Triggering unit) is A Hero) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 5 (Yellow))
          • ((Triggering unit) is A Hero) Equal to ((Triggering player) is an ally of Player 5 (Yellow))
        • Then - Actions
          • Hero - Instantly revive (Dying unit) at (Center of Camp Altar <gen>), Show revival graphics
        • Else - Actions
          • Do nothing
Since player 5 does own the altar, I have tried using an alternate strategy, but it does not work.
  • Untitled Trigger 001
    • Events
      • Unit - A unit Becomes revivable
    • Conditions
      • (Owner of (Revivable Hero)) Equal to Player 5 (Yellow)
    • Actions
      • Unit - Order Altar of Elders 0119 <gen> to Revive Hero (Revivable Hero)
Any help would be appreciated as I really want this trigger to work.

Thanks
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
(You misplaced the trigger tags :D The triggers should go in between the tags, not outside).
  • Hero Revive
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Wait 10.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (((Triggering unit) is A Hero) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 4 (Purple))
          • (((Triggering unit) is A Hero) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 3 (Teal))
          • (((Triggering unit) is A Hero) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 5 (Yellow))
          • ((Triggering unit) is A Hero) Equal to ((Triggering player) is an ally of Player 5 (Yellow))
        • Then - Actions
          • Hero - Instantly revive (Dying unit) at (Center of Camp Altar <gen>), Show revival graphics
        • Else - Actions
          • Do nothing
  • Untitled Trigger 001
    • Events
      • Unit - A unit Becomes revivable
    • Conditions
      • (Owner of (Revivable Hero)) Equal to Player 5 (Yellow)
    • Actions
      • Unit - Order Altar of Elders 0119 <gen> to Revive Hero (Revivable Hero)
First of all: never use "Do Nothing".

The problem is that "Dying Unit" doesn't exist after a wait. I don't even know how it was able to revive the first time :p.
Anyway, "Dying Unit" should never be used: always use "Triggering Unit" instead (it doesn't have this problem).
Waits do have more problems, so I would actually advise you to change to some sort of timed system without waits. However, they don't always cause problems.

If you still can't get it to work and you don't want to create the system yourself, then here's a simple system that does all the work for you :p.
 
Level 4
Joined
Jul 20, 2012
Messages
83
Using an action with Triggering Unit after Wait function might get easily overlapped by next dying unit between starting the trigger and action between those 10 seconds of waiting...
It's better to put conditions right in conditions section not as If/Then/Else...
Then you have to store the dying unit into variable before the Wait function (for MUI use the variable with an array), after Wait there goes this: Hero - Instantly revive *your_variable[player number of (owner of (dying unit))]* at (Center of Camp Altar <gen>), Show revival graphics
 
Level 4
Joined
Dec 3, 2012
Messages
51
Thanks for all the replies. I'm mulling over a few of the options. It's just strange the trigger I posted worked fine with user controlled slots, then the other day I added a computer controlled Hero and he we are.

I tried modifying a system found on thehelper.net (free dota template by SD_Ryoko) , but it won't work exactly as expected:

I want it to revive red, blue yellow and orange heroes independently. Also, I have another trigger that allows orange to change forces, so this revive hero trigger can not interfere with that. Teal and Purple are part of the same force, but have to revive at a different location, unless their townhall is destroyed, in which case they revive at the same location as the rest (already have a trigger that seems to work for that).


Here is my slightly modified trigger for red, blue yellow and orange:
  • Revive Hero
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (((Dying unit) is A Hero) Equal to True) and ((Owner of (Dying unit)) Not equal to Player 3 (Teal))
          • (((Dying unit) is A Hero) Equal to True) and ((Owner of (Dying unit)) Not equal to Player 4 (Purple))
          • ((Dying unit) is A Hero) Equal to ((Triggering player) is an ally of Player 5 (Yellow))
    • Actions
      • Unit Group - Add (Dying unit) to RevivableHeroes
      • Set TempReal = (((Real((Hero level of (Dying unit)))) x 2.00) + 8.00)
      • Countdown Timer - Start ReviveTimers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in TempReal seconds
  • Revive Hero Timer
  • Events
    • Time - ReviveTimers[1] expires
    • Time - ReviveTimers[2] expires
    • Time - ReviveTimers[5] expires
    • Time - ReviveTimers[6] expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RevivableHeroes and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
            • Then - Actions
              • Hero - Instantly revive (Picked unit) at (Center of Camp Altar <gen>), Show revival graphics
            • Else - Actions
  • Revive Hero Camera
    • Events
      • Unit - A unit Finishes reviving
    • Conditions
      • ((Reviving Hero) is in RevivableHeroes) Equal to True
    • Actions
      • Unit Group - Remove (Reviving Hero) from RevivableHeroes
      • Countdown Timer - Destroy RevivableTimersWindows[(Player number of (Owner of (Reviving Hero)))]
      • Camera - Pan camera for (Owner of (Reviving Hero)) to (Position of (Reviving Hero)) over 0.60 seconds
      • Selection - Select (Reviving Hero) for (Owner of (Reviving Hero))
When I test it, none of the heroes revive unless player one's heroes die, in which case they all revive at the same time. I want it so they revive independently. What am I missing here?

Thanks in advance
 
Last edited by a moderator:
Level 37
Joined
Mar 6, 2006
Messages
9,240
Ue this systems. It supports one hero per player. It only revives heroes for players that have the HERO_LOC set. Set those at the map initialization trigger.

  • RevInit
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: if udg_RTIM[bj_forLoopAIndex] == null then
          • Custom script: set udg_RTIM[bj_forLoopAIndex] = CreateTimer()
          • Custom script: endif
          • Trigger - Add to RevRevive <gen> the event (Time - RTIM[(Integer A)] expires)
      • -------- ----- REVIVE POINT FOR PLAYER 1 ----- --------
      • Set REVIVE_LOCS[1] = (Center of Region 000 Copy <gen>)
      • -------- ----- REVIVE POINT FOR PLAYER 2 ----- --------
      • Set REVIVE_LOCS[2] = (Center of Region 000 <gen>)
  • RevHeroDie
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Custom script: if udg_REVIVE_LOCS[GetPlayerId(GetTriggerPlayer())+1] != null then
      • Set i1 = (Player number of (Triggering player))
      • Set RHER[i1] = (Triggering unit)
      • Countdown Timer - Start RTIM[i1] as a One-shot timer that will expire in 3.00 seconds
      • Custom script: if udg_RWIN[udg_i1] == null then
      • Countdown Timer - Create a timer window for RTIM[i1] with title (Proper name of (Triggering unit))
      • Set RWIN[i1] = (Last created timer window)
      • Countdown Timer - Hide RWIN[i1]
      • Custom script: endif
      • Countdown Timer - Show RWIN[i1] for (Triggering player)
      • Custom script: call SaveInteger(udg_Hash, GetHandleId(udg_RTIM[udg_i1]), 0, udg_i1)
      • Custom script: endif
  • RevRevive
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_i1 = LoadInteger(udg_Hash, GetHandleId(GetExpiredTimer()), 0)
      • Hero - Instantly revive RHER[i1] at REVIVE_LOCS[i1], Show revival graphics
      • Countdown Timer - Hide RWIN[i1]
 

Attachments

  • Revive_Timers.w3x
    19.5 KB · Views: 44
Status
Not open for further replies.
Top