Warcraft III resources & community, 2003–2006 · archived

Problem with gamecaches

11 posts
#1

Problem with gamecaches

Here is the problem:I maded a trigger that activates a trigger with timer event.I noticed that i can't use the local unit in the main function so i tryed the gamecache.I tryed Darkys way for init gamecache:
function GetBoomerangAxesGamecache takes nothing returns gamecache
    return gg_trg_Boomerang_Axes
endfunction

but it seems it doesn't work.I made a test trigger:
function GetTry2GameCache takes nothing returns gamecache
    return gg_trg_Try2
    return null
endfunction
function Unit takes nothing returns unit
    return RestoreUnitLocFacingAngleBJ("Unit","Unit",GetTry2GameCache(),Player(0),GetCameraTargetPositionLoc(),0.00)
endfunction
function T takes nothing returns nothing
 local unit u=Unit()
 local trigger t=GetTriggeringTrigger()
    call AddSpecialEffectLocBJ( PolarProjectionBJ(GetUnitLoc(u),4*I2R(ModuloInteger(GetTriggerEvalCount(t),100)),2*I2R(GetTriggerEvalCount(t))), "Abilities\\Spells\\Human\\Polymorph\\PolyMorphDoneGround.mdl" )
endfunction
function Trig_Try2_Actions takes nothing returns nothing
 local gamecache g=GetTry2GameCache()
 local trigger t=CreateTrigger()
 local unit u
    set u=CreateUnitAtLoc(Player(0),'hfoo',GetCameraTargetPositionLoc(),0.00)  
    call StoreUnitBJ(u,"Unit","Unit",g)    
    call KillUnit(u)
    call TriggerRegisterTimerEventPeriodic(t,0.05)  
    call TriggerAddAction(t,function T)
endfunction

It seems it does't restore the unit or it neither use it the function.Where i'm wrong?Did i understood Darkys trigger wrong?Can someone solve my problem?
#2
Vicky... isn't this a question for the JASS section? Perhaps you should try there as well. Some experts in JASS do not look here. I cannot help because... Heh, YOU taught me JASS. :D
#3
yes it is for experts to JASS but this scritp is gonna fly over my trigger editor and PUFF here is my second spell!Get it?And now i just want to find the reason!But anyway i'll submit the topic in JASS too.
But maybe The_Raven will move it to JASS forums i hope! :D
#4
Ask and you shall recieve.

~The_Raven
#5
Perhaps I shouldn't post, since I don't know anything about "Darky's way to initiate gamecaches..."

But why are you trying to convert a trigger (Try2) to a gamecache? To me it is no surprise that it doesn't work.
#6
Actually, converting a trigger to gamecache and vice versa, works.

I created some spells with that kind of conversion (which I can say, outstanding :shock: ) and it can't get any better than that.

It should be a problem with your trigger. Check it (I have a hard time reading others' code, sry :P).

EDIT: I looked at your code anyhow, and you use the wrong way to store a unit.
#7
Tell me the way then!I won't try any of vexorians GetHandleHandle or SetHandleHandle functions!But i bet he done those with gamecaches.And he hides them in his Caster System!What a fox.is this the code?:
function Unit takes handle h returns unit
return h
endfunction
#8
Did you... CREATE the game cache? If not... it might be a problem.
#9
Daelin there is no need to make the gamecache.It is already maded(the trigger)
#10
OK honey.

First, convert the unit into an integer (consider this integer is the pointer to that unit).
function H2I takes handle h returns integer
return h
endfunction


Next, in your Unit() function, restore that unit variable using a I2U function. (same as above, change handle h to unit u)

There, the unit variable gets restored.
BTW, write down your inittrig function if you still have that problem.
#11
I found out that the problem was in my trigger and i didn't created the gamecache!In otherwords i forgot to set gg_trg_Try2 to an gamecache.Thx anyway arscine!For telling me the easyer way for storing the unit!