# --Rocket-- 06/07/2016 21:35:37 $TrailLength:30 $InitialAngle:3.14159 $MissileSpeed:3.0 $IsEnemy:1 $Target:-1 once <-IsEnemy ->Self.UnitIsEnemy CurrentPixelCoords <-InitialAngle <-MissileSpeed 1 <-IsEnemy CreateParticle ->Head <-Head 8 SetParticleHealth <-Target -1 eq if 9999 ->Range @findTarget endif 100 ->Range <-Head <-MissileSpeed SetParticleMaxSpeed <-Head 900 SetParticleMaxAge <-Head 1 SetParticleDestroyAtEdge CreateList ->TrailParticles CreateList ->TrailX CreateList ->TrailY Self "main" "Custom5" SetImage Self "main" <-InitialAngle SetImageRotation Self "main" -0.05 SetImagePositionZ Self "flame" "Custom6" SetImage Self "flame" <-InitialAngle SetImageRotation Self "flame" 16 0 -0.04 SetImagePosition Self "main" "Ships" SetImageLayer Self "main" 1 SetImageOrder Self "flame" "Ships" SetImageLayer Self "flame" 1 SetImageOrder endonce <-Target -1 eq if @findTarget else <-mode "ship" eq if <-Target.ShipIsDestroyed if -1 ->Target @findTarget else <-Target.ShipPixelCoordX ->tx <-Target.ShipPixelCoordY ->ty endif else <-Target.UnitIsDestroyed if -1 ->Target @findTarget else <-Target.UnitPixelCoordX ->tx <-Target.UnitPixelCoordY ->ty endif endif endif <-Head ParticleExists not if Self 1 DestroyUnit endif <-Head GetParticlePosition ->Y ->X Self CONST_PIXELCOORDX <-X SetAttribute Self CONST_PIXELCOORDY <-Y SetAttribute <-tx <-ty <-X <-Y Distance 6 lt if <-Target -1 neq if Self 1 DestroyUnit endif endif <-first if <-lastY <-Y sub <-lastX <-X sub atan2 Pi add ->heading Self "main" <-heading SetImageRotation Self "flame" <-heading SetImageRotation Self "flame" <-heading cos -16.0 mul <-heading sin -16.0 mul -0.04 SetImagePosition <-arbitraryVariable 0.02 add ->arbitraryVariable Self "flame" <-MissileSpeed <-arbitraryVariable sin 2.0 div 1.0 add SetImageScale <-ty <-Y sub <-tx <-X sub atan2 ->targetheading <-X <-Y <-LastY <-LastX Distance 2 mul <-MissileSpeed gt if <-targetheading <-heading shortestangle ->shortest <-shortest abs 0.03 lte if <-targetheading ->heading else <-shortest 0 gt if <-heading 0.03 sub ->heading else <-heading 0.03 add ->heading endif endif <-lastX <-lastY <-heading pi sub <-MissileSpeed 0 <-IsEnemy CreateParticle ->Trail <-Trail <-MissileSpeed SetParticleMaxSpeed <-Trail 90 SetParticleMaxAge <-Trail 1 SetParticleDestroyAtEdge <-TrailParticles <-Trail AppendToList <-TrailX <-lastX AppendToList <-TrailY <-lastY AppendToList else <-targetheading ->heading endif CurrentCoords GetLand if <-heading pi sub ->heading endif <-Head <-heading cos <-MissileSpeed mul <-heading sin <-MissileSpeed mul SetParticleMotion # <-head <-heading <-MissileSpeed SetParticleMotion # TraceStack # <-head <-MissileSpeed <-heading SetParticleImmediateForce else 1 ->first endif <-TrailParticles GetListCount <-TrailLength gt if <-TrailParticles 0 RemoveListElement <-TrailX 0 RemoveListElement <-TrailY 0 RemoveListElement endif <-TrailParticles GetListCount 0 do <-TrailParticles[i] <-TrailX[i] <-TrailY[i] SetParticlePosition loop CurrentPixelCoords ->lastY ->lastX :awake 0 OperateWhilePaused Self 0 SetUnitTakeMapSpace once Self ->Self endonce :destroyed Pi 12 div ->15deg CurrentPixelCoords ->y ->x 24 0 do <-15deg i mul ->angle <-angle cos 6 mul <-x add <-angle sin 6 mul <-y add <-angle <-MissileSpeed 2.0 div 2 <-IsEnemy CreateParticle ->NewParticle <-NewParticle <-MissileSpeed 2.0 div SetParticleMaxSpeed <-NewParticle 1 SetParticleDestroyAtEdge <-NewParticle 30 SetParticleMaxAge loop :findTarget CurrentCoords <-Range 0 GetAllShipsInRange ->Ships 0 ->largest <-Ships GetListCount 0 do <-Ships[I] GetShipIsEnemy <-IsEnemy neq if <-Ships[I] GetShipHullSize <-largest gt if <-Ships[I] GetShipHullSize ->largest <-Ships[I] ->target endif endif loop <-target -1 neq if "ship" ->mode return endif 0 ->priority <-Range 4 mul ->nearest CurrentCoords <-Range 0 GetAllUnitsInRange ->Units <-Units GetListCount 0 do <-Units[I] ->unit <-unit GetUnitIsEnemy <-IsEnemy neq if <-unit GetUnitType ->type <-type "Doppel" eq if 4 @IsTargetValid endif <-type "Doppel(Clone)" eq if 4 @IsTargetValid endif <-type "PhalanxGun" eq if 4 @IsTargetValid endif <-type "PhalanxGun(Clone)" eq if 4 @IsTargetValid endif <-type "Emitter" eq if 2 @IsTargetValid endif <-type "Emitter(Clone)" eq if 2 @IsTargetValid endif # <-type "EnergyMine" eq if # 3 @IsTargetValid # endif # <-type "EnergyMine(Clone)" eq if # 3 @IsTargetValid # endif endif loop <-target -1 neq if "unit" ->mode endif :IsTargetValid ->priorityReq <-priority <-priorityReq lt if <-priorityReq ->priority <-unit.UnitPixelCoordX <-unit.UnitPixelCoordY CurrentPixelCoords Distance ->nearest <-unit ->target else <-priorityReq <-priority eq if <-unit.UnitPixelCoordX <-unit.UnitPixelCoordY CurrentPixelCoords Distance ->dist <-dist <-nearest lt if <-priorityReq ->priority <-dist ->nearest <-unit ->target endif endif endif