AI Scripting Entity Changes and Additions

 

NPC Entity Changes

To implement AI scripting, there have been some changes made to the NPC entity definitions. Two new keys have been added to the definition of each NPC to support scripting. These keys are ainame and skin.

The ainame key is used to give the entity an unique name which is used to identify which script block is associated with this entity. If this key is left blank, or not entered, then the entity will not use a script.

The skin key is used to define a .skin file that will be used to texture the NPC model rather than using the default textures. The skin file must be in the same directory as the model.

For example, the entity definition for the Pilot NPC now looks like :

/*QUAKED npc_pilot (0.2 0.5 0) (-16 -16 -40) (16 16 8) suspended disabled deaf first_taunt
"shot_factor" likeness of NPC to fire (far weapon), 1.0 means always fire, 0 means never fire, only chase, default is 0.5 "ainame" entity name used by AI scripting "skin" skin file used to texture model
*/

New Entities

There are also two new entities that have been added for the purpose of running an AI script. The first is the script_play entity and it's definition is as follows :

/*QUAKED script_play (0 0.5 0) (-4 -4 -4) (4 4 4)
Plays a script
"ainame" entity name used by AI scripting
*/

This entity is used to run a script and generally is used as a controller of events or as the director of a cut scene. It will run a script block whose name matches the ainame of the entity definition.

The second new entity is the script_trigger and it's definition is :

/*QUAKED script_trigger (1 0.5 0) ? Startoff
Triggered only by the player touching it
"wait" : Seconds between triggerings, -1 = one time only (default).
"ainame" : name of AI to target (use "player" for the player)
"target" : trigger identifier for that AI script
*/

It can be triggered by the player touching it, just like any other trigger_ entity, at which point it will execute the trigger <target> script event in the <ainame> script block. For example, if the ainame key value is ogre1 and the target key value is touch then, when the player triggers this entity, the trigger touch script event in the ogre1 script block will be run.



Return to Home Page