Code: Select all
<ItemType UNID="&vtPiracy;"
name= "(piracy)"
level= "1"
virtual= "true"
>
<MiscellaneousDevice/>
<Events>
<OnGlobalTypesInit>
(enum (typFind "s") theShip
(block (theXML theEvents theOnDestroy)
(if (not (setq theEvents (xmlGetSubElement (setq theXML (typGetXML theShip)) 'events)))
(xmlAppendSubElement theXML (setq theEvents (xmlCreate 'Events)))
)
(if (not (setq theOnDestroy (xmlGetSubElement theEvents 'OnDestroy)))
(xmlAppendSubElement theEvents (setq theOnDestroy (xmlCreate 'OnDestroy)))
)
(xmlAppendText
theEvents
"
(block Nil
(enum (sysFindObject aOrderGiver "sTAF Z N:100; -auton; -zoanthrope;") theWitness
(shpOrderImmediate theWitness 'attack aOrderGiver)
)
)
"
)
(typCreate theShip theXML)
)
)
</OnGlobalTypesInit>
</Events>
</ItemType>
Code: Select all
<ItemType UNID="&vtPiracy;"
name= "(piracy)"
level= "1"
virtual= "true"
>
<MiscellaneousDevice/>
<StaticData>
<Events>
</Events>
<OnDestroy>
(block Nil
(enum (sysFindObject aOrderGiver "sTAF Z N:100; -auton; -zoanthrope;") theWitness
(shpOrderImmediate theWitness 'attack aOrderGiver)
)
)
</OnDestroy>
</StaticData>
<Events>
<OnGlobalTypesInit>
(enum (typFind "s") theShip
(block (theStaticData theXML theEvents theOnDestroy)
(setq theStaticData (xmlGetSubElement (typGetXML &vtPiracy;) 'StaticData))
(setq theXML (typGetXML theShip))
(if (not (xmlGetSubElement theXML 'Events))
(xmlAppendSubElement theXML (xmlGetSubElement theStaticData 'Events))
) ;If there is no 'Events, create it
(setq theEvents (xmlGetSubElement theXML 'Events))
(setq theOnDestroy (xmlGetSubElement theEvents 'OnDestroy))
(if theOnDestroy
(xmlDeleteSubElement theEvents (find (xmlGetSubElementList theEvents) theOnDestroy))
)
(xmlAppendSubElement theEvents (xmlGetSubElement theStaticData 'OnDestroy))
(typCreate theShip theXML)
)
)
</OnGlobalTypesInit>
</Events>
</ItemType>