I don't want AIDS to index my dummy units =/

SineCosine

I'm still looking for my Tangent
Reaction score
77
JASS:
//! runtextmacro BuffType("SlowDown")
    //! runtextmacro SetBuffName("Chilled")
    //! runtextmacro SetBuffAlignment("NEGATIVE")
    //! runtextmacro SetBuffTooltip("This unit has been chilled; it moves more slowly than it usually does.")
    //! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNFrost.blp")
//! runtextmacro BuffStruct()
    integer Slow
    effect e
    string SlowE = "Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl"
    string SlowAP = "chest"
    
    method onApply takes nothing returns nothing
        call Status[this.unit].modMoveSpeedPercentBonus(-Slow)
        set this.e = AddSpecialEffectTarget(SlowE, this.unit, SlowAP)
    endmethod
    
    method onRemove takes nothing returns nothing
        if GetUnitTypeId(this.unit)!=0 then // if the unit still exists.
            call Status[this.unit].modMoveSpeedPercentBonus(Slow)
        endif
        call DestroyEffect(this.e)
        set this.e = null
    endmethod
    
    static method apply takes unit target, integer Amount, real duration returns nothing
        local thistype this=thistype.create(null)
        set this.Slow = Amount
        call this.setUnit(target)
        call this.destroyTimed(duration)
    endmethod

//! runtextmacro EndBuff()
scope Slower initializer OnInit
    globals
        private constant integer PhebeId = 'o01G'
        
        private constant real Range = 600.00
        private constant integer AI = 'A029'
    endglobals

    private function OnDamage takes nothing returns boolean
        if Damage_IsAttack() == true and Status[GetTriggerUnit()].getMoveSpeedPercentBonus() == 0 then
            if GetUnitTypeId(GetEventDamageSource()) == PhebeId then
                call SlowDown.apply(GetTriggerUnit(), 30, 5.0)
            endif
            
            if GetUnitAbilityLevel(GetEventDamageSource(), AI) > 0 then
                call IssueBonusOrder(GetEventDamageSource(), "Slow", Range)
            endif
        endif
        
        return false
    endfunction
    
    private function OnInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call Damage_RegisterEvent(t)
        call TriggerAddCondition(t, Condition(function OnDamage))
    endfunction

endscope


I figured I'd just drop this here..
Remember when you guys told me that adding this:
JASS:
        if GetUnitTypeId(this.unit)!=0 then // if the unit still exists.
            //Stuff
        endif

Should solve it?

Well, I thought it would, so I never tested it after that.
(I got lazy to work on the map.)
I just tried it..
And AIDS is giving me errors as soon as the affected units die ._.

[EDIT]
The error is none other than this:
Error using AIDS: Trying to get the unit of unassigned index.

I haz been cursed!
(Or something like that)

I'll gladly upload the map with the scenario on request >.>
It won't bug on the 1st level on occasion, but the 2nd level onwards bugs like mad (Well, only error messages)
 

Jesus4Lyf

Good Idea™
Reaction score
397
JASS:

//! runtextmacro BuffType("SlowDown")
    //! runtextmacro SetBuffName("Chilled")
    //! runtextmacro SetBuffAlignment("NEGATIVE")
    //! runtextmacro SetBuffTooltip("This unit has been chilled; it moves more slowly than it usually does.")
    //! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNFrost.blp")
//! runtextmacro BuffStruct()
    integer Slow
    effect e
    string SlowE = "Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl"
    string SlowAP = "chest"
    
    method onApply takes nothing returns nothing
        call Status[this.unit].modMoveSpeedPercentBonus(-Slow)
        set this.e = AddSpecialEffectTarget(SlowE, this.unit, SlowAP)
    endmethod
    
    method onRemove takes nothing returns nothing
        if GetUnitTypeId(this.unit)!=0 then // if the unit still exists.
            call Status[this.unit].modMoveSpeedPercentBonus(Slow)
        endif
        call DestroyEffect(this.e)
        set this.e = null
    endmethod
    
    static method apply takes unit target, integer Amount, real duration returns nothing
        local thistype this=thistype.create(null)
        set this.Slow = Amount
        call this.setUnit(target)
        call this.destroyTimed(duration)
    endmethod

//! runtextmacro EndBuff()
scope Slower initializer OnInit
    globals
        private constant integer PhebeId = 'o01G'
        
        private constant real Range = 600.00
        private constant integer AI = 'A029'
    endglobals

    private function OnDamage takes nothing returns boolean
        if Damage_IsAttack() == true and Status[GetTriggerUnit()].getMoveSpeedPercentBonus() == 0 then
            if GetUnitTypeId(GetEventDamageSource()) == PhebeId then
                call SlowDown.apply(GetTriggerUnit(), 30, 5.0)
            endif
            
            if GetUnitAbilityLevel(GetEventDamageSource(), AI) > 0 then
                call IssueBonusOrder(GetEventDamageSource(), "Slow", Range)
            endif
        endif
        
        return false
    endfunction
    
    private function OnInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call Damage_RegisterEvent(t)
        call TriggerAddCondition(t, Condition(function OnDamage))
    endfunction

endscope


I figured I'd just drop this here..
Remember when you guys told me that adding this:
JASS:


        if GetUnitTypeId(this.unit)!=0 then // if the unit still exists.
            //Stuff
        endif

Should solve it?

Well, I thought it would, so I never tested it after that.
(I got lazy to work on the map.)
I just tried it..
And AIDS is giving me errors as soon as the affected units die ._.

[EDIT]
The error is none other than this:


I haz been cursed!
(Or something like that)

I'll gladly upload the map with the scenario on request >.>
It won't bug on the 1st level on occasion, but the 2nd level onwards bugs like mad (Well, only error messages)
Same dealio, post me a map showing the bug in action, and I'll try my best to help you solve it. :)

Assumption is it's not a system bug, though.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
ARGH!
Recently, TH.net has been really slow on my browser >.>

All the other websites seem to load fine, though.
 

Attachments

  • AH-S TD 3-1k.w3x
    798.6 KB · Views: 186

Jesus4Lyf

Good Idea™
Reaction score
397
You need this, man.
JASS:
library RemoveBuffsOnDeath uses BuffStruct
    private struct DeathRemover extends BuffStruct
        private method removeBuff takes nothing returns nothing
            call this.setUnit(null)
        endmethod
        private static method onDeath takes nothing returns boolean
            local BuffList list=BuffList[GetDyingUnit()]
            call list.forEachBuff(BUFF_ALIGNMENT_NEGATIVE,thistype.removeBuff)
            call list.forEachBuff(BUFF_ALIGNMENT_NEUTRAL,thistype.removeBuff)
            call list.forEachBuff(BUFF_ALIGNMENT_POSITIVE,thistype.removeBuff)
            return false
        endmethod
        private static method onInit takes nothing returns nothing
            local trigger t=CreateTrigger()
            call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DEATH)
            call TriggerAddCondition(t,Filter(function thistype.onDeath))
        endmethod
    endstruct
endlibrary

That moves buffs off units when they die, which calls the onRemove method without destroying the actual buff. So destroyTimed will still destroy it at the right point.

You may also remove the previous fix to see if the unit existed.
JASS:
    method onRemove takes nothing returns nothing
        call Status[this.unit].modMoveSpeedPercentBonus(Slow) // no longer needs the check
        call DestroyEffect(this.e)
        set this.e = null
    endmethod

Obviously none of what you're seeing are system bugs, but rather part of the (small) learning curve. BuffStruct is a framework around how to remove and apply buffs, and gives tools for handling when to add/remove/destroy. You were removing the buff after the unit died, which involved modifying the move speed of a unit which didn't exist. This solution causes the buff to be removed as the unit dies, which is the correct thing you wish to achieve...
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Mm..
Thanks for taking the time out to help me =)
I'll bookmark this for when I can get my JNGP WE to open >.>

Strangely enough, my WC3 and normal WE work fine.
It's just the JNGP WE that won't open no matter what I do =/
 

SanKakU

Member
Reaction score
21
i ran a test to see if units would get indexed if i tried altering it.
some of them started to get indexed anyway.

JASS:
    private function UnitIndexingFilter takes unit u returns boolean
        return GetPlayerId(GetOwningPlayer(u))>1
    endfunction


is there something wrong with my code or something wrong with aids?

if the unit is owned by player 0 or player 1, is there any other way the units could be getting indexed? i'm using [ljass]GetUnitId[/ljass]
 

tooltiperror

Super Moderator
Reaction score
231
if the unit is owned by player 0 or player 1, is there any other way the units could be getting indexed?

It's hard to answer such a vague question when you're speaking in [LJASS]engrish[/LJASS]. For the sake of everyone, get a free text editor for spelling and grammar support, and type out your posts there and then copy them over.

For the actual answer, the only way would be to force an index, but I don't think AIDS supports that (Ask Jesus4Lyf).
 

SanKakU

Member
Reaction score
21
Even if the AIDS filter returns false, if an AIDS struct must be instanciated for the unit, it will index the unit also.

None of Status, BuffStruct or Damage seem to do this, but perhaps something else does...
As said in AIDS thread...

that's the very first thing i checked for. i couldn't find anything equating to that. if you'll notice in the other thread i searched the entire aids trigger to find what else could be causing it. so far my results are inconclusive. my understanding of how aids works is yet insufficient.

edit: and like i already said, by the time i can finally successfully do as you asked in that post, i'll have gotten so far in finding THE SOURCE OF the bug that i might as well fix the bug myself. at least i assume i'll be able to fix it.
 
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

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top