SetScript (script event)

Game class

This event operates on an instance of the game class type {{{gameclass}}}


Set a script hook on the AI entity. Pass a value of “” as the functionName to clear the function that is currently set for a script.


void setScript(string “scriptName”, string “functionName” )


  • scriptName
  • functionName




The following is a list of the available scripts:

  • init - called when the AI is first initialized
  • first_sight - called the first time and enemy is ever sighted
  • sight - called each time an enemy is sighted
  • pain - called each time pain is taken
  • damage - called each time damage is taken
  • death - called when AI is dead
  • attack - called each time the AI attacks
  • onclick - called when the player clicks on a friendly AI
  • launch_projectile - called when a projectile is launched
  • footstep - called for each footstep generated by the AI