ConnectNPCEx
This function was added in v1.5 and will not work on previous versions.
Version 1.5 patch2 has added parameter enableconsoleinput
Description:
Connect an NPC to the server with extended parameters
Parameters:
(name, x, y, z, angle, skinId, weaponId, classId, script="", enableconsoleinput, host="127.0.0.1", ...)
name : The name for the NPC to connect to server.
x : The x co-ordinate where the npc is to be spawned.
y : The y co-ordinate where the npc is to be spawned.
z : The z co-ordinate where the npc is to be spawned.
Below are optional parameters
angle : The npc's angle
skinId : The skin for the npc. Note that clients in VCMP 0.4 can not set skin by themselves. It is the server which can set skins. So if this paramter is provided then a command "_npc_skin_request skinId" will be send to server when spawning for first time.
weaponId : The weapon in npc's hand when spawning for the first time. Note that this must be one of the three weapons of the first spawn class of the server. Otherwise sometimes the server kick npc for 'acquiring' weapons.
classId :: The class npc should select at 'class selection' screen. 0 means first class, 1 means second and so on. Default is 0 ( if parameter is not passed. ie. In calling function, less than 8 parameters are passed )
script : The script NPC may use. This script must reside in npcscripts folder. From v1.5 this has been made optional. ie. npc's can be created without any script.
enableconsoleinput : true/false. If true, text typed in the console is passed to the npcscript by calling the function OnConsoleInput, if available. If true, the console will not be hidden. If false, text cannot be typed in the console and visibility of console depends on ShowNPCConsole called earlier.
host : This IP address of the host. host = "" will be replaced with "127.0.0.1".
... : The string parameters. If specified they are passed as an array to OnNPCScriptLoad
Return Values:
This function does not return any specific values.
Example
function onScriptLoad() { ConnectNPCEx("Mercedes",100.0,200.0,10.0,0.0,116,0,"",true,"","paramter1", "parameter2", "parameter3"); }
Related Functions
The following functions may be helpful as they relate to this function in one way or another.