Warcraft III resources & community, 2003–2006 · archived

Revive Script

3.4 / 5 (5)
Submitted by 0siris[GoE]Triggers0 downloads
Revives a unit that died after 2 minutes.

I suggest adding conditions.

Source

function Trig_revive_Actions takes nothing returns nothing
    local location position
    local integer unitcode
    local player owner

    set position = GetUnitLoc(GetDyingUnit())
    set unitcode = GetUnitTypeId(GetDyingUnit())
    set owner = GetOwningPlayer(GetDyingUnit())

    call TriggerSleepAction(120.00)
    call CreateUnitAtLoc( owner, unitcode, position, bj_UNIT_FACING )
    call RemoveLocation(position)
endfunction

//===========================================================================
function InitTrig_revive takes nothing returns nothing
    set gg_trg_revive = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_revive, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_revive, function Trig_revive_Actions )
endfunction

Comments

11
Yeah it's strange, I can't access those handles 'Position of (Dying Unit)' and 'Unit-Type of (Dying Unit)' after the corpse disappeared in GUI. With this script it works.

Oh you're right, I've confused them ;)
Umm.. is it that the GUI version doesn't work after the corpse disappears (~88 seconds)? -doesn't know-

Oh, and it seems that the argument is (player, unit-type...), not (unit-type, player..)
PLZ I need Tigger Revive hero with 30 seconds for level!!! Help me.
So, I like it, but DarkShadow is right, it doesn't must be a JASS-Trigger.

But nice wwork, osiris!
LOL, you think I didn't try it? Yes, I did, and it works fine for me (even if many different creeps die and are revived later)

Edit: Just for you I tested the trigger below again, 20 creeps (2 murlocs, 7 gnolls, 9 trolls, 2 murloc hunters), wait time 30 secs...

Killed them with a powerful hero several times via super-flamestrike and simple attacking, after 4 mins I stopped, waiting for everyone to revive, counted the different creeps and...here we go: 2 murlocs, 7 gnolls, 9 trolls, 2 murloc hunters

btw, don't wanna say your JASS-trigger is bad, it's very good, but it also works this way
@DarkShadow: No, this doesn't work, I've tried it so many times.

@AIAndy: Thx for improving my script :)
For creating a single unit rather use CreateUnitAtLoc rather than the Blizzard.j function CreateNUnitsAtLoc.
Öhm, no, it's quite easy and the trigger works fine for any wait time and any number and type of creeps (an example for a creep revive trigger)

CreepRevive
Events
Unit - A unit Dies
Conditions
(Owner of (Dying unit)) Equal to Neutral Hostile
Actions
Wait - [Any Wait Time]
Unit - Create 1 (Unit-type of (Dying unit)) for Neutral Hostile at (Position of (Dying unit)) facing [Any area or so, that's unimportant])
@ Yu_Yevon: With heroes yes, but with normal units it doesn't work, you have to save the position, player and unit-type in a variable first.
In GUI (withouth local vars) it's pretty complex.


@Vexorian: Ok I'll fix that.
I dont understand this couldnt you just make a trigger that says
unit dies
unit equil to _____
wait xxxx seconds
revive hero(instantly)?

To me a jass snipet for somthing like this seems like a unneccsary step.
It is just a JASS trigger and is leaking a location