- Joined
- Jul 18, 2009
- Messages
- 200
I have just learned how to use Structs( Yay? ).
But i dont know their purpose.
Can't someone tell me their purpose, and show me an simple code,
showing how to create( And use them( Good))?
I can get this code for you, to show my level of coding structs

Thanks
But i dont know their purpose.
Can't someone tell me their purpose, and show me an simple code,
showing how to create( And use them( Good))?
I can get this code for you, to show my level of coding structs

JASS:
library Test initializer Init
struct Data
unit Caster
unit Target
real Damage
// Could( and Can ) make more variables, but just a test. :D
static method DealDamage takes nothing returns nothing
local Data d = Data.allocate()
set d.Caster = GetTriggerUnit()
set d.Target = GetSpellTargetUnit()
set d.Damage = (45 * GetUnitAbilityLevel(d.Caster,'A000'))
call AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", d.Target , "origin")
call UnitDamageTarget( d.Caster, d.Target, d.Damage, true, true, ATTACK_TYPE_NORMAL,DAMAGE_TYPE_ACID,null)
endmethod
static method Conds takes nothing returns boolean
if GetSpellAbilityId() == 'A000' then
call DealDamage()
endif
return false
endmethod
endstruct
private function Init takes nothing returns nothing
local trigger t = CreateTrigger ( )
call TriggerRegisterAnyUnitEventBJ( t , EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( t , Condition( function Data.Conds))
endfunction
endlibrary
Thanks