- Joined
- Jun 1, 2007
- Messages
- 98
Well, I'm trying to create a simply projectile system to use in an RPG. It creates the unit but the effect that it's supposed to make does not show up. Here is my struct and the trigger:
Trigger:
Any suggestions? Right now it only creates the unit and displays the message. I've tried with two other models and they don't work either.
JASS:
globals
//timer projectileTimer = CreateTimer()
endglobals
struct projectile
real speed = 0.0
real dir = 0.0
effect ef
unit dummy
static method create takes real x, real y, real speed, real dir, string model returns projectile
local player ply = GetLocalPlayer()
local projectile p = projectile.allocate()
set p.dummy = CreateUnit( ply, 'hpea', x, y, dir ) //Temporary dummy (so that i can see it is created)
set p.speed = speed
set p.dir = dir
set p.ef = AddSpecialEffectTarget( model, p.dummy, "origin" )
call DisplayTextToPlayer( ply, 0.0, 0.0, "PROJECTILE CREATED AT POSITION " + R2S( x ) + ", " + R2S( y ) + "!" )
set ply = null
return p
endmethod
method onDestroy takes nothing returns nothing
call DestroyEffect( .ef )
call RemoveUnit( .dummy )
set .dummy = null
set .ef = null
endmethod
endstruct
JASS:
function Trig_CreateExample_Actions takes nothing returns nothing
local projectile p = projectile.create( 200.0, 200.0, 0.0, 270, "Abilities/Spells/Other/GeneralAuraTarget/GeneralAuraTarget.mdl" )
endfunction
//===========================================================================
function InitTrig_CreateExample takes nothing returns nothing
set gg_trg_CreateExample = CreateTrigger( )
call TriggerAddAction( gg_trg_CreateExample, function Trig_CreateExample_Actions )
endfunction
Any suggestions? Right now it only creates the unit and displays the message. I've tried with two other models and they don't work either.