- Joined
- Aug 1, 2007
- Messages
- 535
I was looking through JassCraft when I found this:
What does it do?
And if it does what I think it does how do you use it?
JASS:
function CollisionMissile_Create takes string MissileModelPath, real x, real y, real dirangle, real speed, real AngleSpeed, real MaxDist, real height, boolean UseNewCaster, real Collision, code OnImpact returns unit
local timer t
local gamecache H=CSCache()
local string k
local integer ki
local trigger R
local group g
local unit m
if (HaveStoredInteger(H,"CasterSystem","MOVEMENT_TIMER")) then
set g=GetTableGroup("CasterSystem","MOVEMENT_GROUP")
else
set t=CreateTimer()
set g=CreateGroup()
call SetTableObject("CasterSystem","MOVEMENT_TIMER",t)
call SetTableObject("CasterSystem","MOVEMENT_GROUP",g)
call TimerStart(t,CS_Cycle(),true,function CasterSystemMovementTimer)
endif
set ki=NewTableIndex()
set k=I2S(ki)
if UseNewCaster then
set m=AddCasterFacing(dirangle)
call StoreBoolean(H,k,"new",true)
else
set m=GetACaster()
call SetUnitFacing(m,dirangle)
endif
call StoreInteger(H,"MOVEMENT_TABLES",GetAttachmentTable(m),ki)
call StoreBoolean(H,k,"IsCollisionMissile",true)
call SetUnitPosition(m,x,y)
call StoreReal(H,k,"speed",speed)
call StoreReal(H,k,"aspeed",AngleSpeed)
call StoreReal(H,k,"F",dirangle)
call StoreReal(H,k,"maxd",MaxDist)
call SetUnitFlyHeight(m,height,0)
call GroupAddUnit(g,m)
set R=CreateTrigger()
call AttachObject(R,"m",m)
call StoreReal(H,k,"collision",Collision)
call SetTableObject(k,"T",R)
call StoreInteger(H,"MOVEMENT_TABLES",GetAttachmentTable(R),ki)
call SetTableObject(k,"fx", AddSpecialEffectTarget(MissileModelPath,m,"origin") )
call SetTableObject(k,"m",m)
call SetTableObject(k,"ac",TriggerAddAction(R,OnImpact))
set t=null
set g=null
set R=null
set udg_currentcaster=m
set m=null
set H=null
return udg_currentcaster
endfunction
And if it does what I think it does how do you use it?