In Skyrim Multiplayer there are no dedicated clientside scripts. Code snippets that runs client-side are passed as strings to makeProperty
, updateOwner
and updateNeighbor
which are described in Serverside Scripting Reference.
Refers to Skyrim Platform API. See Skyrim Platform page.
// Print to console
ctx.sp.printConsole("Hello Skyrim Platform!");
// Kill player character (locally)
ctx.sp.Game.getPlayer().kill();
In makeProperty
is always undefined
.
In updateOwner
is similar to ctx.sp.Game.getPlayer()
.
In updateNeighbor
refers to neighbor synchronized ObjectReference
or Actor
.
const pos = [
ctx.refr.getPositionX(),
ctx.refr.getPositionY(),
ctx.refr.getPositionZ()
];
In makeProperty
is always undefined
.
In updateOwner
/ updateNeighbor
is equal to the value of a property that is processed currently or undefined
if there is no value or it's not visible due to flags.
ctx.sp.Game.setPlayerLevel(ctx.value || 1);
A writable object that is used to store data between updateOwner
/updateNeighbor
calls or makeProperty
initializations.
state
is currently shared between properties.
ctx.state.x = "y";
Get the value of the specified property. Built-in properties are not supported properly, so attempts getting them are leading to the undefined behavior.
const v = ctx.get("myAwesomeProperty");
Gets serverside formId by clientside formId or 0
if not found.
const serversideFormId = ctx.getFormIdInServerFormat(0xff00016a);
Opposite to getFormIdInServerFormat
. Gets clientside formId by serverside formId or 0 if not found.
const clientsideFormId = ctx.getFormIdInClientFormat(0xff000000);
Respawns ctx.refr
immediately.
ctx.respawn();
Available only in makeProperty
context. Sends an event to the server.
ctx.sendEvent({ foo: 'bar' });