- Joined
- Apr 24, 2012
- Messages
- 5,113
-
Projectile System
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Custom script: set udg_PS_Hash = InitHashtable()
-
-------- -------------------------------------------- --------
-
-------- Determines how many models can be attached --------
-
-------- -------------------------------------------- --------
-
Set PS_MaxModelsIndex = 5
-
-------- -------------------------------------------- --------
-
-------- Creating dummy cutter --------
-
-------- -------------------------------------------- --------
-
Set PS_Loc = (Center of (Playable map area))
-
Unit - Create 1 Peasant for Neutral Passive at PS_Loc facing Default building facing degrees
-
Set PS_Cutter = (Last created unit)
-
Custom script: call UnitAddAbility(udg_PS_Cutter,'Aloc')
-
Unit - Hide PS_Cutter
-
Unit - Make PS_Cutter Invulnerable
-
Custom script: call RemoveLocation(udg_PS_Loc)
-
Custom script: call ExecuteFunc("InitProjectileSystem")
-
Custom script: endfunction
-
-------- -------------------------------------------- --------
-
-------- This function destroys missile --------
-
-------- -------------------------------------------- --------
-
Custom script: function DestroyMissile takes unit u , integer key , effect model returns nothing
-
Custom script: call DestroyEffect(model)
-
Custom script: call FlushChildHashtable(udg_PS_Hash,key)
-
Custom script: call GroupRemoveUnitSimple(u,udg_PS_LoopGroup)
-
Custom script: call RemoveUnit(u)
-
Custom script: endfunction
-
-------- -------------------------------------------- --------
-
-------- This function applies coordinates then moving the unit --------
-
-------- -------------------------------------------- --------
-
Custom script: function MoveMissile takes unit u,real speed,real angle returns nothing
-
Custom script: local real x = GetUnitX(u) + speed * Cos(angle * bj_DEGTORAD)
-
Custom script: local real y = GetUnitY(u) + speed * Sin(angle * bj_DEGTORAD)
-
Custom script: call SetUnitPosition(u,x,y)
-
Custom script: endfunction
-
-------- -------------------------------------------- --------
-
-------- This function applies Z arc --------
-
-------- -------------------------------------------- --------
-
Custom script: function ApplyArcHeight takes unit u,real distance,real travelled,real speed,real heightmultiplier returns nothing
-
Custom script: local real arc = 4 *( heightmultiplier * distance) / distance * ((travelled + speed )/ distance) * (distance - (travelled + speed))
-
Custom script: local real arcanimation
-
Custom script: if travelled + speed/distance <= 0.5 then
-
Custom script: set arcanimation =180 * heightmultiplier - ((180 * heightmultiplier * travelled) + speed/distance) - 180 * heightmultiplier/2
-
Custom script: else
-
Custom script: set arcanimation =360 - (180 * heightmultiplier - ((180 * heightmultiplier * travelled) + speed/distance) - 180 * heightmultiplier/2)
-
Custom script: endif
-
Custom script: call SetUnitFlyHeight(u, arc, 0.00)
-
Custom script: call SetUnitAnimationByIndex( u, R2I( arcanimation))
-
Custom script: endfunction
-
-------- -------------------------------------------- --------
-
-------- This function applies ground arc --------
-
-------- -------------------------------------------- --------
-
Custom script: function ApplyGroundArc takes unit u,real distance,real travelled,real arcwidth,location loc,real speed,real angle,boolean arcleft returns nothing
-
Custom script: local real arc
-
Custom script: local real x
-
Custom script: local real y
-
Custom script: set x = GetLocationX(loc) + travelled + speed * Cos(angle*bj_DEGTORAD)
-
Custom script: set y = GetLocationY(loc) + travelled + speed * Sin(angle*bj_DEGTORAD)
-
Custom script: if arcleft == true then
-
Custom script: set angle = angle + 90
-
Custom script: else
-
Custom script: set angle = angle - 90
-
Custom script: endif
-
Custom script: set arc = 4 * (arcwidth * distance) / distance * (travelled + speed / distance) * (distance - travelled + speed )
-
Custom script: set x = x + arc * Cos(angle*bj_DEGTORAD)
-
Custom script: set y = y + arc * Sin(angle*bj_DEGTORAD)
-
Custom script: call SetUnitPosition(u,x,y)
-
Custom script: endfunction
-
-------- -------------------------------------------- --------
-
-------- This function is the effect of the impact --------
-
-------- -------------------------------------------- --------
-
Custom script: function ApplyMissileEffect takes nothing returns nothing
-
Set PS_ImpactGroup = (Units within PS_LoadRange of PS_Loc)
-
Unit Group - Pick every unit in PS_ImpactGroup and do (Actions)
-
Loop - Actions
-
Set PS_TempU = (Picked unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(PS_TempU is A structure) Equal to PS_LoadAllowStructures
-
(PS_TempU is A structure) Equal to False
-
(PS_TempU is Magic Immune) Equal to PS_LoadAllowImmunity
-
(PS_TempU is Magic Immune) Equal to False
-
(PS_TempU is A flying unit) Equal to PS_LoadAllowFlying
-
(PS_TempU is A flying unit) Equal to False
-
(PS_TempU belongs to an enemy of PS_Owner) Equal to True
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
PS_LoadAllowDestroyTreesImpact Equal to True
-
-
Then - Actions
-
Destructible - Pick every destructible within PS_LoadRange of PS_Loc and do (Actions)
-
Loop - Actions
-
Set PS_Dest = (Picked destructible)
-
Unit - Order PS_Cutter to Harvest PS_Dest
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Current order of PS_Cutter) Equal to (Order(harvest))
-
-
Then - Actions
-
Destructible - Kill PS_Dest
-
-
Else - Actions
-
-
Unit - Order PS_Cutter to Stop
-
-
-
-
Else - Actions
-
-
Unit - Cause PS_U to damage PS_TempU, dealing PS_LoadDamage damage of attack type Spells and damage type Normal
-
-
Else - Actions
-
-
-
-
Special Effect - Create a special effect at PS_Loc using PS_ImpactSFX
-
Special Effect - Destroy (Last created special effect)
-
Custom script: call DestroyGroup(udg_PS_ImpactGroup)
-
Custom script: call DestroyMissile(udg_PS_U,udg_PS_Key,udg_PS_TempModel)
-
Custom script: endfunction
-
-------- -------------------------------------------- --------
-
-------- This function is run periodically after picking the main group --------
-
-------- -------------------------------------------- --------
-
Custom script: function Missile takes nothing returns nothing
-
Set PS_U = (Picked unit)
-
Custom script: set udg_PS_Key = GetHandleId(udg_PS_U)
-
-------- -------------------------------------------- --------
-
-------- Load --------
-
-------- -------------------------------------------- --------
-
Set PS_TempSpeed = ((Load 1 of PS_Key from PS_Hash) x 0.03)
-
Set PS_TempAngle = (Load 2 of PS_Key from PS_Hash)
-
Set PS_TempDistance = (Load 3 of PS_Key from PS_Hash)
-
Set PS_TempTravelled = (Load 4 of PS_Key from PS_Hash)
-
Set PS_LoadImpactSFX = (Load 5 of PS_Key from PS_Hash)
-
Set PS_LoadAllowDestroyTreesImpact = (Load 6 of PS_Key from PS_Hash)
-
Set PS_LoadAllowFlying = (Load 7 of PS_Key from PS_Hash)
-
Set PS_LoadAllowImmunity = (Load 8 of PS_Key from PS_Hash)
-
Set PS_LoadAllowStructures = (Load 9 of PS_Key from PS_Hash)
-
Set PS_LoadDamage = (Load 10 of PS_Key from PS_Hash)
-
Set PS_LoadRange = (Load 11 of PS_Key from PS_Hash)
-
Set PS_LoadAllowGroundArc = (Load 12 of PS_Key from PS_Hash)
-
Set PS_LoadArcWidth = (Load 13 of PS_Key from PS_Hash)
-
Set PS_LoadAllowArc = (Load 14 of PS_Key from PS_Hash)
-
Set PS_LoadArcHeight = (Load 15 of PS_Key from PS_Hash)
-
Set PS_LoadAllowArcLeft = (Load 16 of PS_Key from PS_Hash)
-
Set PS_LoadX = (Load 17 of PS_Key from PS_Hash)
-
Set PS_LoadY = (Load 18 of PS_Key from PS_Hash)
-
Set PS_MaxModelsTemp = (Load 19 of PS_Key from PS_Hash)
-
Set PS_Owner = (Owner of PS_U)
-
Set PS_Loc = (Position of PS_U)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
PS_TempTravelled Less than PS_TempDistance
-
-
Then - Actions
-
Set PS_TempLoc = (Point(PS_LoadX, PS_LoadY))
-
Custom script: call MoveMissile(udg_PS_U,udg_PS_TempSpeed,udg_PS_TempAngle)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
PS_LoadAllowGroundArc Equal to True
-
-
Then - Actions
-
Custom script: call ApplyGroundArc(udg_PS_U,udg_PS_TempDistance,udg_PS_TempTravelled,udg_PS_LoadArcWidth,udg_PS_TempLoc,udg_PS_TempSpeed,udg_PS_TempAngle,udg_PS_LoadAllowArcLeft)
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
PS_LoadAllowArc Equal to True
-
-
Then - Actions
-
Custom script: call ApplyArcHeight(udg_PS_U,udg_PS_TempDistance,udg_PS_TempTravelled,udg_PS_TempSpeed,udg_PS_LoadArcHeight)
-
-
Else - Actions
-
Animation - Change PS_U flying height to 75.00 at 0.00
-
Custom script: call SetUnitAnimationByIndex(udg_PS_U, 360)
-
-
-
Hashtable - Save (PS_TempTravelled + PS_TempSpeed) as 4 of PS_Key in PS_Hash
-
Custom script: call RemoveLocation(udg_PS_TempLoc)
-
-
Else - Actions
-
For each (Integer I) from 1 to PS_MaxModelsTemp, do (Actions)
-
Loop - Actions
-
Set PS_TempModel = (Load (19 + I) of PS_Key in PS_Hash)
-
Special Effect - Destroy PS_TempModel
-
-
-
Custom script: call ApplyMissileEffect()
-
-
-
Custom script: call RemoveLocation(udg_PS_Loc)
-
Custom script: endfunction
-
-------- -------------------------------------------- --------
-
-------- This function is run periodically --------
-
-------- -------------------------------------------- --------
-
Custom script: function MissileLoop takes nothing returns nothing
-
Unit Group - Pick every unit in PS_LoopGroup and do (Actions)
-
Loop - Actions
-
Custom script: call ExecuteFunc("Missile")
-
-
-
Custom script: endfunction
-
-------- -------------------------------------------- --------
-
-------- This function will setup the missile --------
-
-------- -------------------------------------------- --------
-
Custom script: function MissileSetup takes nothing returns nothing
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
PS_MaxModels Greater than PS_MaxModelsIndex
-
-
Then - Actions
-
Set PS_MaxModels = PS_MaxModelsIndex
-
-
Else - Actions
-
-
Unit - Create 1 Dummy for PS_Owner at PS_Loc facing PS_Angle degrees
-
Set PS_Missile = (Last created unit)
-
Custom script: set udg_PS_TempKey = GetHandleId(udg_PS_Missile)
-
For each (Integer I) from 1 to PS_MaxModels, do (Actions)
-
Loop - Actions
-
Special Effect - Create a special effect attached to the origin of PS_Missile using PS_MissileModel[I]
-
Set PS_Model[I] = (Last created special effect)
-
-
-
Animation - Change PS_Missile's size to (PS_MissileScale%, 100.00%, 100.00%) of its original size
-
Custom script: set udg_PS_X = GetLocationX(udg_PS_Loc)
-
Custom script: set udg_PS_Y = GetLocationY(udg_PS_Loc)
-
-------- -------------------------------------------- --------
-
-------- Save --------
-
-------- -------------------------------------------- --------
-
Hashtable - Save PS_Speed as 1 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_Angle as 2 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_Distance as 3 of PS_TempKey in PS_Hash
-
Hashtable - Save 0.00 as 4 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_ImpactSFX as 5 of PS_Key in PS_Hash
-
Hashtable - Save PS_AllowDestroyTreeImpact as 6 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_AllowFlying as 7 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_AllowImmunity as 8 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_AllowStructures as 9 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_Damage as 10 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_Radius as 11 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_AllowGroundArc as 12 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_ArcWidth as 13 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_AllowArc as 14 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_ArcHeight as 15 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_AllowArcLeft as 16 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_X as 17 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_Y as 18 of PS_TempKey in PS_Hash
-
Hashtable - Save PS_MaxModels as 19 of PS_TempKey in PS_Hash
-
For each (Integer I) from 1 to PS_MaxModels, do (Actions)
-
Loop - Actions
-
Hashtable - Save Handle OfPS_Model[I] as (19 + I) of PS_TempKey in PS_Hash
-
-
-
Unit Group - Add PS_Missile to PS_LoopGroup
-
Custom script: endfunction
-
-------- -------------------------------------------- --------
-
-------- Initialize --------
-
-------- -------------------------------------------- --------
-
Custom script: function InitProjectileSystem takes nothing returns nothing
-
Custom script: local trigger t = GetTriggeringTrigger()
-
Custom script: call TriggerClearActions(t)
-
Custom script: call TriggerAddAction(t,function MissileLoop)
-
Custom script: call TriggerRegisterTimerEventPeriodic(t, 0.03 )
-
-
as of what the title says,animation roll of the dummy.mdx doesnt work :/
Any wrong formulas you found here.
Also,the ground arc(horizontal arck actually) doesnt work either.