global_common.scr

Dependancies

none

Purpose

This script contains basic functions for use on all levels, along with definitions for
constansts that are used on all level

How to use

See the description for each function

Constant variables that have been assigned:

FALSE = 0
TRUE = 1
NULL = -1

So as long as you include this global script, you can use these variables in place of their assigned counterparts. One warning, and this is a problem with the scripting language, when you initially declare your variable, you can not set it equale to another variable. So for example this will not work:

float newVariable = TRUE;

You have to assign it to an actual number value for the initialization, and then anytime after that you can use the constants.

External Functions

globalCommon_AssertEntity( entPassedEntity, strMessage )

Purpose:
Checks the passed in entity to see if it is valid. If it's not, the game will stop and display the passed in message.

    Parms:
  • entPassedEntity (entity)
    This is the entity to perform the check on.

  • strMessage (string)
    This is the message to print on the screen before stopping the game.

globalCommon_Autosave()

Purpose:
Used to help simplify autosaving so people don't have to write as much script. It performs an autosave when called.

Parms:
None

globalCommon_OnUse( entOnUseTargetname , strOnUseThread )

Purpose:
To simplify setting up of an onuse function by automating the pause and thread assignment

    Parms:
  • entOnUseTargetname (entity)
    T his is the entity to wait for the 'onuse' action to occur.

  • strOnUseThread (string)
    T his is thread to execute when the object is used.

globalCommon_OnDamage( entOnDamageTargetname, strOnDamageThread )

Purpose:
To simplify setting up of an ondamage function by automating the pause and thread assignment

    Parms:
  • entOnDamageTargetname (entity)
    This is the entity to wait for the 'ondamage' action to occur.

  • strOnDamageThread (string)
    T his is thread to execute when the object is damaged.

globalCommon_OnTouch( entOnTouchTargetname, strOnTouchThread )

Purpose:
To simplify setting up of an ontouch function by automating the pause and thread assignment

    Parms:
  • entOnTouchTargetname (entity)
    This is the entity to wait for the 'ontouch' action to occur.

  • strOnTouchThread (string)
    This is thread to execute when the object is touched.

globalCommon_OnTrigger( entOnTriggerTargetname, strOnTriggerThread )

Purpose:
To simplify setting up of an ontrigger function by automating the pause and thread assignment

    Parms:
  • entOnTriggerTargetname (entity)
    This is the entity to wait for the 'ontrigger' action to occur.

  • strOnTriggerThread (string)
    This is thread to execute when the object is triggered.

globalCommon_OnBlock( entOnBlockTargetname, strOnBlockThread )

Purpose:
To simplify setting up of an onblock function by automating the pause and thread assignment

    Parms:
  • entOnBlockTargetname (entity)
    This is the entity to wait for the 'onblock' action to occur.

  • strOnBlockThread (string)
    This is thread to execute when the object is blocked.

globalCommon_AiDummyHide( entAiDummyToHide )

Purpose:
Takes the passed in AI character, turns their AI off, hides them, and makes them notsolid.

    Parms:
  • entAiDummyToHide (entity)
    This is the AI character to turn off, hide, and make notsolid.

globalCommon_AiDummyShow( entAiDummyToShow )

Purpose:
Takes the passed in AI character, shows them, makes them solid, and puts them in the 'idle' animation.

    Parms:
  • entAiDummyToShow (entity)
    This is the AI character to show, make solid, and set the 'idle' pose on.

globalCommon_AiActor( entAiActor )

Purpose:
Takes the passed in AI character, turns on their AI, makes them pushable, shows them, and makes them solid.

    Parms:
  • entAiActor (entity)
    This is the AI character to effect.

globalCommon_AiDummy ( entAiDummy , strAiDummyAnim )

Purpose:
Takes the passed in AI character, turns off their AI, makes them not pushable, shows them, and sets the passed in animation.

    Parms:
  • entAiDummy (entity)
    This is the AI character to effect.

  • strAiDummyAnim (string)
    This is the animation to set the character to. If "" is passed, then it won't attempt to set any animation.

globalCommon_AiActorUseWeapon( currentActor, weaponToUse )

Purpose:
Takes the passed in AI character and makes them use the passed in weapon.

    Parms:
  • currentActor (entity)
    This is the AI character to affect.

  • weaponToUse (string)
    This is the weapon to make the actor use. If set to 'current', it will use the weapon the player is using.

globalCommon_SpawnScriptModel( spawnedTikiName, spawnedTargetName, spawedOrigin, spawnedAngle )

Purpose:
Spawns a script model at the passed in origin, facing the passed in angle.

    Parms:
  • spawnedTikiName (string)
    This is the tiki to use.

  • spawnedTargetName (string)
    This is the targetname to give the script model.

  • spawedOrigin (vector)
    This is the origin to spawn it at.

  • spawnedAngle (float)
    This is the angle to face it after it's spawned.

globalCommon_SpawnActor( spawnedTikiName, spawnedTargetName, spawedOrigin, spawnedAngle )

Purpose:
Spawns an AI charcter at the passed in origin, facing the passed in angle.

    Parms:
  • spawnedTikiName (string)
    Tthis is the tiki to use.

  • spawnedTargetName (string)
    This is the targetname to give the AI character.

  • spawedOrigin (vector)
    This is the origin to spawn it at.

  • spawnedAngle (float)
    This is the angle to face it after it's spawned.

globalCommon_ActorRandomNodePatrolWork( currentActor, nodePatrolWork, animationToPlayPerNode, totalNumberOfNodes )

Purpose:
Used for characters who's AI will be off. Lets them constantly pick amongst several pre- defined work nodes, walks them over to one, and plays a passed in animation. Then loops to perform the same tasks.

    Parms:
  • currentActor (entity)
    This is the AI character entity to perform this function on.

  • nodePatrolWork (string)
    This is the identifier for all nodes this charcater can pick from.

  • animationToPlayPerNode (string)
    This is the animation to play once the character reaches a node.

  • totalNumberOfNodes (float)
    This is the total number of nodes in the group.

globalCommon_ActorRandomNodeWork( currentActor, nodePatrolWork, animationToPlayPerNode, totalNumberOfNodes )

Purpose:
Used for characters who's AI will be off. Lets them pick amongst several pre- defined work nodes, walks them over to one, and plays a passed in animation. This function does not loop.

    Parms:
  • currentActor (entity)
    This is the AI character entity to perform this function on.

  • nodePatrolWork (string)
    This is the identifier for all nodes this charcater can pick from.

  • animationToPlayPerNode (string)
    This is the animation to play once the character reaches a node.

  • totalNumberOfNodes (float)
    This is the total number of nodes in the group.

globalCommon_ActorNodeWork( currentActor, nodePatrolWork, animationToPlayPerNode, nodeToWorkAt )

Purpose:
Used for characters who's AI will be off. Takes the passed in specific node of a defined group of work nodes, walks them over to it, and plays a passed in animation. This function does not loop.

    Parms:
  • currentActor (entity)
    This is the AI character entity to perform this function on.

  • nodePatrolWork (string)
    This is the identifier for all nodes this charcater can pick from.

  • animationToPlayPerNode (string)
    This is the animation to play once the character reaches a node.

  • nodeToWorkAt (float)
    This is the number of the node in the group of nodes to work at.

globalCommon_SetupContextDialog( currentActor, theActorName )

Purpose:
Loads all the +use and context sensitive dialog on the passed in teammate, provided there is dialog recorded for that teammate.

    Parms:
  • currentActor (entity)
    This is the AI character entity to perform this function on.

  • theActorName (string)
    This is the string used to concactinate the .mp3 file names for all the context dialog. The only possible choices are:
    • "telsia"
    • "jurot"
    • "chell"
    • "chang"
    • "korban"