Code: Select all
<?xml version="1.0" ?>
<!DOCTYPE TranscendenceExtension
[
<!ENTITY unid912Passthrough "0xd912fffc">
<!ENTITY it912Passthrough "0xd912fffd">
]>
; Made for Transcendence v1.6.2 or later.
<TranscendenceExtension UNID="&unid912Passthrough;"
apiVersion="28"
name="One-Hit Per Target Passthrough Tutorial"
credits="PM"
>
; Since we are using resources from the standard game, we need to include this library!
; Including libraries is the first thing we need to do before anything else in this file.
<Library unid="&unidHumanSpaceLibrary;"/>
; Here are global function(s) we will use.
<Globals>
(block Nil
; Helps prevent passthrough missiles from re-hitting target and doing too much damage.
; This function is called within three separate events.
(setq pass912OnDamage (lambda Nil
(if (eq (objGetObjRefData aCause "d912_LastTargetHit") gSource)
; YES: Hit the previous target already, so return zero damage.
; Unfortunately, a hit that does no damage still aggravates whoever was hit.
0
; NO: New target. Standard damage procedure.
(block Nil
; Remember who we hit.
(objSetObjRefData aCause "d912_LastTargetHit" gSource)
; Return Nil to proceed with usual damage.
Nil
)
)
))
)
</Globals>
; This weapon was a copy of the particle beam weapon.
; Now heavily modified for our purposes.
; The weapon will be given for free at the start of a game.
; Value will be zero so that the player cannot sell for quick cash.
; We do not want this weapon to appear anywhere else.
; Frequency is notrandom, and attribute includes CannotOrder.
<ItemType UNID="&it912Passthrough;"
name= "particle beam penetrator"
attributes= "cannotOrder, energyWeapon, majorItem"
level= "3"
frequency= "notrandom"
value= "0"
mass= "1500"
description= "Beams fired by this particle weapon can passthrough and hit multiple targets. Each target takes damage only once, usually."
>
<Image imageID="&rsItemsEI2;" imageX="288" imageY="0" imageWidth="96" imageHeight="96"/>
<Weapon
type= "beam"
damage= "particle:1d8+1"
fireRate= "16"
lifetime= "40"
powerUse= "50"
passthrough= "100"
effect= "&efParticleBeamDefault;"
sound= "&snLaserCannon;"
>
</Weapon>
<Events>
; Called when beam hits a planet, wreck, or other similar object.
<OnDamageAbandoned>
(pass912OnDamage)
</OnDamageAbandoned>
; Called when beam hits armor.
<OnDamageArmor>
(pass912OnDamage)
</OnDamageArmor>
; Called when beam hits shields.
<OnDamageShields>
(pass912OnDamage)
</OnDamageShields>
; Called when we start a new game, after ship select.
<OnGlobalUniverseCreated>
(block (newItem)
; Create our gift.
(setq newItem (itmCreate &it912Passthrough; 1))
; Add the new weapon to ship's cargo hold.
(objAddItem gPlayerShip newItem)
; Install the weapon.
(shpInstallDevice gPlayerShip newItem)
)
</OnGlobalUniverseCreated>
</Events>
</ItemType>
</TranscendenceExtension>