AI_Function
This package allows time-delayed functions to be called by enqueuing the functions in the AI queue of the NPC in question. This can be very useful in writing cutscenes on engine or implementing new routines.
Dependencies
Initialization
Initialize with LeGo_AI_Function
flag.
Implementation
Functions
The script function function
is called with a delay: it joins the AI queue of slf
.
var C_NPC slf
NPC in whose AI queue the function is queuedvar func function
Name of function to be queued
Additionally, there are some overloads of AI_Function
, which allow to call functions with parameters.
In the called function, self
can be accessed as follows:
Info
From LeGo 2.7.2 the global instance self
is provided correctly and can be used directly.
Examples
Enqueueing a simple function
Before a function is called, any Npc should first complete its AI queue.
Here the hero is supposed to run to a waypoint, and only when he has arrived is to start a tracking shot.
Wld_SendTrigger("CAMERASTART");
is called.