ConnectMultipleNpcs: Difference between revisions
No edit summary |
No edit summary |
||
Line 18: | Line 18: | ||
<poem> | <poem> | ||
:: execArg = The string to be executed when npc is connected. | :: execArg = The string to be executed when npc is connected. | ||
When AUTOMATIC_PLAY is used, <source inline lang="lua">"function OnNPCClassSelect() {if (!IsPlaybackRunning())StartRecordingPlayback(3, \\\""+filename+"\\\")};"</source> is prepended to execArg. When DISCONNECT_AT_END is used, <source inline lang="lua">"function OnRecordingPlaybackEnd(){QuitServer()};"</source> is also prepended. If you want to | When AUTOMATIC_PLAY is used, <source inline lang="lua">"function OnNPCClassSelect() {if (!IsPlaybackRunning())StartRecordingPlayback(3, \\\""+filename+"\\\")};"</source> is prepended to execArg. When DISCONNECT_AT_END is used, <source inline lang="lua">"function OnRecordingPlaybackEnd(){QuitServer()};"</source> is also prepended. If you do not want npc to play automatically on connect (on Class Select), pass 0 as flag and use execArg parameter. | ||
</poem>| | </poem>| | ||
example=<source lang="lua"> | example=<source lang="lua"> |
Revision as of 15:38, 28 January 2024
This function was added in v1.8 beta and will not work on previous versions.
Description:
Opens a .hrec_file and starts connecting npcs using name present in the file.
Parameters:
(filename,host="127.0.0.1",flags=7,execArg="")
filename : The name of the hrec file without the ".hrec" extension. The file must be present in the recordings/a_server/ folder.
host : The IP address of the server to connect the npcs.
flags :
Flag | Description | Value |
---|---|---|
AUTOMATIC_PLAY | Starts playing playback on class select. | 1 |
DISCONNECT_AT_END | Disconnects after playback is finished. | 2 |
SHOW_CONSOLE | The console of NPCs will be visible. | 4 |
execArg = The string to be executed when npc is connected.
When AUTOMATIC_PLAY is used, "function OnNPCClassSelect() {if (!IsPlaybackRunning())StartRecordingPlayback(3, \\\""+filename+"\\\")};"
is prepended to execArg. When DISCONNECT_AT_END is used, "function OnRecordingPlaybackEnd(){QuitServer()};"
is also prepended. If you do not want npc to play automatically on connect (on Class Select), pass 0 as flag and use execArg parameter.
Return Values:
true, on success. throws error on failure.
Example
ConnectMultipleNpcs("two_friends")
Related Functions
The following functions may be helpful as they relate to this function in one way or another.