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 () → number
The hunter's 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