Main Page: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
(45 intermediate revisions by 2 users not shown)
Line 7: Line 7:
Each NPC run in its own process. The NPC scripts have functions as well as callbacks.  
Each NPC run in its own process. The NPC scripts have functions as well as callbacks.  


Since v1.5, adding an npc is simple as a call to [[ConnectNPC]] and if you do not want to give npc AI, the script parameter can be omitted.  
Since v1.5, adding an npc is simple as a call to [[ConnectNPC]] and if you do not want to give npc any artificial intelligence, the script parameter can be omitted.  
{| style=height:1em
{| style=height:1em
|scope="col" style="width: 300px; text-align:left; vertical-align: top;"|  
|scope="col" style="width: 300px; text-align:left; vertical-align: top;"|  
Line 14: Line 14:
== NPC script functions ==  
== NPC script functions ==  
|scope="col" style="width: 300px;vertical-align: top;" |  
|scope="col" style="width: 300px;vertical-align: top;" |  
==ServerData (v1.6)==
==ServerData ==
|-style="vertical-align: top;"
|-style="vertical-align: top;"
|  
|  
Line 36: Line 36:
* [[OnConsoleInput]]
* [[OnConsoleInput]]
* [[OnServerData]]
* [[OnServerData]]
* [[OnExplosion]]
* [[OnProjectileFired]]
* [[OnNPCClassSelect]]
* [[OnServerShareTick]]
*[[OnTimeWeatherSync]]
==Constants==
==Constants==
* [[Bodypart| BodyParts]]
* [[Bodypart| BodyParts]]
Line 41: Line 46:
* [[Keys|Game Keys]]
* [[Keys|Game Keys]]
* [[Player_States|Player States]]
* [[Player_States|Player States]]
* [[Play_Flags|Play Flags]]
== Classes ==
== Classes ==
*[[Vector]]
*[[Vector]]
Line 56: Line 62:
*[[GetPlayerName]]
*[[GetPlayerName]]
*[[IsPlayerConnected]]  
*[[IsPlayerConnected]]  
* [[GetPlayerSkin]] (v1.5)
* [[GetPlayerSkin]]  
* [[GetPlayerTeam]] (v1.5)
* [[GetPlayerTeam]]  
* [[GetPlayerSlotWeapon]] (v1.5)
* [[GetPlayerSlotWeapon]]  
* [[GetPlayerSlotAmmo]] (v1.5)
* [[GetPlayerSlotAmmo]]  
* [[WhereIsPlayer]] (v1.5)
*[[GetPlayerSpeed]]
*[[GetPlayerAction]]
* [[WhereIsPlayer]]  
== Modules ==
== Modules ==
* [[LibRPC]]
* [[LibRPC]]
* [[LibAction]]
* [[LibAction]]
* [[npcmodule]] (to be renamed)
* [[npcmodule]] (to be renamed)
* [[z-finder]]
* [[z-finder]]
== v1.8 ==
* [[Suicide]]
* [[SetMyHealth]]
* [[GetMyHealth]]
* [[LookAtPos]]
* [[LookAtPlayer]]
* [[GetMyClass]]
* [[RequestClassAbs]]
* [[AmISpawned]]
* [[GetMySkin]]
* [[GetMyTeam]]
* [[GetMyArmour]]
* [[SendPrivMsg]]
* [[SetConfig]]
* [[GetPlayerColor]]
* [[GetMyColor]]
* [[IsPlaybackRunning]]
* [[IsPlaybackPaused]]
  ||  
  ||  
* [[StartRecordingPlayback]]
* [[StartRecordingPlayback]]
Line 84: Line 110:
* [[GetAmmoOfMyWeapon]]
* [[GetAmmoOfMyWeapon]]
* [[SetTimer]]
* [[SetTimer]]
* [[SetTimerEx]] (v1.5)
* [[SetTimerEx]]  
* [[KillTimer]]
* [[KillTimer]]
* [[GetMyName]] (v1.6 )
* [[GetMyName]]  
* [[GetMyID]] (v1.6 )
* [[GetMyID]]  
* [[QuitServer]] (v1.6)
* [[QuitServer]]
==Advanced functions(v1.5+)==
* [[RequestClass]]
* [[ReqeustClassAbs]]
* [[RequestSpawn]]
* [[GetTickCount]]
* [[GetClosestPlayer]]
* [[GetSlotFromWeaponId]]
* [[FaceNPCToPlayer]]
==Advanced functions==
* [[SendOnFootSyncData]]
* [[SendOnFootSyncData]]
* [[SendOnFootSyncDataEx]]
* [[SendOnFootSyncDataEx]]
Line 99: Line 132:
* [[FireSniperRifle]]
* [[FireSniperRifle]]
* [[FireSniperRifleEx]]
* [[FireSniperRifleEx]]
* [[EnterVehicle]]
* [[FireProjectile]]
* [[SendShotInfo]]
* [[SendShotInfo]]
* [[SendDeathInfo]]
* [[SendDeathInfo]]
* [[GetLocalValue]]
* [[GetLocalValue]]
* [[SetLocalValue]]
* [[SetLocalValue]]
* [[GetSlotFromWeaponId]]
* [[FaceNPCToPlayer]]
* [[GetTickCount]]
* [[GetClosestPlayer]]
== Functions used only in server scripts==
== Functions used only in server scripts==
* [[ConnectNPC]]
* [[ConnectNPC]]
* [[ConnectNPCEx]](v1.5)
* [[ConnectNPCEx]]
* [[IsPlayerNPC]]
* [[IsPlayerNPC]]
* [[ShowNPCConsole]](v1.5)
* [[ShowNPCConsole]]
* [[StartRecordingPlayerData]]
* [[StartRecordingPlayerData]]
* [[StopRecordingPlayerData]]
* [[StopRecordingPlayerData]]
* [[RFC]](v1.6)
* [[RFC]]
* [[F]](v1.6)
* [[F]]
* [[Examples]] (Remote calls)
* [[Examples]] (Remote calls)
* [[StartRecordingAllPlayerData]] (v1.8)
* [[StopRecordingAllPlayerData]]
* [[PutServerInRecordingMode]]
* [[StopServerInRecordingMode]]
* [[IsPlayerRecording]]
* [[IsServerInRecordingMode]]
* [[ConnectMultipleNpcs]]
* [[StopConnectingMultipleNpcs]]
* [[Server.cfg|server.cfg values]]
==Tools==
* [[recupdate]]
* [[recEdit]]
||
||
* [[SendServerData]]
* [[SendServerData]]
Line 128: Line 169:
*[[WriteFloat]]
*[[WriteFloat]]
*[[WriteString]]
*[[WriteString]]
==v1.6 beta 4==
==Pickup==
*[[FireProjectile]]
*[[OnExplosion]]
*[[OnProjectileFired]]
*[[OnNPCClassSelect]]
*[[RequestClass]]
*[[RequestSpawn]]
*[[OnServerShareTick]] (beta 5)
==v1.7==
*[[ClaimPickup]]
*[[ClaimPickup]]
*[[IsPickupStreamedIn]]
*[[IsPickupStreamedIn]]
Line 147: Line 180:
*[[OnPickupDestroyed]]
*[[OnPickupDestroyed]]
*[[OnPickupUpdate]]
*[[OnPickupUpdate]]
==Checkpoint==
*[[OnCheckpointStreamIn]]
*[[OnCheckpointStreamIn]]
*[[OnCheckpointDestroyed]]
*[[OnCheckpointDestroyed]]
Line 157: Line 191:
*[[ClaimEnterCheckpoint]]
*[[ClaimEnterCheckpoint]]
*[[ClaimExitCheckpoint]]
*[[ClaimExitCheckpoint]]
*[[OnTimeWeatherSync]]
*[[GetCheckpointCount]]
==Vehicle==
*[[EnterVehicle]]
*[[GetVehicleDriver]]
*[[GetVehicleDriver]]
*[[GetVehicleModel]]
*[[GetVehicleModel]]
Line 166: Line 202:
*[[GetVehicleHealth]]
*[[GetVehicleHealth]]
*[[GetVehicleDamage]]
*[[GetVehicleDamage]]
*[[GetPlayerSpeed]]
*[[ExitVehicle]]
*[[ExitVehicleEx]]
==Objects==
*[[OnObjectStreamIn]]
*[[OnObjectDestroyed]]
*[[OnObjectUpdate]]
*[[IsObjectStreamedIn]]
*[[IsObjectStreamedIn]]
*[[GetObjectModel]]
*[[GetObjectModel]]
Line 177: Line 218:
*[[ClaimObjectShot]]
*[[ClaimObjectShot]]
*[[GetObjectCount]]
*[[GetObjectCount]]
*[[GetCheckpointCount]]
*[[ExitVehicle]] (b2)
*[[ExitVehicleEx]] (b2)
*[[GetPlayerAction]] (b2)
== More ==
== More ==
*[[NPC Installation]]
*[[NPC Installation]]
* [[Squirrel Standard Library Functions]]
* [[Squirrel Standard Library Functions]]
* [[Special:WikiForum| Forum]]
* [[NPCHide]]
* [[NPCHide]]
* [[Command-line usage]]
* [[Command-line usage]]
Line 194: Line 230:
'''04 February 2023: Hiding/Changing name of NPC In-Game New Plugin. [[NPCHide|see]]
'''04 February 2023: Hiding/Changing name of NPC In-Game New Plugin. [[NPCHide|see]]
</poem>
</poem>
<poem style="border: 2px solid #d6d2c5; background-color: #CCE5FF; ">
<Poem style="border: 2px solid #d6d2c5; background-color: #FFC0CB; ">
'''20 February 2023: New module Lib Action released'''. [[LibAction|'''click here''']]
'''29 February 2024: NPC v1.8 Beta P1 is released'''. (new) [[V1_8_beta_release_notes|'''click here''']]
</poem>
<poem style="border: 2px solid #d6d2c5; background-color: #ff00ff; ">
'''27 June 2023: NPC v1.6 Beta5 is released'''. [[V1_6_beta5_release_notes|'''click here''']]
</poem>
<Poem style="border: 2px solid #d6d2c5; background-color: #ffffcc; ">
'''24 August 2023: NPC v1.7 Beta is released''' See [[https://forum.vc-mp.org/index.php?topic=8799.msg53417#new forum.vc-mp.org]]
</poem>
</poem>

Revision as of 06:09, 6 May 2024

Introduction

NPCs (Non Player Characters) or bots can be created in vcmp server. They can be created at ammunition stores, toolshop or mall. They can chat with players, send command to server. They can be used to play a previous recording like driving a car around an area repeatedly. Like normal players, they use server slot. Their intelligence can be scripted in separate squirrel scripts. These scripts with 'artificial intelligence' of NPC reside in npcscripts directory.

Each NPC run in its own process. The NPC scripts have functions as well as callbacks.

Since v1.5, adding an npc is simple as a call to ConnectNPC and if you do not want to give npc any artificial intelligence, the script parameter can be omitted.

NPC script callbacks

NPC script functions

ServerData

Constants

Classes

Player functions

Modules

v1.8

Advanced functions

Functions used only in server scripts

Tools

Pickup

Checkpoint

Vehicle

Objects

More

04 February 2023: Hiding/Changing name of NPC In-Game New Plugin. see

29 February 2024: NPC v1.8 Beta P1 is released. (new) click here