ENGINE SCRIPTS

 

 

General

 

void Print(std::string asText)

Prints a string to the log.

 

std::string FloatToString(float afX)

Converts a float to string

 

std::string IntToString(int alX)

Converts an integer to string,

 

float RandFloat(float afMin, float afMax)

Generates a random float.

 

int RandInt(int alMin, int alMax)

Generates a random int.

 

 

Resources

                     

static std::string __stdcall Translate(std::string asCat, std::string asName)

Gets a string in the current language.

asCat The translation category

asName The name of the category entry.

 

static void __stdcall PreloadSound(std::string asFile)

Preloads the data for a sound.

asFile This can be a wav, ogg, mp3 or snt file.

 

 

Particle Systems

 

void SetParticleSystemActive(std::string asName, bool abActive)

Set if a particle system should be active or not.                

asName The name of the particle system.

abActive If it should be active or not.

 

void CreateParticleSystem(std::string asName, std::string asType, std::string asArea,

float afX, float afY, float afZ)

Create a particle system at the position of an area

asName The name of the particle system.

asType The type of aprticle system

asArea The name of the area

X Y and Z the variables of the particle system.

 

void KillParticleSystem(std::string asName)

Kill a particle system

asName The name of the particle system.

 

Lights

 

void FadeLight3D(std::string asName, float afR,float afG, float afB, float afA, float afRadius, float afTime)

Fades a sound to a color and a radius

asName The name of the light

afR The red channel to fade to.

afG The green channel to fade to.

afB The blue channel to fade to.

afA The alpha channel to fade to.

afRadius The radius to fade to.

afTime The amount of seconds the fade should last.

 

void AttachBillboardToLight3D(std::string asBillboardName, std::string asLightName,bool abX)

Attaches a billboard to a light

asBillboardName The billbaord name

asLightName The light name

abX True if it should be attached, false if you want to remove.

                     

void SetLight3DVisible(std::string asName, bool abX)

Sets on/off a light

asName The light name

abX if the light should be on or off.

 

void SetLight3DFlickerActive(std::string asName, bool abX)

Sets flickering on/off a light

asName The light name

abX if the light flicker should be on or off.

 

void SetLight3DFlicker(std::string asName,

float afR,float afG, float afB, float afA,

float afRadius,

float afOnMinLength, float afOnMaxLength,

std::string asOnSound,std::string asOnPS,

float afOffMinLength, float afOffMaxLength,

std::string asOffSound,std::string asOffPS,

bool abFade,

float afOnFadeLength, float afOffFadeLength)

Sets flickering parameters

asName The light name

abR, afG, afB, afA The color of the light when off

afRadius The radius of the light when off.

afOnMinLength Minimum time before going from off to on.

afOnMaxLength Maximum time before going from off to on.

asOnSound Name of the sound played when going from off to on. "" means no sound.

asOnPS Name of the particle system played when going from off to on. "" means none.

afOffMinLength Minimum time before going from on to off.

afOffMaxLength Maximum time before going from on to off.

asOffSound Name of the sound played when going from on to off. "" means no sound.

asOffPS Name of the particle system played when going from on to off. "" means none.

abFade If there should be a fade between off and on.

afOnFadeLength Fade length from off to on.

afOffFadeLength Fade length from on to off.

 

Sounds

 

void CreateSoundEntity(std::string asName, std::string asFile, std::string asArea)

Creates a sound entity at the postion of an area.

asName Name of the sound area

asFile The snt file to load.

asArea The area to create at.

                     

void PlaySoundEntity(std::string asName, bool abPlayStart)

Play a sound entity

asName The entity name

abPlayStart If the start sound should be played.

                     

void StopSoundEntity(std::string asName, bool abPlayEnd)

Stop a sound entity

asName The entity name

abPlayEnd If the end sound should be played.

                     

void FadeInSoundEntity(std::string asName, float afSpeed)

Play a sound entity fading it

asName The entity name

afSpeed Volume increase per second.

                     

void FadeOutSoundEntity(std::string asName, float afSpeed)

Stop a sound entity fading it

asName The entity name

afSpeed Volume decrease per second.

 

void PlayMusic(std::string asName, float afVol, float afStepSize, bool abLoop)

Play music track.

asName Name of the music file.

afVol Volume of the music

afStepSize The increase in volume per second when fading in.

 

void StopMusic(float afStepSize)

Play music track.

afStepSize The decrease in volume per second when fading out.

 

void PlayGuiSound(std::string asName, float afVol)

Play a sound gui sound, with out any position.

asName The sound name

afVol Volume of the sound

 

Physics

                     

void SetJointCallback(std::string asJointName, std::string asType,std::string asFunc)

Sets a callback for a joint.

The syntax for the function is: void MyFunction(string asJointName)

asJointName The joint name

asType The type, can be: "OnMax" or "OnMin".

asFunc The script function to be called. Must be in the current script file. "" = disabled.

                     

void BreakJoint(std::string asJointName)

Breaks a joint.

asJointName The joint name

 

void SetJointControllerActive(std::string asJointName,std::string asCtrlName, bool abActive)

Sets if a joint controller is active or not.

asJointName The joint name

asCtrlName The controller name

abActive If the controller is to be active or not.

 

void ChangeJointController(std::string asJointName,std::string asCtrlName)

Change the active controller. All other controllers are set to false.

asJointName The joint name

asCtrlName The controller name

 

float GetJointProperty(std::string asJointName, std::string asProp)

Gets a property from the joint.

Valid properties are:

"Angle" The angle between the bodies (in degrees) (Not working for ball joint)

"Distance" The distance between the bodies (in meter)

"LinearSpeed" The relative linear speed between the bodies (in m/s)

"AngularSpeed" The relative angular speed between the bodies (in m/s)

"Force" The size of the force (in newton, kg*m/s^2).

asJointName The joint name

asProp The property to get

                     

float GetBodyProperty(std::string asBodyName, std::string asProp)

Gets a property from the body.

Valid properties are:

"Mass" The mass of the body (in kg)

"LinearSpeed" The linear speed the body has (in m/s)

"AngularSpeed" The angular speed the body has (in m/s)

asBodyName The body name

asProp The property to get

 

void SetBodyProperty(std::string asBodyName, std::string asProp, float afVal)

Gets a property from the body.

Valid properties are:

"Mass" The mass of the body (in kg)

asBodyName The body name

asProp The property to get

afVal The new value of the property

 

void AddBodyForce(std::string asBodyName, std::string asCoordType, float afX, float afY, float afZ)

Adds a force to the body. This can either be in the bodies local coord system or the world's.

asBodyName The body name

asCoordType The coordinate system type. "World" or "Local".

afX force in the x direction. (in newton, kg*m/s^2)

afY force in the y direction. (in newton, kg*m/s^2)

afZ force in the z direction. (in newton, kg*m/s^2)

 

void AddBodyImpulse(std::string asBodyName, std::string asCoordType,

                                            float afX, float afY, float afZ)

Adds an impule (a change in velocity) to the body. This can either be in the bodies local coord system or the world's.

asBodyName The body name

asCoordType The coordinate system type. "World" or "Local".

afX velocity in the x direction. (in m/s)

afY velocity in the y direction. (in m/s)

afZ velocity in the z direction. (in m/s)

 

Local Variables

                     

void CreateLocalVar(std::string asName, int alVal)

void SetLocalVar(std::string asName, int alVal)

void AddLocalVar(std::string asName, int alVal)

int GetLocalVar(std::string asName)

 

Global Variables

                     

void  CreateGlobalVar(std::string asName, int alVal)

void SetGlobalVar(std::string asName, int alVal)

void AddGlobalVar(std::string asName, int alVal)

int GetGlobalVar(std::string asName)

 

GAME SCRIPTS

General

 

void ResetGame();

Resets the game and returns to main menu

 

string GetActionKeyString(std::string asAction);

Gets the key for a certain action

asAction The name of the action

 

void AddMessageTrans(std::string asTransCat, std::string asTransName);

Adds on on screen game message.

TransCat The translation category

TransName The translation name

 

void AddMessage(std::string asMessage);

Adds on on screen game message.

asMessage The text to be shown.

 

void SetMessagesOverCallback(std::string asFunction)

Sets a callback that is called (and removed) when the last message as been shown.

asFunction The function to be called, syntax "MyFunc()"

 

void ChangeMap(std::string asMapFile, std::string asMapPos,

                      std::string asStartSound, std::string asStopSound,

                      float afFadeOutTime, float afFadeInTime);

Changes the map.

asMapFile The file to be loaded

asMapPos The position on the map to be spawned on.

asStartSound The sound that is played when the change starts.

asStopsSound The sound that is played when the new map is loaded

afFadeOutTime Time in seconds it takes for the fade out.

afFadeInTime Time in seconds it takes for the fade in.

                     

void AddNotebookTask(std::string asName, std::string asTransCat,

std::string asTransEntry);

Adds a new task note in the notebook

asName Name of the task

asTransCat Translation category of text.

asTransEntry Translation entry of text.

 

void AddNotebookNote(std::string asNameCat, std::string asNameEntry,

std::string asTextCat, std::string asTextEntry);

Adds a note to the note book

asNameCat

asNameEntry Name of the note

asTextCat

asTextEntry The note text.

 

void RemoveNotebookTask(std::string asName);

 

Removes a task note in the notebook.

asName Name of the task

 

void StartNumericalPanel(std::string asName,int alCode1,int alCode2,int alCode3,

int  alCode4, float afDifficulty, std::string asCallback);

Starts the numerical panel

asName Name of the panel

alCode1 1st code digit.

alCode2 2nd code digit.

alCode3 3rd code digit.

alCode4 4th code digit.

afDifficulty How difficult it is to hack.

asCallback Called when the code as been entered. Syntax: MyCallback(string asName, bool abCodeWasCorrect)

 

 

void SetInventoryActive(bool abX);

Set if the inventory should be active.

abX If it is active or not.

 

void FadeIn(float afTime);

Fades the screen to full color.

afTime Time the fade will take in seconds.

 

void FadeOut(float afTime);

Fades the screen to black.

afTime  Time the fade will take in seconds.

 

bool IsFading();

Check if a fade is going on.

 

void SetWideScreenActive(bool abActive);

Sets wide screen mode on or off.

 

void AutoSave();

Save the game to the auto save.

 

void StartFlash(float afFadeIn, float afWhite, float afFadeOut);

Creates a white flash on screen.

afFadeIn The time the fade in takes.

afWhite The time it stays white.

afFadeOut The time the fade out takes.

 

Attacks

 

void CreateSplashDamage(std::string asAreaName, float afRadius, float afMinDamage, float afMaxDamge,

float afMinForce, float afMaxForce, float afMaxImpulse);

Creates a ball shaped splash damage at the center of an area.

asAreaName Name of the area.

afRadius Radius of the slash damage in meters.

afMinDamage The minimum damage if in side radius

afMaxDamge The maximum damage, this is when you are at center.

afMinForce The minimum force if you are inside the radius.

afMaxForce The maximum force, this is when you are at center.

afMaxImpulse Impulse is ForceSize / Mass and this is the max value for that. This is useful to insure that samll objects to no gain very high speed.

 

Game Timer

void CreateTimer(std::string asName, float afTime, std::string asCallback, bool abGlobal);

Creates a new timer which calls a callback function when the time is out.

Syntax: MyCallback(string asTimerName), the prefix "@" (ie "@Func()") shows that the function is in the global script

asName Name of the timer

afTime The time til time out in seconds.

asCallback The callback fucntion

abGlobal If the timer is global. Global timers are not deleted at map change.

 

void DestroyTimer(std::string asName);

void SetTimerPaused(std::string asName, bool abPaused);

void SetTimerTime(std::string asName, float afTime);

void AddTimerTime(std::string asName, float afTime);

float GetTimerTime(std::string asName);

 

Player

 

static void GivePlayerDamage(float afAmount);

Gives the player a hit + damage

afAmount The amount of health taken.

 

void SetPlayerPose(std::string asPose);

Sets the pose of the player.

asPose The pose, can be "Stand" or "Crouch"

 

void SetPlayerActive(bool abActive);

Sets if player can be moved or not.

abActive If the player is active or not.

 

void StartPlayerLookAt(std::string asEntityName, float afSpeedMul, float afMaxSpeed);

This turns the players head towards a specific entity.

asEntityName The entity name

afSpeedMul The speed of the head movement is determined by the angle length multiplied by this.

afMaxSpeed The maximum speed the head will turn.

                     

void StopPlayerLookAt();

Stops the look at motion.

 

void StartPlayerFearFilter(float afStrength);

Starts a fear effect filter.

afStrength strength of the filter.

 

void StopPlayerFearFilter();

Stops the fear filter.

 

Inventory

 

void AddPickupCallback(std::string asItem, std::string asFunction);

Add a callback that is called when the player picks up an item.

The syntax for the callback function is:

void MyFunction(string asItem), the prefix "@" (ie "@Func()") shows that the function is in the global script

asItem The name of the item.

asFuntion The name of the function called.

 

void AddUseCallback(std::string asItem, std::string asEntity, std::string asFunction);

Add a callback that is called when the player uses the item on en entity

The syntax for the callback function is:

void MyFunction(string asItem, string asEntity), the prefix "@" (ie "@Func()") shows that the function is in the global script

asItem The name of the item.

asEntity The name of the entity.

asFuntion The name of the function called.

 

void AddCombineCallback(std::string asItem1,std::string asItem2, std::string asFunction);

Add a callback that is called when the player combines two items

The syntax for the callback function is (alSlotIndex = slot at which combination occurd):

void MyFunction(string asItem1, string asItem2, int alSlotIndex), the prefix "@" (ie "@Func()") shows that the function is in the global script

asItem1 The name of the first item.

asItem2 The name of the second item.

asFuntion The name of the function called.

 

void RemovePickupCallback(std::string asFunction);

void RemoveUseCallback(std::string asFunction);

void RemoveCombineCallback(std::string asFunction);

Removes the callback.

asFuntion The name of the function used by the callback.

                     

bool HasItem(std::string asName);

Checks if the player has a certain item.

asName The name of the item.

 

void RemoveItem(std::string asName);

Removes an item from the inventory.

asName The name of the item.

 

void GiveItem(std::string asName,std::string asEntityFile, int alSlotIndex);

Give an item to the player.

asName The name of the entity

asEntityFile The file to load it from.

lSlotIndex The index of the slot to put the item in. -1 = first empty slot

                     

 

Game Entity Properties

                     

void SetGameEntityActive(std::string asName, bool abX);

Set if a game entity is active.

asName The name of the game entity

abX If active or not.

                     

bool GetGameEntityActive(std::string asName);

Get if a game entity is active.

asName The name of the game entity

return if active or not.

                     

void CreateGameEntityVar(std::string asEntName, std::string asVarName, int alVal);

void SetGameEntityVar(std::string asEntName, std::string asVarName, int alVal);

void AddGameEntityVar(std::string asEntName, std::string asVarName, int alVal);

int GetGameEntityVar(std::string asEntName, std::string asVarName);

Create a variable for a game entity. Nothing happens if it is allready created.

asEntName The name of the game entity

asVarName The name of variable

alVal value to set the variable to.

                     

void SetGameEntityMaxExamineDist(std::string asName,float afDist);

Set the maximum distance at which a game entity can be examined.

asName The name of the game entity

afDist The distance in meters

                     

void SetGameEntityMaxInteractDist(std::string asName,float afDist);

Set the maximum distance at which a game entity can be interacted with.

asName The name of the game entity

afDist The distance in meters

 

void SetGameEntityDescriptionTrans(std::string asName,std::string asTransCat, std::string asTransName);

Set a description on a game entity.

asName The name of the game entity

asTransCat The translation category

asTransName The translation name

                                                                                                                                                                                                                                                                    

void SetGameEntityDescription(std::string asName, std::string asMessage);

Set a description on a game entity.

asName The name of the game entity

asMessage The message

 

void SetGameEntityGameNameTrans(std::string asName, std::string asTransCat,std::string asTransName);

Set a game name on a game entity.

asName The name of the game entity

asTransCat The translation category

asTransName The translation name

 

void SetDoorState(std::string asName,std::string asState);

Set a description on a game entity.

asName The name of the game entity

asState The state to set, thís can be "Open","Closed", "Opening" or "Closing".

                     

void SetObjectInteractMode(std::string asName,std::string asMode);

Sets the interact mode of an game object.

asName The name of the game object

asState The mode to set, valid modes are "Static", "Grab", "Move" and "Push".

                     

static void __stdcall SetupLink(std::string asName, std::string asMapFile, std::string asMapPos,

std::string asStartSound, std::string asStopSound,

float afFadeOutTime, float afFadeInTime);

Sets up the properties for a link.

asName The name of the link

asMapFile The file to be loaded

asMapPos The position on the map to be spawned on.

asStartSound The sound that is played when the change starts.

asStopsSound The sound that is played when the new map is loaded

afFadeOutTime Time in seconds it takes for the fade out.

afFadeInTime Time in seconds it takes for the fade in.

 

void SetAreaCustomIcon(std::string asName, std::string asIcon);

Makes the area show a custom icon on player focus.

asName The name of the area

asIcon The icon, can be: "Inactive", "Active", "Invalid", "Grab", "Examine", "Pointer", "Item", "DoorLink" or "None".

 

void AddEnemyPatrolNode(std::string asEnemy,std::string asNode,float afTime,std::string asAnimation);

Adds node that the enemy will have on his patrol path.

asEnemy Name of the enemy

asNode The Node to walk to.

afTime The time to stay at the node when reached.

asAnimation The animation to be played when at the node. "" = idle.

 

void ClearEnemyPatrolNodes(std::string asEnemy);

Clears all the patrol nodes for the enemy

asEnemy The Name of the enemy.

 

 

void SetEnemyDeathCallback(std::string asEnemy,std::string asFunction);

Sets the function that is called when the enemy dies.

asEnemyName Name of the enemy

asFunction The function, syntax: MyFunc(string asEnemyName)

 

float GetEnemyHealth(std::string asEnemy);

Gets the health of an enemy

asEnemyName Name of the enemy

return the health.

 

void ShowEnemyPlayer(std::string asEnemy);

Show the enemy the position of the player and sets the enemy into hunt mode.

asEnemy The name of the Enemy.

 

Game Entity Callbacks

 

void AddEntityCollideCallback(std::string asType, std::string asDestName, std::string asEntityName, std::string asFuncName);

Add a collide callback to an entity.

The syntax for the callback function is:

void MyFunction(string asParent, string asChild), the prefix "@" (ie "@Func()") shows that the function is in the global script

asParent is the entity the function is attached to and asChild is the other entity in the collision.

asType The type of callback, this can be "Enter", "During" or "Leave"

asDestName The entity that should have the callback. "Player" will add it to the player.

asEntityName The entity to check for collision with.

asFuncName The name of the script function to add. This must be in the level's script file and not the global.

 

void RemoveEntityCollideCallback(std::string asType, std::string asDestName, std::string asEntityName);

Removes a collide callback on an entity.

asType The type of callback, this can be "Enter", "During" or "Leave"

asDestName The entity that has the callback

asEntityName The entity to check for collision with.

 

void AddEntityCallback(std::string asType, std::string asDestName, std::string asFuncName);

Add a callback to an entity.

The syntax for the callback function is:

void MyFunction(), the prefix "@" (ie "@Func()") shows that the function is in the global script

The different types are the following

"PlayerInteract" The player interacts with the entity.

"PlayerExamine" The player examines the entity.

"PlayerLook" The player is looking at the entity (it is in "focus").

"OnUpdate" When the entity is updated.

asType The type of callback

asDestName The entity that should have the callback

asFuncName The name of the script function to add. This must be in the level's script file and not the global.

 

void RemoveEntityCallback(std::string asType, std::string asDestName);

Removes a callback on an entity.

asType The type of callback. The same types as for AddEntityCallback applies.

asDestName The entity that has the callback

 

 

Game Sound

                     

void CreateSoundEntityAt(std::string asType,std::string asDestName, std::string asSoundName,std::string asSoundFile);

Creates a sound entity at the position of an entity.

asType The type of entity. This can be: "Joint","Body" or "Entity".

asDestName The entity/body/joint name

asSoundName The name of created sound entity.

asSoundFile The name of the snt file.