PRPL Shield

Started by Prof, November 13, 2016, 12:23:04 AM

Previous topic - Next topic

Prof

#45
I've moved on from that now. The problem I'm dealing with is the InitMissile command... I'm making a PRPL Missile tower that will launch missiles at all ships in range, but will scale how many missiles per ship to launch depending on the amount of ships in range.

Here's what I've got so far... I'm going PRPL crazy :D

# --MissileTower-- 11/15/2016 9:10:31 PM

$Health:40
$FireRate:75   #in frames E.G. 30 = 1 second, 60 = 2 etc.
$Range:30
$Critical:1 #y/n
$CriticalAmount:10 #of health
$CriticalMul:2
$IsMissionGoal:1
$LatheDamage:0.3

once
Self ->Self
Self SetUnitMaxHealth (<-Health)
Self SetUnitLatheTargets(1)
Self SetUnitMissionGoal(<-IsMissionGoal)
Self SetUnitLatheDamageAmt(<-LatheDamage)
SetTimer0(<-FireRate)
endonce



if(GetTimer0 eq0)
  CurrentCoords <-Range 0 GetAllShipsInRange ->Ships
  <-Ships GetListCount 0 do
      if(<-Ships GetListCount 2 lte)
      4 0 do
             I <-Ships[K] 1 InitMissile
  loop
  endif
  if(<-Ships GetListCount 2 gt <-Ships GetListCount 4 lte and)
    3 0 do
  I <-Ships[K] 1 InitMissile
loop
  endif
  if(<-Ships GetListCount 4 gt)
   2 0 do
  I <-Ships[K] 1 InitMissile
loop
  endif
  loop
  <-Critical 1 eq <-Self.UnitHealth <-CriticalAmount lte and if
    <-FireRate <-CriticalMul mul SetTimer0
  else
    SetTimer0 (<-FireRate)
endif

GoodMorning

If you're not dealing with shields anymore, break off to a new topic.

In case anyone reads this far is search of a general-purpose circular field script, I attach the latest (final) version. Not that if particles go after ships just inside shield range, then power drain will rise, and also that lag can ensure of there are very large numbers of particles inside the field.

The range image is a slightly modified shield umbrella from the Sleeper template, and changes colour (green-yellow-red) with power level. Set UmbrellaGraphicSlot to NONE if you don't want it to show.

Higher-health particles will drain power to move, but will be moved just as much.

Disclaimer: No guarantees that if a shield is swamped in particles and has a small battery size that it will be able to restart after a collapse. The battery may be drained entirely by the initial push to try to get some space to put the shield up in.
A narrative is a lightly-marked path to another reality.