# Bullet.crpl # Created on: 4/7/2019 6:33:37 PM # ------------------------------------------ once $DestinationX:0 $DestinationY:0 $BulletType:1 $AttackDmg:0 $BulletSpeed:0 $BulletSpread:1 <-BulletType 1 eq if #Bullet Type 1 Self "Main" "Custom4" SetImage Self "Shadow" "Custom4" SetImage 0.01 <-AttackDmg div ->RotSpeed else #Bullet Type 2 Self "Main" "Custom5" SetImage Self "Shadow" "Custom5" SetImage 0.05 <-AttackDmg div ->RotSpeed endif Self "Main" -0.1 SetImagePositionZ Self "Shadow" -0.001 SetImagePositionZ Self "Shadow" 0 0 0 180 SetImageColor Self "Shadow" -8 SetImagePositionY Self "Main" 8 <-AttackDmg mul <-BulletType 0.5 mul mul dup SetImageScale Self "Shadow" 4 <-AttackDmg mul <-BulletType 0.5 mul mul dup SetImageScale <-DestinationX <-DestinationY PixelToCell <-BulletSpeed QueueMove Self CONST_CREATEPZ 0 SetUnitAttribute Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute Self CONST_TAKEMAPSPACE 0 SetUnitAttribute endonce Self "Main" Dup2 GetImageRotation <-RotSpeed add SetImageRotation Self "Shadow" Self "Main" GetImageRotation SetImageRotation CurrentCoords 1 1 GetAllUnitsInRange 0 do ->Unit <-Unit GetUnitType ->Type <-Type "PULSECANNON" eq <-Type "MORTAR" eq or <-Type "BEAM" eq or <-Type "GUPPYAIR" eq or <-Type "STRAFER" eq or <-Type "STRAFERAIR" eq or <-Type "BOMBER" eq or <-Type "BOMBERAIR" eq or <-Type "SPRAYER" eq or <-Type "SNIPER" eq or if <-Unit CONST_HEALTH dup2 GetUnitAttribute <-AttackDmg sub SetUnitAttribute <-Unit CONST_HEALTH GetUnitAttribute 0 lte if <-Unit 2 Destroy endif @Detonate Self 2 Destroy Break endif loop GetQueuedMoveCount eq0 if @Detonate Self 0 Destroy endif :Detonate <-BulletType 2 eq <-BulletSpread 1 eq and if #Create Spider Bullets 50 0 do "CRPLCORE" CurrentCoords RANDINT(-2 3) add RANDINT(-2 3) add CreateUnit ->Bullet CurrentCoords 15 RandCoordsInRange CellToPixel ->PointerY ->PointerX <-Bullet "Bullet.crpl" AddScriptToUnit <-Bullet "Bullet.crpl" "DestinationX" <-PointerX SetScriptVar <-Bullet "Bullet.crpl" "DestinationY" <-PointerY SetScriptVar <-Bullet "Bullet.crpl" "BulletType" 1 SetScriptVar <-Bullet "Bullet.crpl" "AttackDmg" <-AttackDmg 0.75 mul SetScriptVar <-Bullet "Bullet.crpl" "BulletSpeed" 8 SetScriptVar <-Bullet "Bullet.crpl" "BulletSpread" <-BulletSpeed 2 mul SetScriptVar loop endif