Functions Documentation |
|
Name |
objAddOverlay |
Syntax |
(objAddOverlay obj overlayType [pos rotation] [lifetime]) -> overlayID |
Argument List |
obj: spaceObject to apply overlay to
overlayType: UNID of <OverlayType> to apply
pos: optional offset for graphical overlays
rotation: optional rotation for graphical overlays
[lifetime]: duration (in ticks?) after which to automatically delete overlay |
Returns |
overlayID: a pointer to the live overlay |
Category |
overlay, spaceobject
|
Description |
Creates a new overlay on the target ship. There are two variants of this function. One that sets a position and rotational offset from the center of the ship and one that does not. For both you can provide an optional lifetime. |
Example |
From MiscItems.xml
<OnRefuel>
; Find or create an overlay that will generate radioactive waste
(if (eq gSource gPlayerShip)
(block (theID)
(enum (objGetOverlays gSource) theOverlay
(if (eq (objGetOverlayType gSource theOverlay)
&ovUraniumWasteCheck; )
(setq theID theOverlay)
)
)
(if theID
(objIncOverlayData gSource theID "wasteCount"
(itmGetCount gItem)
)
(block Nil
(setq theID (objAddOverlay gSource &ovUraniumWasteCheck;))
(objSetOverlayData gSource theID "wasteCount"
(itmGetCount gItem)
)
(objSetOverlayData gSource theID "counter" 0)
)
)
)
)
</OnRefuel>
|
Comment |
Overlays can be used to modify incoming damage, display graphical effects, or execute code at regular intervals on a specific spaceobject. They have an OnUpdate event that is run every 15 ticks, not the customary 30 |