• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Problem with gamecaches

Status
Not open for further replies.
Level 6
Joined
Sep 9, 2004
Messages
152
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:
JASS:
function GetBoomerangAxesGamecache takes nothing returns gamecache
    return gg_trg_Boomerang_Axes
endfunction
but it seems it doesn't work.I made a test trigger:
JASS:
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?
 
Level 6
Joined
Sep 9, 2004
Messages
152
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
 
Level 6
Joined
Jun 16, 2004
Messages
237
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.
 
Level 4
Joined
Aug 4, 2004
Messages
60
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.
 
Level 6
Joined
Sep 9, 2004
Messages
152
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?:
JASS:
function Unit takes handle h returns unit
return h
endfunction
 
Level 4
Joined
Aug 4, 2004
Messages
60
OK honey.

First, convert the unit into an integer (consider this integer is the pointer to that unit).
JASS:
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.
 
Status
Not open for further replies.
Top