Hero Revive Issues...

Jonnycakes

New Member
Reaction score
6
I have a trigger that periodically revives neutral hero units (there are 4 in total), and it isn't working properly for one of the heroes. There is one other hero that it wasn't working for, but when I changed it's stat "Combat-death type" from "Can't raise, does decay" to "Can raise, doesn't decay", it started reviving (this is after I copy-pasted the unit with a different ID. Also, the other units' death types are "Can't raise, does decay" and the revive works for them).

Those fixes don't work for this hero, though. I have tested this fairly extensively, and I am sure that the revive function is being called, the revive location is correct, the unit type is correct, and the unit variable I am using is not null at the time of the revive. The thing that is puzzling here is that the trigger works for 3 out of the 4 heroes, and there should be nothing different in each case other than the unit ID! In fact, all of the heroes were originally copy-pasted from the same base unit. Has anyone else had this bug before/know what is going on?

EDIT: Solved!

JASS:
scope boss initializer init

globals
    public group boss=CreateGroup()
endglobals

private function nothostile takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)
endfunction

private function actions takes nothing returns nothing
    local integer i
    local unit u
    local real x
    local real y

    loop
        set u=FirstOfGroup(boss)//When a boss dies, it is added to this group. It is then revived periodically.
        exitwhen u==null        
        call GroupRemoveUnit(boss, u)
        set i=GetUnitTypeId(u)
        if i=='N004' then
            set x=GetRectCenterX(gg_rct_Water_Boss)
            set y=GetRectCenterY(gg_rct_Water_Boss)
        elseif i=='N008' then
            set x=GetRectCenterX(gg_rct_Air_Boss)
            set y=GetRectCenterY(gg_rct_Air_Boss)
        elseif i=='N010' then //this is the unit type that doesn't work. It functions exactly like the others, so I am pretty confident it isn't a problem with my trigger.
            set x=GetRectCenterX(gg_rct_Fire_Boss)
            set y=GetRectCenterY(gg_rct_Fire_Boss)
        else
            set x=GetRectCenterX(gg_rct_Earth_Boss)
            set y=GetRectCenterY(gg_rct_Earth_Boss)
        endif
        call ReviveHero(u, x, y, true)
    endloop
    
endfunction

//===========================================================================
private function init takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterTimerEvent(t, 10., true)
    call TriggerAddAction(t, function actions)
endfunction

endscope
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Why not simply create a completely new unit, with the same unit-type as the dead one ? :eek:
 

Rushhour

New Member
Reaction score
46
Better compare IsUnitType() to false and true, it doesn't return the correct value for some unit types, but I can't remember which work.

And try what happens if you do all that revival stuff in a ForGroup() callback.
 

Jonnycakes

New Member
Reaction score
6
@Komagtion-I suppose that would work (as the unit creation is not a problem, just the revival, partially), but I would really like to not resort to that.

@Rushhour-I am pretty sure the issue isn't the IsUnitType() condition-the function runs when it should, it just doesn't revive the hero. The trigger works, but for one specific kind of unit it doesn't for some reason. I don't think altering the trigger will do any good, as I am sure that the trigger is trying to revive a unit of the correct type at the correct location, but the hero just isn't being revived somehow.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
@ Rushhour: It's the native [Ljass]IsUnit()[/ljass] that needs to be checked for true/false :p

@ Jonnycakes: Have you maybe tried to simply make another trigger which kills that specific unit, and then revives it ? :eek:
If that doesn't work, then there's some internal problem, otherwise it's most likely the trigger :D
 

Jonnycakes

New Member
Reaction score
6
Internal problem for sure. Just tested with another trigger per your suggestion-it works for the water boss but not the fire one (which is the one that has the problem). Any ideas on how to fix this?

EDIT: Problem solved-I copied another unit and changed its stats, and now it works...stupid world editor.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • 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

      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