What is wrong with this trigger?

Caedin88

New Member
Reaction score
1
Code:
Respawn Test
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Hero - Instantly revive (Triggering unit) at (Position of (Triggering unit)), Hide revival graphics

Problem: Not all dying heroes are being revived.
 

Caedin88

New Member
Reaction score
1
All units are heroes.

This is how they die.

Code:
KillAll
    Events
        Player - Player 1 (Red) types a chat message containing KillAll as An exact match
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is A Hero) Equal to True
                    Then - Actions
                        Unit - Kill (Picked unit)
                    Else - Actions
 

MasterRofl

New Member
Reaction score
8
I think (and this is just me) that since all the units are dying at once, the temp. variable for Triggering Unit is sometimes replaced. If you add a wait after you kill each unit, it would probably work fine.
 

Caedin88

New Member
Reaction score
1
I tested it with
Code:
Respawn Test
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Wait 1.00 seconds
        Hero - Instantly revive (Triggering unit) at (Position of (Triggering unit)), Hide revival graphics

And it worked, but unfortunatly this did not

Code:
Repsawn Test
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Wait 90.00 seconds
        Hero - Instantly revive (Triggering unit) at (Position of (Triggering unit)), Hide revival graphics


My map requires the delay to be over 90 seconds as well. Got an ideas?
 

Azylaminaz

Vox Populi
Reaction score
91
Add the unit to a unit group. Wait 90 seconds, and revive the first unit from the unit group. Then remove it from the unit group.
 

Caedin88

New Member
Reaction score
1
Add the unit to a unit group. Wait 90 seconds, and revive the first unit from the unit group. Then remove it from the unit group.

In order to make the trigger work without losing units I must make the unit group a local variable correct? Could you inform me on the custom text for creating a local unit group variable, thanks!
 

Azylaminaz

Vox Populi
Reaction score
91
It wouldn't need to be done through locals.

Just on a death event..

Add unit to unit group.
Wait 90 seconds.
Revive first unit from unit group (this function might not be in the standard editor's GUI).
To do that...
Code:
call ReviveHeroLoc( FirstOfGroup(GROUP), POINT, «Boolean (revival graphics)» )
Remove unit from unit group.
 

vypur85

Hibernate
Reaction score
803
Not sure. But I've tested with 8 heroes simultaneous death.

Code:
Respawn Test
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Hero - Instantly revive (Triggering unit) at (Position of (Triggering unit)), Hide revival graphics

Code:
Repsawn Test
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Wait 90.00 seconds
        Hero - Instantly revive (Triggering unit) at (Position of (Triggering unit)), Hide revival graphics
Both the triggers above worked well as it should. You sure all the units involved are heroes?
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
I could be wrong here but I doubt the game will remember where the hero died after 90 secs
 

vypur85

Hibernate
Reaction score
803
> after 90 secs

I tested it. It worked. But only 8 heroes. Not sure how many heroes are involved here. And not sure if numbers does matter.
 

Caedin88

New Member
Reaction score
1
It wouldn't need to be done through locals.

Just on a death event..

Add unit to unit group.
Wait 90 seconds.
Revive first unit from unit group (this function might not be in the standard editor's GUI).
To do that...
Code:
call ReviveHeroLoc( FirstOfGroup(GROUP), POINT, «Boolean (revival graphics)» )
Remove unit from unit group.


I think I got it, like a Queue structure, thanks testing it right now.

In response to the other replies...

Basically this is a freeform RPG map and and the enemy units all throughout the world need to respawn after about 2 minutes, so the game doesn't become depleted of enemies... and the units have to be heroes because after respawning they need to be given the level of the average level of all human player's heroes so the world scales in difficulty as you level up.

Its worth noting that I still lose units even if they dont all die at the same time, when playing through the game normally I notice about half the heroes don't respawn.
 

Caedin88

New Member
Reaction score
1
It wouldn't need to be done through locals.

Just on a death event..

Add unit to unit group.
Wait 90 seconds.
Revive first unit from unit group (this function might not be in the standard editor's GUI).
To do that...
Code:
call ReviveHeroLoc( FirstOfGroup(GROUP), POINT, «Boolean (revival graphics)» )
Remove unit from unit group.

I tested it but only the first unit was revived because I was unable to Remove the unit from the unit group after the 90 second wait because I have no reference to that unit... Triggering unit seems to not work correctly after a 90 second wait... I've found the same problem with local unit variables.

My complete Trigger is as follows...

Code:
Respawn
    Events
        Unit - A unit Dies
    Conditions
    Actions
        Custom script:   local unit DEATH = GetDyingUnit()
        Unit Group - Add (Triggering unit) to UnitGroupTest
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (Owner of (Dying unit)) Equal to Neutral Hostile
                        (Owner of (Dying unit)) Equal to Neutral Passive
                (Unit-type of (Dying unit)) Not equal to Shadow
            Then - Actions
                Set Bounty = ((Random integer number between 1 and 2) x ((Hero level of (Dying unit)) x (Hero level of (Killing unit))))
                Player - Add Bounty to (Owner of (Killing unit)) Current gold
                Floating Text - Create floating text that reads ((String(Bounty)) + !) at (Position of (Dying unit)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                Floating Text - Change (Last created floating text): Disable permanence
                Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
                Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Dying unit) is A Hero) Equal to True
                    Then - Actions
                        Wait 90.00 seconds
                        Custom script:   call ReviveHeroLoc( FirstOfGroup(udg_UnitGroupTest), GetUnitLoc(FirstOfGroup(udg_UnitGroupTest)), false )
                        Custom script:   call SetHeroLevelBJ( FirstOfGroup(udg_UnitGroupTest), ( udg_AvgLevel[2] / udg_AvgLevel[1] ),false)
                    Else - Actions
                        Wait 90.00 seconds
                        Custom script:   call CreateNUnitsAtLoc( 1, GetUnitTypeId(FirstOfGroup(udg_UnitGroupTest)), GetOwningPlayer(FirstOfGroup(udg_UnitGroupTest)), GetUnitLoc(FirstOfGroup(udg_UnitGroupTest)), GetUnitFacing(FirstOfGroup(udg_UnitGroupTest)))
                        Custom script:   call RemoveUnit(FirstOfGroup(udg_UnitGroupTest))
                Custom script:   call GroupRemoveUnitSimple( DEATH, udg_UnitGroupTest )
                Custom script:   set DEATH = null
            Else - Actions


Above does not work, below works fine.

Code:
Respawn
    Events
        Unit - A unit Dies
    Conditions
    Actions
        Custom script:   local unit DEATH = GetDyingUnit()
        Unit Group - Add (Triggering unit) to UnitGroupTest
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (Owner of (Dying unit)) Equal to Neutral Hostile
                        (Owner of (Dying unit)) Equal to Neutral Passive
                (Unit-type of (Dying unit)) Not equal to Shadow
            Then - Actions
                Set Bounty = ((Random integer number between 1 and 2) x ((Hero level of (Dying unit)) x (Hero level of (Killing unit))))
                Player - Add Bounty to (Owner of (Killing unit)) Current gold
                Floating Text - Create floating text that reads ((String(Bounty)) + !) at (Position of (Dying unit)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                Floating Text - Change (Last created floating text): Disable permanence
                Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
                Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Dying unit) is A Hero) Equal to True
                    Then - Actions
                        Custom script:   call ReviveHeroLoc( FirstOfGroup(udg_UnitGroupTest), GetUnitLoc(FirstOfGroup(udg_UnitGroupTest)), false )
                        Custom script:   call SetHeroLevelBJ( FirstOfGroup(udg_UnitGroupTest), ( udg_AvgLevel[2] / udg_AvgLevel[1] ),false)
                    Else - Actions
                        Wait 90.00 seconds
                        Custom script:   call CreateNUnitsAtLoc( 1, GetUnitTypeId(FirstOfGroup(udg_UnitGroupTest)), GetOwningPlayer(FirstOfGroup(udg_UnitGroupTest)), GetUnitLoc(FirstOfGroup(udg_UnitGroupTest)), GetUnitFacing(FirstOfGroup(udg_UnitGroupTest)))
                        Custom script:   call RemoveUnit(FirstOfGroup(udg_UnitGroupTest))
                Custom script:   call GroupRemoveUnitSimple( DEATH, udg_UnitGroupTest )
                Custom script:   set DEATH = null
            Else - Actions
 

Caedin88

New Member
Reaction score
1
I've solved the problem by giving all Neutral Hostile and Neutral Passive units in my game a reincarnation spell with 0 cooldown and 90 second delay to revive.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top