HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Events bug

11-19-2006, 12:20 PM#1
BertTheJasser
I just figgured out a small bug.

I have a passive (hero-) skill. I have preplaced hero (who has learned that skill allready). I have another instance of that hero (dynamically created later, skill is not learned).

For the spell I use
Collapse JASS:
function OnAbilityGet takes integer abilid, string funcname returns nothing
which should fire at map init, for the one hero and when a hero learns that skill.

So far so good. The preplaced hero has got the bonuses he was suppsed to have, but when I learn the skill with the dynamically created guy, it simple does not work. I guess the problem is based on the fact that your system considers the skill as a unit <edit>ability</edit> (as there is a preplaced guy with that skill) and so the "probablytemp_trigger" and "probablytemp_triggera" are destroyed/flushed and so it does not fire.

Plx fix that. Thx very much.
11-19-2006, 12:23 PM#2
Vexorian
Quote:
I guess the problem is based on the fact that your system considers the skill as a unit

Don't understand this at all.

But you can always use that function to force the ability get event to trigger.
11-19-2006, 02:41 PM#3
BertTheJasser
unit = unitability

Quote:
Originally Posted by Vexorian
But you can always use that function to force the ability get event to trigger.

Do not get the meaning of that sentence.

EDIT:
Btw.
Collapse JASS:
function UnitAddAbility_ConsiderEvent takes unit whichUnit, integer abilid, integer level returns nothing
 local string k=I2S(abilid)
    call UnitAddAbility(whichUnit,abilid)
    call SetUnitAbilityLevel(whichUnit,abilid,level)
    if (HaveStoredString(cs_cache,"events_onlearn",k)) then
        call StoreInteger(cs_cache,"events_variables","units",CS_H2I(whichUnit))
        call StoreInteger(cs_cache,"events_variables","current",abilid)
        call ExecuteFunc(GetStoredString(cs_cache,"events_onlearn",k))
    endif
set cs_cache=null//WHAT THE HELL...
endfunction

EDIT: It's likly that I found the bug just right now.
Collapse JASS:
function InitPassiveEvent takes nothing returns nothing
 local trigger t
    call TimerStart(NewTimer(),0,false,function Event_OnPassive_InitEnum)
    call StoreInteger(cs_cache,"eventhandlers","passives",1)
    if (not HaveStoredInteger(cs_cache,"eventhandlers","learn")) then
        call InitLearnEvent(cs_cache,2)
    else
        set t=GetTableTrigger("Events_ProbablyTemp","learntrig")
        call TriggerRemoveAction(t,GetTableTriggerAction("Events_ProbablyTemp","learntriga") )
        call FlushStoredMission(cs_cache,"Events_ProbablyTemp")
        set t=CreateTrigger() //that's the problem, a trigger with no events
        call TriggerAddAction(t, function Event_OnLearn2)
        call StoreInteger(cs_cache,"eventhandlers","learn",2)
       set t=null
    endif 
endfunction


Updated:
Hidden information:

Collapse JASS:
function InitPassiveEvent takes nothing returns nothing
 local trigger t
 local triggeraction a
    call TimerStart(NewTimer(),0,false,function Event_OnPassive_InitEnum)
    call StoreInteger(cs_cache,"eventhandlers","passives",1)

    if (not HaveStoredInteger(cs_cache,"eventhandlers","learn")) then
        call InitLearnEvent(cs_cache,2)
    else
        set t=GetTableTrigger("Events_ProbablyTemp","learntrig")
        set a=GetTableTriggerAction("Events_ProbablyTemp","learntriga")
        call TriggerRemoveAction(t,a )
        call FlushStoredMission(cs_cache,"Events_ProbablyTemp")
        call TriggerAddAction(t, function Event_OnLearn2)
        call StoreInteger(cs_cache,"eventhandlers","learn",2)
       set t=null
       set a=null
    endif 
endfunction
11-19-2006, 10:18 PM#4
Vexorian
I could swear I fixed that bug a long time ago. I guess it is time for a cs update, the //what the hell line is a terrible blunder, probably happened after a text replace
11-20-2006, 12:49 PM#5
BertTheJasser
Is that not worth at least a mention or 1 freakin' +rep point?