The hunter: position, view, health, items.
Functions that read return nothing outside a hunt (player.pos() gives no values); functions that change the hunter
raise an error outside a hunt: check game.inHunt() first. Yaw is the game's heading in degrees: 0 looks along -z,
90 along +x, 180 along +z, 270 along -x (on the game's own map: east, south, west, north); creatures use the same yaw.
# player.exists () → boolean
Whether the hunter exists.
Returns
boolean true in a hunt
# player.pos () → number, number, number
hunt only
Returns
number x
number y (the ground under him)
number z
copy local x, y, z = player .pos()
# player.setPos (x , y , z )
hunt only
Moves the hunter. player.setPos(x, z) puts him on the ground there.
Parameter Type
xnumber
ynumber height; with two arguments (x, z) he stands on the ground
znumber
# player.teleport (x , z )
hunt only
Moves the hunter to x, z on the ground.
Parameter Type
xnumber
znumber
# player.yaw () → number
hunt only
Where the hunter looks (the heading).
Returns
number degrees 0-360
# player.pitch () → number
hunt only
How far up or down he looks.
Returns
number degrees, + up / - down
# player.forward () → number, number
hunt only
The unit direction he looks along, on the ground.
Returns
number dx
number dz
copy local dx, dz = player .forward()
local x, _, z = player .pos()
world .spawn("velociraptor" , x + dx * 3000 , z + dz * 3000 )
# player.setHealth (health )
hunt only
Sets his health (he dies only by the game's own causes).
Parameter Type
healthnumber above 0, at most player.maxHealth()
# player.maxHealth (health? ) → number
The hunter's full health (128). Since API 3 a value sets it until your mod unloads: regeneration goes up to it and each hunt starts with it.
Parameter Type
health optional number since API 3: his full health from now on (1-100000); nil = 128 again
Returns
number his full health
# player.alive () → boolean
Whether the hunter is alive (false outside a hunt).
# player.ammo (slot? ) → integer?, integer?
A weapon's ammunition; nothing outside a hunt, without a weapon in hand, or for the photo camera.
Parameter Type
slot optional integer a weapon slot (default: the one in hand)
Returns
integer? the ammunition left (what the HUD shows)
integer? the rounds loaded
copy local total, loaded = player .ammo()
if total then draw .text(20 , 20 , loaded .. " / " .. total) end
# player.aim (distance? ) → string?, number?, number?, number?, Creature?
hunt only
What is under the crosshair: a ray from the hunter's eyes along his view.
Parameter Type
distance optional number how far to look (default 20000)
Returns
string? "terrain", "water", "object" or "creature" (nothing when nothing is hit)
number? x of the point hit
number? y
number? z
Creature? the creature hit
copy local kind, x, y, z, c = player .aim()
if c then draw .text(20 , 60 , "Target: " .. c.name, "white" , 20 ) end
# player.eye () → number, number, number
hunt only
Where the hunter's eyes (the camera) are.
Returns
number x
number y
number z
# player.credits () → integer
The player's credits (the hunt menu's money).
# player.addCredits (n ) → integer
Gives or takes credits (kept with the game's save): rewards, shops, bets.
Parameter Type
ninteger credits to give; negative takes (not below 0)
Returns
integer the new amount
copy on ("kill" , function (e) if e.byHunter then player .addCredits(25 ) end end )
# player.camouflage (on? ) → boolean
hunt only
The camouflage item: creatures see the hunter worse.
Parameter Type
on optional boolean switch it on / off
Returns
boolean whether it is on
# player.scent (on? ) → boolean
hunt only
The cover-scent item: creatures smell the hunter worse.
Parameter Type
on optional boolean switch it on / off
Returns
boolean whether it is on
# player.slot (n? ) → WeaponSlot|nil
since API 3
A weapon slot of the hunter (player.weapon() stays the slot number).
Parameter Type
n optional integer a slot 0-7 (default: the weapon in hand)
copy local s = player .slot()
if s then s.ammo = s.ammo + 10 end
# player.weapons () → table
since API 3
The slots he carries this hunt.
Returns
table WeaponSlot list in the chooser's order
# player.setWeapon (n )
hunt only
since API 3
Changes the weapon through the game's own change (the one in hand is put away first; weapon_change fires).
Parameter Type
ninteger a slot he carries
# player.velocity () → number, number, number
hunt only
since API 3
How fast he moves (the game's own velocities).
Returns
number forward (units/s)
number sideways
number vertical
# player.underwater () → boolean
hunt only
since API 3
Under water (drowning, no call, weapon put away).
# player.breath () → number
hunt only
since API 3
How long he has been under water.
# player.scanned () → Creature|nil
hunt only
since API 3
The creature under the binocular or camera crosshair.
# player.killer () → string?, Creature?
hunt only
since API 3
After his death: what killed him (nothing while he lives).
Returns
string? the species id, "drowning" or "fog"
Creature? the creature
# player.kick (amount )
hunt only
since API 3
A recoil kick of the camera.
Parameter Type
amountnumber camera units (a rifle shot: 64)
# player.jump (speed? )
hunt only
since API 3
Launches him upwards (gravity takes him).
Parameter Type
speed optional number upward speed (default: his standing jump, 800 x jumpPower)
# player.speed (k? ) → number
since API 3
A factor on his walking and swimming speed. Kept until your mod unloads (every hunt); nil puts the game's value back.
Parameter Type
k optional number 0-20 (nil = 1)
# player.runScale (k? ) → number
since API 3
A factor on the forward speed factor (balance PLAYER_FORWARD_SPEED_SCALE). Kept until your mod unloads (every hunt); nil puts the game's value back.
Parameter Type
k optional number 0-20
# player.jumpPower (k? ) → number
since API 3
A factor on his jumps (800 + forward speed x 800). Kept until your mod unloads (every hunt); nil puts the game's value back.
Parameter Type
k optional number 0-20
# player.gravity (g? ) → number
since API 3
Gravity (3000). Kept until your mod unloads (every hunt); nil puts the game's value back.
Parameter Type
g optional number units/s² (0-100000)
# player.eyeHeight (h? ) → number
since API 3
His standing eye height (256). 180 or lower is a crouch: creatures see him worse (the game's own rule), shots start lower. Kept until your mod unloads (every hunt); nil puts the game's value back.
Parameter Type
h optional number 16-2048
# player.regenRate (r? ) → number
since API 3
Regeneration (4/s). Kept until your mod unloads (every hunt); nil puts the game's value back.
Parameter Type
r optional number health per second
# player.drownRate (r? ) → number
since API 3
Health lost per second under water (12). Kept until your mod unloads (every hunt); nil puts the game's value back.
Parameter Type
r optional number
# player.fogRate (r? ) → number
since API 3
Health lost per second in poisonous fog (64). Kept until your mod unloads (every hunt); nil puts the game's value back.
Parameter Type
r optional number
# player.evacuate () → boolean, string?
hunt only
since API 3
Starts the evacuation as the in-game menu's exit does (credits are paid at its end).
Returns
boolean true when it started
string? why not
# player.relocate (x , z ) → boolean, string?
hunt only
since API 3
Relocates him as the map's RELOCATE button: the cooldown, a relocation of the profile (Dinosaur Hunter), the fade. The target is kept inside the map.
Parameter Type
xnumber
znumber
Returns
boolean true when it started
string? why not
copy local ok, why = player .relocate(120000 , -130000 )
if not ok then game .message(why) end
# player.resupply () → boolean, string?
hunt only
since API 3
A resupply as the RESUPPLY button (one of hunt.resupplies; not in water unless hunt.rules.resupplyInWater).
Returns
boolean true when the supply ship comes
string? why not
# player.fields () → table
since API 3
Every member of the hunter's struct (the raw layer).
Returns
table FieldInfo list
# player.get (name ) → any
since API 3
One member (nothing outside a hunt).
copy print (player .get("breath" ))
# player.set (name , value )
hunt only
since API 3
One member (health: above 0, at most maxHealth).
Parameter Type
namestring
valueany