SCRIPTING FUNCTIONS

Sort alphabetically | Sort by category

All | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | R | S | T | U | V | Z


Debris

Create a debris explosion.

float delay = 0.0 ;
int debrisId = 0 ; [->Debris.wds]
int number = 15 ; [number of debris elements]
float shotTime = 2.5 ; [random time offset of each element]
float3 position = 0.0 0.0 0.0 ;
float3 norm = 0.0 0.0 0.0 ; [leave 0.0 0.0 0.0 for spherical scatter]
arc = 1.57 ; [arc of scatter, if norm NOT spherical]
float velocityMin = 3.0 ;
float velocityMax = 5.0 ;
float size = 1.0 ;
float lifetimeMin = 2.0 ;
float lifetimeMax = 5.0 ;
int fadeSort = 0 ; [0=noFade; 1=fadeToBlack; 2=rotateOverTime; 3=RotateAndFade]
debris delay debrisId number shotTime position norm arc velocityMin velocityMax size lifetimeMin lifetimeMax fadeSort ;


Delete (ship)

Disables and deletes an object.
Use for ships ONLY! For other objects use SetEnabled!

float delay = 0.5 ;
ship GetByKeyName shipKeyName Delete delay ;
ship GetParent Delete delay ;


derelictAdd

Create a derelict on the specified position with the specified rotation.

Alternatively, use the second method to create a derelict based on the parent ship object where the spawned derelict is specified in the parent ship file (*.shp) and the position and rotation parameters are taken over from the parent object.

This function MUST be used BEFORE deleting the parent object!

int derelictId = 0 ;
float3 position = 0.0 0.0 0.0 ;
float3 rotation = 0.0 0.0 0.0 ;
derelictAdd keynameDER derelictId position rotation ;

derelictAdd keynameDER -1 ;


Dialogue

Start dialogue.
Dialogues are saved as *.dia files in Dialogues sub-folder.

dialogue Spg2\Dialogues\M01\D01.dia ;


Distance

Calculate distance between two points.

float3 pointA = 0.0 0.0 0.0 ;
float3 pointB = 100.0 0.0 0.0 ;
math distance = Distance pointA pointB ;


DropResource

Used for dropping loot when destroying derelicts. DropLoot function can be used instead.
LootDrop file used by the function is linked through the derelict parent parameters.

derelict GetParent DropResource 1 ;