In addition, does anyone know what powerToActivate is, exactly? It would be immensely helpful if I had a formula that could convert that value to an integer to be used by our makeshift timer.
Code: Select all
<ItemType UNID="&itIocrymJumpdrive;"
name= "Iocrym jumpdrive"
attributes= "alien, iocrym, majorItem"
level= "8"
frequency= "rare"
unknownType= "&itUnknownAlienDevice;"
value= "25000"
mass= "7500"
description= "This faster-than-light jumpdrive is purpose built for combat, allowing the Iocrym's fearsome Sentinel ships to rapidly close the distance between themselves and their targets."
>
<Image imageID="&rsItems1;" imageX="0" imageY="192" imageWidth="96" imageHeight="96"/>
<MiscellaneousDevice
powerUse= "500"
capacitorPowerUse= "3000"
powerToActivate= "1000000"
/>
<Invoke key="J" installedOnly="true">
; Jump to a position 20 ls away from 150 ls in the direction of the target
; Use objGetTarget to determine the target
; Use objIsShip to determine whether the target is a ship (for the AI)
; Use objGetDistance to determine whether the target is in range (both for the AI and for here.)
; Use sysVectorAngle to get angle from self to target
; Use sysVectorRandom to get a random vector from newpos
<!--
If target is a ship
newPos is sysVectorPolarOffset gSource (angle from ship to target) (min 150, distance from ship to target)
alter newPos by 20ls using sysVectorRandom
-->
(block Nil
(switch
; If we have a target, jump.
(objGetTarget gSource)
(block (newPos)
(setq newPos (sysVectorPolarOffset gSource (sysVectorAngle (objGetPos (objGetTarget gSource)) (objGetPos gSource)) (min 150 (objGetDistance (objGetTarget gSource) gSource))))
(objJumpTo gSource (sysVectorPolarOffset newPos (random 0 360) (random 10 20)))
)
; If we have no target, do not jump, but provide a message as to why.
(block Nil
(objSendMessage gSource Nil "No target selected.")
)
)
; Item identified
(itmSetKnown gItem)
)
</Invoke>
<Events>
;Controls how this device will affect AI ships
<OnAIUpdate>
(block Nil
(switch
; If we have a target, the target is a ship, and the distance to the target exceeds 40, jump.
(objGetTarget gSource)
(if (and (gr (objGetDistance (objGetTarget gSource) gSource) 40) (objIsShip (objGetTarget gSource)))
(block (newPos)
(setq newPos (sysVectorPolarOffset gSource (sysVectorAngle (objGetPos (objGetTarget gSource)) (objGetPos gSource)) (min 150 (objGetDistance (objGetTarget gSource) gSource))))
(objJumpTo gSource (sysVectorPolarOffset newPos (random 0 360) (random 10 20)))
)
)
; If we have no target, do not jump, but provide a message as to why.
(block Nil
)
)
)
</OnAIUpdate>
</Events>
</ItemType>