• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] hero revive problem

Status
Not open for further replies.
Hi the Hive Community
I have a problem with the revive system i use
it works when only one hero dies but the variable might be overwritten when a seconds hero dies while the other wasnt reborn yet
i didnt test it out but it is obvious that it will happen
what i need is an effective hero revive system in GUI wich is MUI

here is my system so far, plz help me:

  • herorevive
    • Events
      • Unit - A unit dies
    • Conditions
      • ((Triggering unit) is a hero) equal to True
    • Actions
      • Set TempLoc01 = (Center of gg_rct_HeroSpawnLeft)
      • Set TempLoc02 = (Center of gg_rct_HeroSpawnRight)
      • Game - Display to (All allies of (Owner of (Triggering unit))) the text: (((Name of (Triggering unit)) + will be revived in ) + ((String(((Level of (Triggering unit)) x 3))) + seconds.))
      • Wait (3.00 x (Real((Level of (Triggering unit))))) seconds
      • If (((Owner of (Triggering unit)) is in (All allies of player 6 (Orange))) equal to True) then do (hero - Instantly revive (Triggering unit) at TempLoc01, showing revival graphics) else do (Do nothing)
      • If (((Owner of (Triggering unit)) is in (All allies of player 12 (Braun))) equal to True) then do (hero - Instantly revive (Triggering unit) at TempLoc02, Zeigen revival graphics) else do (Do nothing)
      • Set TempLoc00 = (Position of (Triggering unit))
      • camera - Pan camera for (Owner of (Triggering unit)) to TempLoc00 over 2.00 seconds
      • Custom script: call RemoveLocation(udg_TempLoc00)
      • Custom script: call RemoveLocation(udg_TempLoc01)
      • Custom script: call RemoveLocation(udg_TempLoc02)
i know the w8 function should be done wiht a timer or a polled w9 but since the polled isnt available in GUI as far as i know and i was to lazy to do a second trigger i used the w8 function

i w8 for a quick answer,

palaslayer
 
Level 11
Joined
Feb 22, 2006
Messages
752
I'm pretty sure Get Triggering Unit is the only event function that still works after waits. I'm not completely sure though...I always use JASS and just use locals, but something in my head wants to say that there was one event response function that sleeping threads didn't screw up and that Get Triggering Unit was that function. So if anyone sees this and knows for sure I'm wrong, PLEASE set the record straight.

If I'm right, you're trigger should already be MUI as it is, as long as TempLoc01 and TempLoc02 are always at the same location (i.e. those two hero respawn regions are never redefined in-game).

By the way, if that is the case, you don't need to create and destroy those two locations (TempLoc01 and TempLoc02) every time this trigger runs. Just initialize them with a trig at map init and leave them there.

Also, you're leaking two player groups when you call All Allies of Player 6 and All Allies of Player 12. To fix this simply use the function Is Unit an Ally Of (probably not the exact name, but it should be close).
 
-.-

thats why i asked
can u give me a MUI hero revive system? it would be exhausting to care if another unit died before u in-game....
@ricepuff
what i mean is that if a unit dies and it will be revived in 20 secs within these 20 secs another hero dies the first variable will be overwritten and only the second hero will be revived. am i right??
the first would have to quit the game because his hero cant be revived anymore ....
 
Level 5
Joined
Nov 14, 2007
Messages
161
im no pro, but from my experience this is how it works.
yes you are correct GetTriggerUnit() works after waits, but if the event fires and condition met, you have a new GetTriggerUnit() *example 2 heroes die 1 after the other, the first one is set, then the second one overwrites the first. the first one is forgotten and will NEVER spawn*

there are a few ways you can fix this. if only 1 hero per person, save that hero into a variable (Unit Array) such as:
  • Set Var_Unit[(Player number of (Owner of (Triggering unit)))] = (Dying unit)
then wait the desired time and have him re-spawn, or set it to run every X seconds re-spawn all the player in the array.

another alternative would be using locals, which store the unit locally and do not overwrite if the trigger runs again. easiest way would be:
  • Custom script: local unit hero = GetDyingUnit()
now there will be a variable "hero" for all the dying units, kinda hard to comprehend at first, but once u get it. its awesome.

JASS:
function Trig_Revive_Hero_JASS_Conditions takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true
endfunction

function Trig_Revive_Hero_JASS_Actions takes nothing returns nothing
    local timerdialog WINDOW
    local integer HEROWAIT
    local timer OURTIMER
    local unit OURHERO
    set OURHERO = GetDyingUnit()
    set HEROWAIT = ( GetHeroLevel(OURHERO) * 2 + 10 )
    set OURTIMER = CreateTimer()
    call StartTimerBJ( OURTIMER, false, ( I2R(HEROWAIT) ))
    call CreateTimerDialogBJ( OURTIMER, GetPlayerName(GetOwningPlayer(OURHERO)) )
    set WINDOW = GetLastCreatedTimerDialogBJ()
    call TimerDialogDisplayBJ( true, WINDOW )
    call PolledWait( HEROWAIT )
    call ReviveHeroLoc(OURHERO, udg_RessPoint, true )  //set this global point in map init.
    call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
    call DestroyTimerDialog(WINDOW)
endfunction


//TRIGGER USED FROM [url]www.world-editor-tutorials.thehelper.net/revive.php[/url]

if this doesnt make sense i recommend reading this tutorial. it's what helped me to understand the theory behind your problems.

Good luck to you, and let us know if u have more problems.
YO_MA_MA

PS: i re-read one of ur post, and tomorrow, after school, i may be able to right you up something more to your needs. But do give it a shot while you wait, you learn better that way.
 
Status
Not open for further replies.
Top