Computer owned heroes won't revive

mylemonblue

You can change this now in User CP.
Reaction score
7
I did a search. Tons of relevant questions came up. None of them seemed to be answered.

What hapens is I'm goofing around with an AoS piece of my map just to see stuff get killed, and I have 2 computer controlled heroes on my team and one on the enemy team. Well, they will revive nicely once or twice, but then refuse to do so afterwards. THey will stay dead. I've tried setting tech tree requirements to nothing, changed game play constants/reset them, and even tried "A unit dies - unit is a hero - revive unit" and it will do the same: Revive it once then leave them dead after that. No trigger or script I have will work it seems.

Current trigger:

Trigger:
  • Hero Died
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Dying unit)) Equal to Player 1 (Red)) or ((Owner of (Dying unit)) Equal to Player 6 (Orange))
        • Then - Actions
          • Countdown Timer - Start ReviveTimers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in 3.00 seconds
          • Hero - Instantly revive (Dying unit) at (Position of Fountain of Health 0145 <gen>), Show revival graphics
        • Else - Actions
          • Countdown Timer - Start ReviveTimers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in 3.00 seconds
          • Hero - Instantly revive (Dying unit) at (Position of Castle 0097 <gen>), Show revival graphics
 

canons200

New Member
Reaction score
50
Try to use triggering unit rather than dying unit. Because triggering unit last forever in that trigger. However, dying is not.
 

mylemonblue

You can change this now in User CP.
Reaction score
7
No luck. Changed it and same thing happens.

I then disabled every trigger with the event "A unit dies" to see if something was conflicting, same thing.
 

TomTTT

New Member
Reaction score
44
As everyone else say, change to triggering unit, but if it's not working... Maybe try checking if they triggering unit really IS owned by player 1 or 6?
Maybe it's simply not. Also i noticed something, not sure if it's a mistake or not, but you did that the timer starts but the unit is revived immeditaly, means the timer is shown but your unit is revived instantly.
 

ultimate11

Active Member
Reaction score
25
yea i saw the problem with revive window to but that isn`t a problem.Use triggering unit should work else means that his triggering unit is not a hero.
 

TomTTT

New Member
Reaction score
44
I tried to make a trigger like yours, and it worked. There was no problem... Try making a pre-set unit on the field and make a trigger that it will die every few second and see if it revives? Maybe that's how you can know if there's problem with the unit dying or trigger problem (which i don't see)...
 

mylemonblue

You can change this now in User CP.
Reaction score
7
I am fairly certain the hero belongs to Player 6, since he doesnt attack the other units belonging to Player 6 nor does he attack me. He is orange too. My hero (Player 1) revives long after player 6's hero stops reviving.

Yes he is a hero, since they were both just modifications of the standard Orc heroes. I then created a new one based off the Far Seer and same issue. Triggering/Dying unit doesn't help either way.

I tried the Dota template's system, nadda. It doesn't seem to care how I set up the triggers, it just only resurrects my hero =/

There *might* be a conflicting trigger that isn't playing nice with the hero revives. I'll post the ones that I think are most likely to be the trouble makers (And later today if worst comes to worst, the map itself.)

Trigger:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Heroes = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Not equal to Neutral Hostile))))
      • Unit Group - Pick every unit in Heroes and do (Actions)
        • Loop - Actions
          • Set Levels = (Levels + (Hero level of (Picked unit)))
      • Set tmpInteger = 0
      • Set DevourCount = 0
      • Set SpellsCast = 0
      • Set SpellsCast = 0
      • For each (Integer A) from 0 to 11, do (Actions)
        • Loop - Actions
          • Set Kill_Count[(Integer A)] = 0
          • Set losses[(Integer A)] = 0
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Set GraveyardPoints[tmpInteger] = (Position of (Picked unit))
          • Set GraveyardUnits[tmpInteger] = (Unit-type of (Picked unit))
          • Unit - Set the custom value of (Picked unit) to tmpInteger
          • Set tmpInteger = (tmpInteger + 1)
      • -------- Define pre-placed heroes --------
      • Set cpuHero[0] = Custom Hero 0066 <gen>
      • Set cpuHero[1] = Troll Shadow Priest 0149 <gen>
      • Set cpuHero[2] = Archmage 0128 <gen>
      • -------- Setup colors for multiboard --------
      • Set Player_Colors[1] = |c00ff0000
      • Set Player_Colors[2] = |c000000ff
      • Set Player_Colors[3] = |c0000ffff
      • Set Player_Colors[4] = |c00800080
      • Set Player_Colors[5] = |c00ffff00
      • Set Player_Colors[6] = |c00ff8000
      • Set Player_Colors[7] = |c0000ff00
      • Set Player_Colors[8] = |c00ff00ff
      • AI - Start melee AI script for Player 6 (Orange): war3mapImported\cityscapeKotoTest.wai
      • Melee Game - Use melee time of day (for all players)
      • Player - Make Player 2 (Blue) treat Neutral Hostile as an Ally with shared vision
      • Player - Make Neutral Hostile treat Player 2 (Blue) as an Ally with shared vision
      • Player - Make Player 8 (Pink) treat Neutral Hostile as an Ally with shared vision
      • Player - Make Player 8 (Pink) treat Player 1 (Red) as an Enemy with shared vision
      • Player - Make Player 8 (Pink) treat Player 2 (Blue) as an Enemy with shared vision
      • Player - Set Player 1 (Red) Current gold to 200
      • Player - Set the current research level of Fragmentation Shards to 1 for Player 2 (Blue)
      • Player - Turn Gives bounty On for Player 2 (Blue)
      • Player - Turn Gives bounty On for Player 8 (Pink)
      • Player - Change color of Player 2 (Blue) to Green, Changing color of existing units
      • Player - Divert 15% of the Gold income of Player 6 (Orange) to Player 1 (Red)
      • Player - Divert 5% of the Gold income of Player 2 (Blue) to Player 6 (Orange)
      • Visibility - Create an initially Enabled visibility modifier for Player 1 (Red) emitting Visibility across (Playable map area)
      • Visibility - Create an initially Enabled visibility modifier for Player 6 (Orange) emitting Visibility across (Playable map area)
      • Visibility - Create an initially Enabled visibility modifier for Player 8 (Pink) emitting Visibility across (Playable map area)
      • Wait 2.00 seconds
      • Trigger - Run guardtower train <gen> (ignoring conditions)


Trigger:
  • Attack
    • Events
      • Time - Every (Random real number between 3.00 and 5.00) seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 2, do (Actions)
        • Loop - Actions
          • Unit - Order cpuHero[(Integer A)] to Attack-Move To (Position of Dummy Caster 0108 <gen>)

(Someone said ordering a revived hero to do something via trigger could cause issues)

Trigger:
  • Respawn 3
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
    • Actions
      • Set tmpPoint = (Position of (Dying unit))
      • Wait until (((Units within 1536.00 of tmpPoint matching (((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True)) is empty) Equal to True), checking every 20.00 seconds
      • Unit - Create 1 GraveyardUnits[(Custom value of (Dying unit))] for Neutral Hostile at GraveyardPoints[(Custom value of (Dying unit))] facing Default building facing degrees
      • Unit - Set the custom value of (Last created unit) to (Custom value of (Dying unit))


Trigger:
  • TrackSpellsCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Casting unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Not equal to Attribute Bonus
        • Then - Actions
          • Set SpellsCast = (SpellsCast + 1)
          • Multiboard - Set the text for (Last created multiboard) item in column 3, row 3 to (String(SpellsCast))
        • Else - Actions


Edited to add that the first of Player 6's two heroes is ordered to immediately charge into the enemy base (with several powerful cannon towers) and dies within seconds. After a while he stops reviving.
 

mylemonblue

You can change this now in User CP.
Reaction score
7
If you mean the timers in the A hero Dies trigger, it was from player 0 to player 11. That was left over from the DotA method though. Didn't work anyway.

It might be the map itself doing this...
 

X-maul

AKA: Demtrod
Reaction score
201
by array size he means:
unavngivetlt.png
 

mylemonblue

You can change this now in User CP.
Reaction score
7
It eh... Um... Was set to 1. -__-

I set it to 11 to hold all 12 players, and tested it. The orange team's heroes will die a few times then stay dead. Player 2's hero hasn't been zapped yet, then again he hasn't died that often.
 

mylemonblue

You can change this now in User CP.
Reaction score
7
Tried something else. I copied this script into a new map and placed four Paladins one for player 1, 2, 3, and 4 without changing the Player Properties tab.

JASS:
function HeroRevival_Conditions takes nothing returns boolean
    return IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO)
endfunction

function HeroRevival_Actions takes nothing returns nothing
    local unit d = GetDyingUnit() // Hero revival
    local player p = GetOwningPlayer(d) // This function updates the leaderboard, creates an item, displays a message and revives the Hero.
    local player k = GetOwningPlayer(GetKillingUnit())
    local integer i = GetPlayerId(k)
    set udg_Points<i> = udg_Points<i> + 1
    call LeaderboardSetPlayerItemValueBJ(k, bj_lastCreatedLeaderboard, udg_Points<i>)
    call LeaderboardSortItemsBJ(bj_lastCreatedLeaderboard, bj_SORTTYPE_SORTBYVALUE, false)
    call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, GetPlayerName(p)+&quot; was killed by &quot;+GetPlayerName(k)+&quot;.&quot;)
    call TriggerSleepAction(10)
    call ReviveHero(d, GetPlayerStartLocationX(p), GetPlayerStartLocationY(p), true)
    call SetUnitState(d, UNIT_STATE_MANA, GetUnitState(d, UNIT_STATE_MAX_MANA))
    call UnitResetCooldown(d)
    call SelectUnitForPlayerSingle(d, p)
    call SetCameraPositionForPlayer(p, GetUnitX(d), GetUnitY(d))
    set d = null
    set p = null
    set k = null
endfunction

//===========================================================================
function InitTrig_HeroRevival takes nothing returns nothing
    set gg_trg_HeroRevival = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_HeroRevival, EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(gg_trg_HeroRevival, Condition(function HeroRevival_Conditions))
    call TriggerAddAction(gg_trg_HeroRevival, function HeroRevival_Actions)
endfunction</i></i></i>


Worked like a charm. I left them clobbering eachother for about half an hour and they were still at it when I got back. Thinking I had gotten it down I copied it and the variable used (udg_Points) into my map and player 6's hero would die a few times and then stop reviving. I do not know if Player 2's hero is having this issue or not. This is leading me to believe that something in my map is not playing nice with hero revival, but I can't for the life of me figure out what. Could it be the custom melee AI?

EDIT: I disabled all the triggers but the Initialization and the JASS revival and Player 6's Hero revives normally. I had him slaughtered eleven times and he continued to revive, whereas he would stop reviving after 2 or 3 deaths before. So there is some trigger that is messing with the reviving.

EDIT 2: Scratch that. I enabled the AoS triggers that spawn enemy units and he revived a dozen times or so then stopped reviving again.
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Using waits or TriggerSleepAction is not ideal for storing variables over a period of time. Try this instead:
JASS:
globals
    unit array Revive_Hero
    constant real Revive_Delay = 10
    timer array Revive_Timer
endglobals

function Callback takes nothing returns nothing
    local integer i = 1
    local integer e = 12
    local location l 
    
    loop
        exitwhen i &gt; e
        if IsUnitAliveBJ(Revive_Hero<i>) == false and GetExpiredTimer() == Revive_Timer<i> then
            set l = GetStartLocationLoc(GetPlayerStartLocation(GetOwningPlayer(Revive_Hero<i>)))
            call ReviveHero(Revive_Hero<i>,GetLocationX(l),GetLocationY(l),true)
            call PauseTimer(GetExpiredTimer())
            call DestroyTimer(GetExpiredTimer())
            set Revive_Hero<i> = null
        endif
        set i = i+1
    endloop
endfunction

function ReviveActions takes nothing returns nothing
    local integer i = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))+1
    
    call TimerStart(Revive_Timer<i>,Revive_Delay,true,function Callback)
    set Revive_Hero<i> = GetTriggerUnit()
endfunction

function ReviveConds takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)
endfunction

function InitTrig_Blank_Trigger takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(t,Filter(function ReviveConds))
    call TriggerAddAction(t,function ReviveActions)
    set t = null
endfunction</i></i></i></i></i></i></i>

Basically, rework your system so it relies on timers rather than waits.
 

mylemonblue

You can change this now in User CP.
Reaction score
7
Hmm now he won't revive at all. Haha, even my hero won't revive now. I figure I must have implemented it wrong. I added the line:

JASS:
function ReviveConds takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) and ( GetOwningPlayer(GetTriggerUnit()) != Player(PLAYER_NEUTRAL_AGGRESSIVE) )
endfunction


because I've been replacing neutral hostile standard creeps with Heroes of the same model file/damage to level up with the player as to prevent them from being revived along with Player 1, 2, and 6.

I was just messing around last night, and P6's hero revived normally for the entire game. It seemed that if I didn't try issuing any orders to him (SHared unit control) or forcefully learning skills for him that everythng would be fine. I don't get it. Sometimes everything works fine other times it doesn't.

Edited: I know that especially when using variables using waits/polled etc is not a good idea. I was trying this http://www.wc3c.net/showthread.php?t=79638 revive function to try and get it to work.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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