HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Attached Variable question and Tables

07-23-2007, 04:07 AM#1
waaaks
ive been studying attached variables in CS_Cache, but still didnt get my problem solved, so ill ask it directly to the master

Collapse JASS:
local unit u = GetTriggerUnit()
call AttachObject( GetTriggerUnit(), "caster", gg_trg_AWD )
does this mean GetTriggerUnit() is attached to trigger AWD?
or trigger AWD is attached to GetTriggerUnit()?

Collapse JASS:
local unit e = GetAttachedUnit(GetTriggerUnit(), "caster")
does this mean that i can use GetTriggerUnit from the actions and get it anywhere?

why cant i use this?
Collapse JASS:
local unit u = GetTriggerUnit()
call AttachObject(u, "caster", gg_trg_AWD)

can anyone post a trigger that uses attached variables correctly?

i need an answer for this to make a spell that blocks damage dealt to the buffed unit

for Tables
can anyone post a trigger that a table is used, i need a short trigger that clarifies the uses of tables?
they said tables are better than attached variable, so i think i will need it...
07-25-2007, 01:09 PM#2
Vexorian
Quote:
call AttachObject( GetTriggerUnit(), "caster", gg_trg_AWD )
Attach a pointer to gg_trg_AWD for Triggering unit, label "caster" so it is "trigger AWD is attached to GetTriggerUnit()?" Although it is pretty lame to do this since gg_trg_AWD is a global...

...
I would say, don't bother learning attacheable vars. Their only use should now be attaching a single integer, which is a pointer to an struct...
08-28-2007, 12:09 PM#3
waaaks
Quote:
don't bother learning attacheable vars

so what do i use to pass variables to other functions?
08-28-2007, 07:56 PM#4
Vexorian
arguments?
09-01-2007, 04:40 AM#5
waaaks
are arguments already in cs_cache?
09-01-2007, 01:09 PM#6
Vexorian
they were in Jass since the beginning?
09-01-2007, 10:50 PM#7
waaaks
ahh...thanks