The mod segment is part of my mines mod. It's a ship (that functions as the mine) and a virtual item with an OnFireWeapon event that triggers the self destruct on the ship which otherwise would activate after a certain amount of time.
However, if three or more mines are laid, and then an enemy ship spawns, then when the mines start going off, the game crashes. Debug.log gives the following:
Code: Select all
program state: updating events
TimedCustomEvent
m_pObj: 7944680 [invalid]
event: SelfDestruct
game state: in game
Please contact [email protected] with a copy of Debug.log. We are sorry for the inconvenience.
Code: Select all
<!--Patriot Mine-->
<ShipClass UNID="&scPlasmaMine;"
manufacturer= "NAMI"
class= "Patriot Mine;"
type= ""
score= "1"
rotationCount= "1"
mass= "600"
cargoSpace= "0"
thrust= "0"
maneuver= "2"
maxSpeed= "5"
leavesWreck= "0"
>
<Armor>
<ArmorSection start="0" span="360" armorID="&itPlasteelPlate;" areaSet="0,2,3,7" />
</Armor>
<Devices>
<Device deviceID="&vtPlasmaBlast;"
SecondaryWeapon="true" Omnidirectional="true"/>
</Devices>
<Image imageID="&rsMissiles6;" imageX="0" imageY="0" imageWidth="24" imageHeight="24" rotationCount="1"/>
<AISettings
fireRateAdj= "10"
fireAccuracy= "50"
perception= "2"
/>
<Events>
<OnCreate>
;; we register a delayed timer (45 sec - 90 sec) to activate the self destruct
(sysAddObjTimerEvent (random 1350 2250) gSource "SelfDestruct")
</OnCreate>
<SelfDestruct>
(objDestroy gSource gSource)
</SelfDestruct>
</Events>
</ShipClass>
<!-- Plasma Blast -->
<ItemType UNID="&vtPlasmaBlast;"
name= "plasma blast"
virtual= "true"
>
<Image imageID="&rsItems1;" imageX="96" imageY="0" imageWidth="96" imageHeight="96"/>
<Weapon
type= "particles"
count= "1d4+4"
damage= "plasma:3d20+12; WMD2"
fireRate= "15"
missileSpeed= "50-65"
lifetime= "20-28"
powerUse= "300"
particleCount= "5d6"
particleEmitTime="5-12"
particleSpreadWidth="5"
particleSpreadAngle="3"
sound= "&snMissileLauncher;"
>
<Effect>
<Shape
directional= "true"
scaleLength= "4"
scaleWidth= "3"
scaleLengthInc= "3"
color= "0xc0, 0x30, 0x04"
opacity= "64"
>
<Point x="0" y="0"/>
<Point x="-5" y="29"/>
<Point x="-10" y="44"/>
<Point x="-20" y="50"/>
<Point x="-30" y="47"/>
<Point x="-40" y="44"/>
<Point x="-100" y="0"/>
<Point x="-40" y="-44"/>
<Point x="-30" y="-47"/>
<Point x="-20" y="-50"/>
<Point x="-10" y="-44"/>
<Point x="-5" y="-29"/>
</Shape>
</Effect>
</Weapon>
<Events>
<OnFireWeapon>
(block nil
;; the 'SelfDestruct' event MUST be on the ship that mount's this weapon
;; and the event should hold the self-destruction code
(sysAddObjTimerEvent 12 gSource "SelfDestruct")
;; we must return Nil for the weapon to fire
Nil
)
</OnFireWeapon>
</Events>
</ItemType>
Still has the commenting by Prophet (who made the original version of this for the Hydra mine, and also coded the Plasma Blast)
Personally, I think it's a problem with the interface between the weapon and the ship....possibly a clash with the timer. But I'm not sure.