System Advanced Indexing & Data Storage

Jesus4Lyf

Good Idea™
Reaction score
397
The code has very different philosophies of how to work. There's the AIDS --> Damage --> BuffStruct philosophy and the AutoIndex --> DamageEvent/DamageModifiers --> Orb Stacking philosophy. Trying to cut from one to the other half way is unlikely to work unless someone goes out of their way to construct a version of a system which works on both. Perhaps what you want to achieve can be done with Damage some how (I expect it can). Maybe not. What do you want, exactly? Or is this a more general question... :)
 

Laiev

Hey Listen!!
Reaction score
188
a general question.
I just noticed that AIDS and AutoIndex, not a 100% above the needs of the other and each has its good and bad.
was trying to understand how far will their differences in terms of indexing.
because until then the only, say, directly striking difference between AIDS and AutoIndex, besides the names, of course, is how to implement them
:)
 

muzzel

New Member
Reaction score
1
Hello,
im using an AIDS struct to assign custom stats to all units in my map. This works pretty well, my only problem is the initialization order. AIDS is nearly on top of my ini order cause damagedetection and stuff use it. But the .onCreate method of my AIDS struct requires some values that are calculated in a library which gets initialized much later.
So the system only works for units that are created during game, not for units placed in the editor.

Is there a simple way to delay or manually call the functionality that creates those AIDS structs for the preplaced units?
 

Jesus4Lyf

Good Idea™
Reaction score
397
the .onCreate method of my AIDS struct requires some values that are calculated in a library which gets initialized much later.
Is there a reason for them to be initialised later? Can they be initialised earlier, using a module maybe?

The best option here would be, after the values are initialised, pick every unit in the map and write the value in that you need set.
 

tooltiperror

Super Moderator
Reaction score
231
I just realized the incredible power of this, not that I thought it was powerless before, but I just realized the full potential of this system.

Oh well, time to try to think of a way to bring it to vanilla JASS, tee hee.
 

tooltiperror

Super Moderator
Reaction score
231
It would probably greatly help Jesus4Lyf if you simplified your code as much as you can with the bug still happening, upload the map you are using, and make it as easy to remake as possible.
 

Jesus4Lyf

Good Idea™
Reaction score
397
It would probably greatly help Jesus4Lyf if you simplified your code as much as you can with the bug still happening, upload the map you are using, and make it as easy to remake as possible.
Might also help you solve your own problem. But I can't help you without a concise (ie. shred off as much code as you can without stopping the bug) demo map. :)
 

tooltiperror

Super Moderator
Reaction score
231
When this becomes a module it will become amazingly epic.

[LJASS]implement AIDS[/LJASS]
 

SanKakU

Member
Reaction score
21
Might also help you solve your own problem. But I can't help you without a concise (ie. shred off as much code as you can without stopping the bug) demo map. :)

no offense intended, but i feel like you're asking me to find the source of the bug myself.
i could be wrong but i think the cause is some unforeseen conflict with another system.

edit: i think i have asked you before, but i guess i'll ask again since i didn't understand your answer the first time. what is a module?

edit2: Jesus4Lyf, as far as i can tell, this is going to take me ages to figure out. i'm not even sure why my test map keeps loading me as red player when it's supposed to load me as teal. lol.

edit3:hmm...doing a search for 'filter' in aids turned up some interesting comments:
JASS:
// Called in AIDS structs when units do not pass the initial AIDS filter.
// Called in AIDS structs when units have passed the initial AIDS filter.
                // The unit did not pass the filters, so does not need to be auto indexed.
                // However, for certain AIDS structs, it may still require indexing.
                // These structs may index the unit on their creation.
                // We flag that an index must be assigned by setting the current index to 0.
            //Enum every non-filtered unit on the map during initialization and assign it a unique
            //index. By using GroupEnumUnitsOfPlayer, even units with Locust can be detected.

those comments are disturbing.
i have many issues with these comments. first of all, why are we indexing units if we were asked not to? secondly, why are we trying to index every unit possible? can't you add some user-friendly customization to this system?

why do you assume the user wants to index everything? and if he tries to stop you from indexing units, you index them anyway?
 

tooltiperror

Super Moderator
Reaction score
231
no offense intended, but i feel like you're asking me to find the source of the bug myself.
i could be wrong but i think the cause is some unforeseen conflict with another system.

... exactly. You should be able to replicate the bug exactly in a demo map and post it.
 

Jesus4Lyf

Good Idea™
Reaction score
397
I am obliged to debug my system, when a certain bug is made apparent.
I am happy to debug your use of my systems (in this circumstance it is almost definitely not a bug within my system, since it is so wide spread).
I am not happy to debug your entire map.

So I want a demo map that gives a damn good hint as to where the bug is, as in, doesn't require me to read and understand all the code in your map in order to find where you have misused my system (which isn't even my fault, but I try to offer this service to help you). I simply don't have the time to understand bucket loads of code specific to your map. :)
 

SanKakU

Member
Reaction score
21
EDIT: OK, I've managed to make a demo map, I have located the offending trigger. The thing is, I don't understand the problem. The trigger comments say it uses Cohadar's PUI but I can't find any reference to the trigger using any systems.

Apparently this is just an isolated incident, good for you, bad for me.
Thanks in advance for looking into it for me. I find it funny that I do not understand why the trigger is causing this problem.

EDIT2: oh...i think i get it now...PERHAPS it has something to do with the fact that the units in black parade may be using the same order id as AIDS. didn't you say it was UNDEFEND? that's my best lead.

ORIGINAL MESSAGE:
but i tried and i failed. i don't know what's causing the bug. i thought i had the answer, but i don't. i tried to make a demo map that duplicated the bug and i couldn't duplicate it. now i'm looking at the fact that the system is indexing units i don't want it to index and i don't like that one bit.

take this for example:
JASS:
//Enum every non-filtered unit on the map during initialization and assign it a unique
//index. By using GroupEnumUnitsOfPlayer, even units with Locust can be detected.

now i don't want you insulting me and griping about not wanting to look at my entire map. i didn't ask you to, and i did try to make a demo map, i swear. i just can't. i don't know why it's not working.

for right now, i'm asking you to take a look at the fact that there are definitely units that are being indexed that i don't want indexed, which have nothing to do with the bug that i found, and add some customization so that those units won't be indexed!
 

Attachments

  • TestMapForAIDS.w3x
    344.1 KB · Views: 372

13lade619

is now a game developer :)
Reaction score
399
hey J4L, i've been getting some 'rogue' errors from AIDS lately in my map.

Error using AIDS: Trying to get the id (inlines) of null unit.

i really dont know what's causing these. they just randomly pop up from nowhere when some of my heroes cast some abilities.

is there any way i can debug specifically where this happens?

Here;s one of the abilities that reportedly had the error (the message was infinitely looping they say)

JASS:
scope BlackWhirlpool initializer init

private struct swirl
    group g
    unit caster
    boolean stop
    real range
    private method onDestroy takes nothing returns nothing
        call DestroyGroup(.g)
        set .g=null
        set .caster = null
    endmethod
endstruct

private struct damager
    unit caster
    boolean stop
    real damage
    group g
    real range
    private method onDestroy takes nothing returns nothing
        call DestroyGroup(.g)
        set .g=null
        set .caster = null
    endmethod
endstruct

private function damages takes nothing returns boolean
    local damager d = KT_GetData()
    local unit u = null
    
    call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\AvengerMissile\\AvengerMissile.mdl",d.caster,"weapon"))
    call GroupEnumUnitsInRange(d.g,GetUnitX(d.caster),GetUnitY(d.caster),d.range,Condition(function LiveUnitFilter))
    loop
        set u = FirstOfGroup(d.g)
        call GroupRemoveUnit(d.g,u)
        exitwhen u==null
        if IsUnitEnemy(u,GetOwningPlayer(d.caster)) then
            call Damage_Spell(d.caster,u,d.damage)
            call SetUnitState(d.caster,UNIT_STATE_LIFE,GetUnitState(d.caster,UNIT_STATE_LIFE)+(d.damage/4))
            call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\Devour\\DevourEffectArt.mdl",u,"chest"))
        endif
    endloop
    call GroupClear(d.g)
    
    set u = null
    set d.stop = OrderId2String(GetUnitCurrentOrder(d.caster)) != "starfall"
    return d.stop
endfunction

private function spin takes nothing returns boolean
    local swirl s = KT_GetData()
    local integer i = 0
    local real x
    local real y
    local real angle
    local real dist
    local unit u
    call GroupEnumUnitsInRange(s.g,GetUnitX(s.caster),GetUnitY(s.caster), s.range, Condition(function LiveUnitFilter))
    loop
        set u = FirstOfGroup(s.g)
        call GroupRemoveUnit(s.g,u)
        exitwhen u == null
        if IsUnitEnemy(u,GetOwningPlayer(s.caster))==true then
            set dist = UnitDistance(s.caster,u)
            set angle = UnitAngle(s.caster,u)            
            set x = GetUnitX(s.caster) + Cos(bj_DEGTORAD*(angle-1))*(dist-4)
            set y = GetUnitY(s.caster) + Sin(bj_DEGTORAD*(angle-1))*(dist-4)
            
            if PCCheck(x,y,u) then
                call SetUnitX(u,x)
                call SetUnitY(u,y)
            else
                set dist = UnitDistance(s.caster,u)
                set angle = UnitAngle(s.caster,u)
                set x = GetUnitX(s.caster) + Cos(bj_DEGTORAD*(angle))*(dist-4)
                set y = GetUnitY(s.caster) + Sin(bj_DEGTORAD*(angle))*(dist-4)
                if PCCheck(x,y,u) then
                    call SetUnitX(u,x)
                    call SetUnitY(u,y)
                endif
            endif
        endif
    endloop
    
    call GroupClear(s.g)
    set u = null
    set s.stop = OrderId2String(GetUnitCurrentOrder(s.caster)) != "starfall"
    return s.stop
endfunction

private function Trig_BlackWhirlpool_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A01B'
endfunction

private function Trig_BlackWhirlpool_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local integer level = GetUnitAbilityLevel(caster,'A01B')
    local HeroData h = HeroData[caster]
    local swirl s = swirl.create()
    local unit d = CreateUnit(GetOwningPlayer(caster),'e001',GetUnitX(caster),GetUnitY(caster),0)
    local effect e
    local damager r = damager.create()
        
    set s.range = 320+80*level
    set s.stop = false
    set s.caster = caster
    set s.g = CreateGroup()
    
    set r.range = s.range
    set r.stop = false
    set r.caster = caster
    set r.g = CreateGroup()
    set r.damage = (10+(20*level)+(0.2*h.GetTotal("sp")))/2
    
    call SetUnitScale(d,10,10,10)
    set e = AddSpecialEffectTarget("Abilities\\Spells\\Human\\Thunderclap\\ThunderclapTarget.mdl",d,"origin")
    call SetUnitVertexColor(d,100,100,100,235)
    
    call KT_Add(function spin, s, 0.03125)
    call KT_Add(function damages, r, .5)
    
    loop
        exitwhen s.stop
        call TriggerSleepAction(0)
    endloop
    
    call DestroyEffect(e)
    set e = null
    call KillUnit(d)
    set d = null
    call s.destroy()
    call r.destroy()
    set caster = null
endfunction

//===========================================================================
private function init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Trig_BlackWhirlpool_Conditions ) )
    call TriggerAddAction( t, function Trig_BlackWhirlpool_Actions )
endfunction

endscope

EDIT:
bug in action..

download link for the map is in my signature.
Here's the replay (skip to the very end) http://www.thehelper.net/forums/attachment.php?attachmentid=37215&d=1278093720

hopefully this will be fixed soon.. thanks for reading!
 

Laiev

Hey Listen!!
Reaction score
188
@13lade

i get some errors like that and others more (like... "using GetUnitId when should be using GetUnitIndex) but i don't use GetUnitId Oo'... a little strange for me too


just a hint :x you don't need to null struct members
 

Bribe

vJass errors are legion
Reaction score
67
Events in AIDS and how to respond to them?

AIDS_onCreate -> this is followup to unit-enters-map, from what I gather.
AIDS_onDestroy -> this is directly after the unit goes out of scope, so it is *not* fired when the unit dies? Or does it? Does it detect "RemoveUnit"?

Basically, I want to filter out unit death/reincarnation, and I've been told I'll have to trigger the reincarnation myself. To detect transport load/unload, I just use Transport.

When I develop the Reincarnate detection (it will be more efficient from AutoEvents), will it be a useful add-on that people would want? Or is there already another system dedicated to this very thing and I should save my time?

Also, AIDS leaks GetWorldBounds() in the initializer.
 

Jesus4Lyf

Good Idea™
Reaction score
397
About the backlog I've not yet replied to: I'll adress your issues when I find a moment.
About the reincarnation event: do it without undefend. I know it has been done before... something like unit's life goes below 0, but unit doesn't die, or something..., and then register an event for unit's health becomes greater than 0? I'm not sure - have a play with it. :)

To be honest, I'm not sure if unit attachment is even needed for it. :)

Edit: But to answer your question, AIDS_onDestroy occurs after the unit is removed from the game and all locked structs associated with it have been unlocked. :)
So generally speaking, this happens immediately after a unit has left the game (not when it dies).

You may have a difficult time defining "reincarnation". Does a hero revive count? Animate dead? Resurrection? Or just the reincarnation ability... :p
 

Bribe

vJass errors are legion
Reaction score
67
[ljass]UnitAlive[/ljass] returns false while a hero is reincarnating, while [ljass]IsUnitType(unit, UNIT_TYPE_DEAD)[/ljass] also returns false. So, when both of those conditions return false, you know the unit is reincarnating. You would use a periodic timer or undefend detector -- from my experience, UnitAlive is ridiculously fast and I have each of my 200 units on my map analyzing a UnitAlive event quite frequently (0.03125 seconds) with absolutely no visible performance hit. That's a very expedient function!

This would not detect rez or animate dead from my thinking.

1. With Resurrection and AnimateDead you still detect when the unit dies, so you can run just add the dead units to a periodic timer that fires an event if/when UnitAlive returns true.

2. I think hero revive has a native event, but not 100% sure on this one.
 

Jesus4Lyf

Good Idea™
Reaction score
397
1. With Resurrection and AnimateDead you still detect when the unit dies, so you can run just add the dead units to a periodic timer that fires an event if/when UnitAlive returns true.

2. I think hero revive has a native event, but not 100% sure on this one.
True (but I'd still avoid periodic checks) and true. Try an event for unit's life becomes 0, condition being unit is not dead and is not a hero, and see if that will give you the starts reincarnation event - then use a trigger to detect when a unit's life becomes greater than 0 to see when it has revived. These should give you the correct points, if it works. :)

This really has nothing to do with unit indexing or AIDS though, so I'd ask you to make a new thread about it if you wish to continue. ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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