Add hunger||doc135499

September 20, 2022


  • The class to which the function belongs:Entity


Increases the starvation value of entity objects.


  • If the increased hunger bar exceeds the max hunger bar, it becomes the max hunger bar


Variable name type Description
vp float Increase the hunger value, if the passed value is negative, it will reduce the hunger value

Value Returned

type Description
float Actual increase in hunger value. The hunger value range is [0, hunger upper limit], increase (decrease) hunger value beyond this range will be ignored

Code Samples

on the entity servermount script, add a hunger value of 20 to the entity object

local realAddVp = this:addVp(20)