OnNPCClassSelect: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
(Created page with "<poem style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;"> This function was added in v1.6 beta 4 patch2 and will not work on previous versions. </poem> {{Welcome| desc=This function is called when server grants a class to NPC to select for spawning. This function is called not when npc selects a class, but rather when a class is presented to npc.| params=<syntaxhighlight lang="lua">NoParams</syntaxhighlight>| retvals=Return true if RequestSpawn...")
 
No edit summary
Line 12: Line 12:
}  
}  
</source>|
</source>|
note=The npc's team, color and weapons are set according to the classes value, before the function is called.
relfuncs=*[[RequestSpawn]]
relfuncs=*[[RequestSpawn]]
*[[RequestClass]]
*[[RequestClass]]
}}
}}

Revision as of 16:40, 24 May 2023

This function was added in v1.6 beta 4 patch2 and will not work on previous versions.


Description:
This function is called when server grants a class to NPC to select for spawning. This function is called not when npc selects a class, but rather when a class is presented to npc.


Parameters:

NoParams


Return Values:
Return true if RequestSpawn was used or you do not want to spawn npc now. Then the program will not send another 'request for spawn' to server. If you return 0, the call will be passed to plugins and if all plugins return 0, then a 'request for spawn' will be send to server.

Important Note:
The npc's team, color and weapons are set according to the classes value, before the function is called. relfuncs=*RequestSpawn

Example

function OnNPCClassSelect() 
{ 
     RequestSpawn();
}