GetLocalValue: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
(Created page with "{{Welcome|desc=Gets current field values of npc as a player.| params=<syntaxhighlight lang="lua">(field)</syntaxhighlight> <poem>::field : The field of npc's data to which...")
 
No edit summary
 
Line 4: Line 4:
</poem>|
</poem>|
retvals=<poem>The value as integer or float.</poem>|
retvals=<poem>The value as integer or float.</poem>|
example=The following code will fetch npc's current ammo.
example=The following code will fetch npc's current health.
<source lang="lua">
<source lang="lua">
local health = GetLocalValue(I_HEALTH );
local health = GetLocalValue(I_HEALTH );
if( health < 5 )
if( health < 5 )
SendChat("Water. water please...");
SendChat("Water. water please...");
</source>
</source>|
relfuncs= *[[SetLocalValue]]
relfuncs= *[[SetLocalValue]]
}}
}}

Latest revision as of 18:19, 7 December 2022


Description:
Gets current field values of npc as a player.


Parameters:

(field)

field : The field of npc's data to which the value is to be get.


Return Values:

The value as integer or float.



Example The following code will fetch npc's current health.

local health = GetLocalValue(I_HEALTH );
if( health < 5 )
SendChat("Water. water please...");

Related Functions

The following functions may be helpful as they relate to this function in one way or another.