IMIsle Modkit
Pages in this area

All natives

191 functions, methods and events across every namespace.

modkit.acl.setGroupserver
modkit.acl.setGroup(name, group)
Replaces the group when it exists. Members stay.
modkit.acl.removeGroup, groupsserver
modkit.acl.addMember, removeMemberserver
modkit.acl.groupsOf, membersOfserver
modkit.acl.allowedserver
modkit.acl.allowed(player, permission)
The same check as a method is player:hasPermission(permission).
modkit.ai.speciesserver
modkit.ai.species()
modkit.ai.spawnserver
modkit.ai.spawn(species, x, y, z [, options])
modkit.ai.despawnserver
modkit.ai.despawn(handle)
modkit.ai.list, countserver
modkit.ai.censusserver
modkit.ai.census()
Counts every AI controlled character in the world, including the game's own AI.
modkit.ai.wipeserver
modkit.ai.wipe()
Destroys every AI controlled character in the world, the game's own AI included. The game spawns new AI afterwards as usual.
Brainsserver
senses
A brain describes how an animal senses, moves, picks targets, fights, flees, behaves in a group and when it disappears. An animal with a brain keeps its body, its pathfinding and i
modkit.ai.defineBrainserver
modkit.ai.defineBrain(name, definition)
Defining a name again replaces the brain. Animals that already run on it use the new values from their next think step.
modkit.ai.getBrain, brainsserver
modkit.ai.removeBrainserver
modkit.ai.removeBrain(name)
Removes a brain that a script defined. When brains.json holds a brain of the same name, that one takes over and the animals keep running. When only the file has the name, the file
modkit.ai.reloadserver
modkit.ai.reload()
Loads brains.json and spawns.json again right away. A file with broken JSON is skipped with a log line and the brains and spawners from before stay. A brain in the file with an unk
modkit.ai.setBrainserver
modkit.ai.setBrain(id, name)
The home point is the place where the animal stands at that moment. Change it with setHome.
modkit.ai.infoserver
modkit.ai.info(id)
An animal without a brain gives a short table with id, species, health, maxHealth, x, y, z. Test info.brain to tell the two apart.
modkit.ai.moveToserver
modkit.ai.moveTo(id, x, y, z [, gait])
Sends the animal to a point. The state is scripted until it arrives or 120 seconds passed. After that the brain decides again. gait is "walk", "trot" or "sprint", default is the br
modkit.ai.followserver
modkit.ai.follow(id, target [, distance])
The animal follows the target and keeps distance (default 600). It walks when it is close, trots when it falls behind and sprints when it is far behind. The state stays scripted un
modkit.ai.attackserver
modkit.ai.attack(id, target)
Forces chase on this target, whatever the brain's targets and aggression say. A forced chase ignores the leash, memorySeconds and fleeHealth. It ends when the target is dead or gon
modkit.ai.fleeserver
The animal runs away from a target or from a point. seconds defaults to the brain's fleeSeconds.
modkit.ai.holdserver
modkit.ai.hold(id [, seconds])
The animal stops and stands still, in the state scripted. Without seconds it holds until release or another command.
modkit.ai.releaseserver
modkit.ai.release(id)
Ends scripted. The brain decides again.
modkit.ai.setHomeserver
modkit.ai.setHome(id, x, y, z [, roamRadius])
Moves the home point of one animal. roamRadius replaces the brain's movement.roamRadius for this animal.
modkit.ai.abilities, useAbilityserver
modkit.ai.addSpawner, removeSpawner, spawnersserver
A spawner fills up in groups of pack.size of its brain, one group per second. Each group spawns at a random point inside radius. That point is the home of the group, and its animal
modkit.ai.setSpeciesBrain, speciesBrainsserver
The plugin looks for new wild animals every 10 seconds. A wild animal that got a brain has a handle from then on and shows up in modkit.ai.list.
modkit.bans.addserver
modkit.bans.removeserver
modkit.bans.remove(player)
modkit.bans.isBannedserver
modkit.bans.isBanned(player)
modkit.bans.listserver
modkit.bans.list()
player:banserver
modkit.chat.broadcastserver
modkit.chat.broadcast(text [, sender])
Shows a chat line to every player.
player:messageserver
Chat line to one player. See player:message.
Event: chatserver
chat(player, text, mode)
Fires when a player sends a chat message that is not a registered command.
Event: chatCommandserver
chatCommand(player, line)
Fires for every line that starts with / or !, and for the game's own chat command call. It fires before the command table is searched, for known and unknown commands.
modkit.commands.addserver
Registers a command that players run with /name or !name in the chat, or with name in the F8 console of the launcher client.
modkit.commands.removeserver
modkit.commands.remove(name)
Removes a command of the calling resource.
modkit.commands.listserver
modkit.commands.list()
See also the chat commands guide.
modkit.config.getserver
modkit.config.get(name [, default])
modkit.config.getNumberserver
modkit.config.getNumber(name [, default])
printshared
print(...)
Writes one log line with the resource name in front. The values are converted with tostring and joined with two spaces.
modkit.logshared
Log line: [myresource] WARN no webhook configured
modkit.isAdminserver
modkit.isAdmin(steamId)
modkit.events.addshared
modkit.events.add(name, fn)
Several handlers per name are allowed. They run in the order they were added. An error in one handler is logged and does not stop the others.
modkit.events.removeshared
modkit.events.remove(name, fn)
Removing a handler while its event is being dispatched is safe. The running dispatch still finishes with the old list.
modkit.events.callshared
modkit.events.call(name, ...)
Fires an event on the same side, in every loaded resource including your own. Use it to let resources talk to each other. The arguments are copied through JSON, so only strings, nu
modkit.events.callRemoteclient
modkit.events.callRemote(name, ...)
Sends an event to the server scripts. The server handler receives the sender's player table first, then the arguments. Nothing is sent while the script link is down.
modkit.events.callAllserver
modkit.events.callAll(name, ...)
Sends an event to the client scripts of every player.
modkit.exports.registerserver
modkit.exports.register(name, fn)
modkit.exports.callserver
modkit.exports.call(resource, name, ...)
Raises an error when the resource is not running, the export does not exist, or the exported function fails. The message of the inner error is part of the new one. Use pcall when t
modkit.exports..server
modkit.exports.listserver
modkit.exports.list(resource)
modkit.game.localPlayerclient
modkit.game.localPlayer()
modkit.game.charactersclient
modkit.game.characters()
The call walks through all game objects. Use it on a timer of a few seconds, not every tick.
modkit.game.cameraclient
modkit.game.camera()
modkit.game.worldToScreenclient
modkit.game.worldToScreen(x, y, z)
Projects a world position onto the screen with the engine's ProjectWorldLocationToScreen.
modkit.game.screenSizeclient
modkit.game.screenSize()
modkit.game.materialCountclient
modkit.game.materialCount([char])
modkit.game.materialParamsclient
modkit.game.materialParams([char [, slot]])
Lists the parameters that the material instances of one slot override, walking up the parent chain.
modkit.game.setMaterialColorclient
modkit.game.setMaterialColor(char, slot, param, r, g, b [, a])
Sets a vector parameter. The first call on a slot creates a dynamic material instance for it.
modkit.game.setMaterialScalarclient
modkit.game.setMaterialScalar(char, slot, param, value)
modkit.game.setMaterialTextureclient
modkit.game.setMaterialTexture(char, slot, param, file)
Loads an image from your resource and sets it as a texture parameter. The image is decoded once per file and then reused.
modkit.garage.parkserver
modkit.garage.park(player [, options])
modkit.garage.restoreserver
modkit.garage.restore(player, slotId [, options])
The function returns right after step 0. Use the garageRestored event to know when it finished.
modkit.garage.listserver
modkit.garage.list(player)
modkit.garage.get, remove, renameserver
All three accept a player table in place of the Steam ID.
modkit.garage.giveserver
modkit.garage.give(steamId, state [, options])
Puts a dinosaur into a player's garage, for shops and rewards. The player does not have to be online.
modkit.garage.setLimit, getLimit, setLimitCallbackserver
modkit.http.requestserver
modkit.http.request(options [, callback])
The callback gets one table.
modkit.http.get, post, postJsonserver
Short forms of request. postJson encodes value with modkit.json.encode and sets Content-Type: application/json.
modkit.http.pendingserver
modkit.http.pending()
modkit.json.encodeshared
modkit.json.encode(value)
Rules.
modkit.json.decodeshared
modkit.json.decode(text)
Invalid JSON raises a Lua error. Wrap the call in pcall when the text comes from a player or a file that may be damaged.
modkit.keys.onclient
modkit.keys.on(key, fn)
modkit.keys.offclient
modkit.keys.off(id)
Removes a binding.
modkit.keys.isDownclient
modkit.keys.isDown(key)
modkit.nests.listserver
modkit.nests.list()
modkit.nests.destroyserver
modkit.nests.destroy(id)
modkit.nests.destroyAllserver
modkit.nests.destroyAll([species])
For automatic cleanup of blocked species see modkit.population.setEggCleanup.
modkit.net.connectedclient
modkit.net.connected()
modkit.net.playerIdclient
modkit.net.playerId()
modkit.net.steamIdclient
modkit.net.steamId()
modkit.browser.addclient
modkit.browser.add(url)
Opens a page and returns a browser object. The page covers the whole screen. It is click-through until you give it focus.
modkit.gui.cursor.showclient
modkit.gui.cursor.show(freeze [, visible])
Turns the mouse cursor on or off. Pages only receive input while the cursor is on.
modkit.gui.cursor.visibleclient
modkit.gui.cursor.visible()
modkit.gui.notifyclient
modkit.gui.notify(text)
Shows the game's own notification on this client. It calls ClientShowNotification on the local player controller, the same function the server uses for player:notify.
modkit.players.listserver
modkit.players.list()
modkit.players.getserver
modkit.players.get(key)
modkit.players.countserver
modkit.players.count()
player:messageserver
player:message(text [, sender])
Shows a chat line to this player only.
player:notifyserver
player:notify(text)
Shows the game's own notification to this player (ClientShowNotification).
player:announceserver
player:announce(text [, title [, seconds]])
Shows the game's announcement banner to this player (Client_ProcessIncomingAnnouncement).
player:printserver
player:print(text)
Writes a line into the F8 console of this player. Does nothing while the script link of that player is down. The F8 console is off by default, ISLEMODKIT_CONSOLE=1 in the environme
player:callserver
player:call(event, ...)
Sends an event to the client scripts of this player. Does nothing while the script link of that player is down. See the events guide for the argument rules.
player:kickserver
player:kick([reason])
Kicks the player from the game server and closes the script link.
player:teleportserver
player:teleport(x, y, z [, yaw])
Moves the player's dinosaur. Without yaw it calls K2_SetActorLocation. With yaw it calls K2_SetActorLocationAndRotation and keeps pitch and roll. There is no collision sweep and no
player:posserver
player:pos()
player:rotationserver
player:rotation()
Reads the rotation of the dinosaur at the moment of the call.
player:setHealth, setHunger, setThirst, setStaminaserver
Sets one stat of the dinosaur and forces a network update so the client sees it at once.
player:setGrowthserver
player:setGrowth(value)
player:killserver
player:kill()
Kills the dinosaur on the server. It sets health to zero and calls the game's SpecialDeathFromServer.
player:setSkinserver
player:setSkin(skin)
Changes the colors and pattern slots of the dinosaur. All players see the result. The skins guide explains zones and color formats.
player:getSkinserver
player:getSkin()
modkit.players.findserver
modkit.players.find(text)
player:healserver
player:heal()
Sets health to the maximum, clears venom and heals fractures of legs, body and head.
player:restoreStatsserver
player:restoreStats()
Everything heal does, plus hunger, thirst, stamina and blood to their maximum, locked damage to zero and the three diet values filled.
player:damageserver
player:damage(amount)
Takes health away. When the health would reach zero the player is killed the same way as with player:kill().
player:setGod, isGodserver
Twice per second the server sets the health back to the maximum and clears locked damage. It is a fast heal, not true invulnerability. A single hit that takes more than the full he
player:setInfiniteStaminaserver
player:setInfiniteStamina(enabled)
Refills the stamina twice per second while it is on. Lasts until you switch it off or the server restarts.
player:getStatusserver
player:getStatus()
Reads values that are not part of the player snapshot. This asks the game directly, so call it when you need it and not for every player every second.
player:setPrimeserver
player:setPrime(value)
player:getMutationsserver
player:getMutations()
The values are the internal mutation names of the game. Read them from a dinosaur that has the mutation.
player:setMutationsserver
player:setMutations(slots)
The server adds the names to the unlocked list, writes parent and elder slots at once and the four active slots half a second later, because the game drops active slots that are wr
player:getNutrients, setNutrients, fillDietserver
All three return nil or false without a dinosaur.
player:setGrowthMultiplier, freezeGrowthserver
Growth speed of one player. 2 grows twice as fast, 0.5 half as fast. freezeGrowth(true) stops growth. The setting belongs to the Steam ID, it is applied again after every respawn a
player:groupMembers, inSameGroupserver
player:distanceToserver
player:setScaleserver
player:setScale(scale)
Scales the visible mesh of the dinosaur, 0.1 to 100. Hitboxes and the camera stay as they are. The scale is lost on respawn.
player:setSpeciesserver
player:setSpecies(species [, growth])
Turns the player into another species on the spot. The server spawns the new dinosaur 3 m above the old one, moves the Steam ID over, lets the controller possess it and destroys th
player:setCustomSpecies, getCustomSpeciesserver
player:getStateserver
player:getState()
player:applyStateserver
player:applyState(state [, options])
Writes a state onto the dinosaur the player plays now. The species must match state.species. It runs the same four steps as a garage restore, see garage. The event stateApplied(pla
player:hasPermissionserver
player:hasPermission(permission)
player:banserver
player:ban([reason [, hours]])
Adds the player to the ban list and kicks them. hours of 0 or nothing means forever.
modkit.population.setEnabledserver
modkit.population.setEnabled(enabled)
Switching it off puts every cooked species back on the select screen.
modkit.population.isEnabledserver
modkit.population.isEnabled()
modkit.population.setAutoThresholdserver
modkit.population.setAutoThreshold(players)
modkit.population.setRuleserver
modkit.population.setRule(species, rule)
modkit.population.enableSpecies, disableSpeciesserver
Short forms of setRule(species, { enabled = true }) and setRule(species, { enabled = false }). A cap that was set before stays.
modkit.population.getRule, clearRule, rulesserver
modkit.population.distributionserver
modkit.population.distribution()
modkit.population.blocked, isBlockedserver
Both return nothing blocked while the lock is not active.
modkit.population.speciesserver
modkit.population.species()
modkit.population.setExempt, isExemptserver
An exempt player gets the full list about half a second after opening the select screen. The list is not saved, set it again after a server restart.
modkit.population.setEggCleanupserver
modkit.population.setEggCleanup(enabled)
With true the server destroys the nests of blocked species every 5 seconds while the lock is active. That closes the way around the lock through eggs. The search walks all game obj
modkit.population.applyserver
modkit.population.apply()
Evaluates the rules now instead of waiting for the next check.
modkit.resources.file (server)server
modkit.resources.file(path)
Reads a file from the folder of the calling resource on the server's disk.
modkit.resources.saveserver
modkit.resources.save(path, text)
Writes a file into the folder of the calling resource. The content goes to <path>.tmp first and then replaces the target, so a crash during the write keeps the old file.
modkit.resources.file (client)client
modkit.resources.file(path)
Returns a file that the server delivered for the calling resource. The client keeps these files in memory, there is no disk access.
modkit.roster.addserver
modkit.roster.add(name, classPath [, diet])
modkit.roster.removeserver
modkit.roster.remove(name)
Hides a species. Works for base game species and for your own entries. The name is compared without case.
modkit.roster.listserver
modkit.roster.list()
Definition fieldsserver
visual
Every field is optional except host. A missing field has its default. Distances are Unreal units (100 per metre), times are seconds, shares go from 0 to 1, angles are degrees.
modkit.species.listserver
modkit.species.list()
modkit.species.getserver
modkit.species.get(name)
modkit.species.reloadserver
modkit.species.reload()
Loads every species.json again right away. A file with broken JSON is skipped with a log line, and the definition from before stays. A bad value in a file is replaced by its defaul
modkit.species.defineserver
modkit.species.define(name, definition)
Defines a species for as long as the server runs. Nothing is written to disk. The model and the animations must already be in a pak under client-mods, named after the species. An u
modkit.species.playersserver
modkit.species.players(name)
player:setCustomSpeciesserver
player:setCustomSpecies(name [, force])
Gives the player the species, or removes it with nil. When the player plays another species than the host right now, the server first turns them into the host with player:setSpecie
player:getCustomSpeciesserver
player:getCustomSpecies()
The player table also carries customSpecies with the same value.
modkit.storage.getserver
modkit.storage.get(key [, default])
modkit.storage.setserver
modkit.storage.set(key, value)
modkit.storage.deleteserver
modkit.storage.delete(key)
modkit.storage.keys, allserver
modkit.storage.saveserver
modkit.storage.save()
Hands the store to the writer thread now instead of after the two second wait.
modkit.setTimeoutshared
modkit.setTimeout(ms, fn)
Runs fn once after ms milliseconds.
modkit.setIntervalshared
modkit.setInterval(ms, fn)
Runs fn every ms milliseconds until it is cleared. With ms = 0 it runs on every timer check.
modkit.clearTimershared
modkit.clearTimer(id)
Stops a timeout or an interval. Unknown ids are ignored. A timer can clear itself from inside its function.
modkit.util.distanceshared
modkit.util.distance2dshared
Same as distance without the height.
modkit.util.randomshared
modkit.util.random([min, max])
modkit.util.round, clampshared
modkit.util.formatTimeshared
modkit.util.formatTime(seconds)
modkit.util.uuidshared
modkit.util.uuid()
modkit.whitelist.setEnabled, isEnabledserver
Players who are already on the server stay when you switch it on.
modkit.whitelist.add, remove, has, listserver
modkit.reserved.setSlots, getSlotsserver
The server size comes from sv_maxplayers in server.cfg. With 40 slots and 2 reserved, player number 39 and 40 must be on the reserved list. The plugin does not change the player li
modkit.reserved.add, remove, has, listserver
Same behaviour as the whitelist functions, for the reserved list.
modkit.world.getTimeserver
modkit.world.getTime()
The value is the sky actor's TimeOfDayIsle divided by 100. 1200 in the game is noon, which is 12.0 here.
modkit.world.setTimeserver
modkit.world.setTime(hours)
The day keeps running from the new time. There is no function to freeze the time yet.
modkit.world.getWeatherserver
modkit.world.getWeather()
The numbers are the raw values of Ultra Dynamic Weather.
modkit.world.weatherPresetsserver
modkit.world.weatherPresets()
This scans every object in the game. Call it once in a command, not in a timer.
modkit.world.setWeatherserver
modkit.world.setWeather(preset [, seconds])
Calls the Change Weather function of the weather actor.
modkit.world.announceserver
modkit.world.announce(text [, title [, seconds]])
Shows the game's announcement banner to every player.
modkit.world.notifyserver
modkit.world.notify(text)
Shows the game's notification to every player.
modkit.world.clearSkyserver
modkit.world.clearSky([seconds])
Switches to the first weather preset whose name contains clear. seconds is the transition time, default 30.
modkit.world.setWeatherCycle, stopWeatherCycleserver
Runs through a list of weather presets and starts again at the end. The cycle replaces a cycle that is already running. It starts with the first step within one second.
modkit.world.setNightBrightnessserver
modkit.world.setNightBrightness(value)
Calls the game mode's SetBrightness for the night. 1 is the game's default, higher is brighter. nil goes back to 1. The server sends the value again every 30 seconds so that player
modkit.world.setDayLength, getDayLength, resetDayLengthserver
modkit.world.freezeTimeserver
modkit.world.freezeTime(frozen)
modkit.world.setGrowthMultiplierserver
Growth speed for every player who has no own setting from player:setGrowthMultiplier. 1 is normal. The value is not saved, set it when your resource starts.
modkit.world.spawnMeshserver
modkit.world.spawnMesh(path, x, y, z [, rotation [, scale [, material]]])
Spawns a static mesh actor that every player sees.
modkit.world.spawnBlueprintserver
modkit.world.spawnBlueprint(path, x, y, z [, rotation [, scale]])
Same as spawnMesh for a blueprint actor class, /Game/.../BP_Name.BP_Name_C.
modkit.world.moveObject, deleteObject, objectsserver
modkit.zones.addserver
modkit.zones.add(zone)
modkit.zones.remove, clearserver
modkit.zones.get, listserver
The table has the fields you passed to add.
modkit.zones.atserver
modkit.zones.at(x, y [, z])
modkit.zones.playersInserver
modkit.zones.playersIn(name)