This function is used to remotely spawn an object on the host side from a client without waiting.
Sends a spawn entity request to the host. The host spawns the object.
This function is used to remotely spawn an object on the host side from a client with waiting.
Sends a spawn entity request to the host. The host spawns the object. The client catches the event
and calls functa(se_object)
Example:
{
alife_create_awaite(function(se)
if se then
log("Object box spawned: "..box:section_name())
end
end, "box", db.actor:position(), 0, 0)
}
alife_release_client(se_object)
This function is used to remotely despawn an object on the host side from a client by se_object.
Sends a despawn entity request to the host. The host despawns the object.
Example:
alife_release_client(alife_object(55))
alife_release_client_id(id)
This function is used to remotely despawn an object on the host side from a client by id.
Sends a despawn entity request to the host. The host despawns the object.
Example:
alife_release_client_id(55)
Player manager functions
TeleportPlayer(u32 NetID, Fvector Position)
This function is used to teleport a player to a position. THIS IS A HOST ACTION!
Check lua_help_mp.lua to understand what you want to do.
Example:
{
local GameManager = SteamGameManager()
local PlayerManager = GameManager:GetPlayerManager()
local pdata = PlayerManager:GetPlayerDataAtIndex(1) -- HOST IS 0
if pdata then
local id = pdata:GetNetID()
local pos = db.actor:position()
PlayerManager:TeleportPlayer(id, pos)
end
}
This function is used to teleport a player to a position or level. THIS IS A HOST ACTION! Advanced
version.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
local GameManager = SteamGameManager()
local PlayerManager = GameManager:GetPlayerManager()
local pdata = PlayerManager:GetPlayerDataAtIndex(1) -- HOST IS 0
if pdata then
local id = pdata:GetNetID()
local pos = db.actor:position()
local lvid = db.actor:level_vertex_id()
local gvid = db.actor:game_vertex_id()
PlayerManager:SendToAnotherLevel(id, pos, gvid, lvid, db.actor:direction())
end
}
KickPlayer(u32 NetID)
This function is used to kick a player. THIS IS A HOST ACTION!
Check lua_help_mp.lua to understand what you want to do.
Example:
{
local GameManager = SteamGameManager()
local ServerSOSOCK = SteamServer()
local PlayerManager = GameManager:GetPlayerManager()
local pdata = PlayerManager:GetPlayerDataAtIndex(1) -- HOST IS 0
if pdata then
local id = pdata:GetNetID()
PlayerManager:KickPlayer(id)
else
local NETid = ServerSOSOCK:get_player_by_index(1) -- HOST IS 0
PlayerManager:KickPlayer(NETid)
end
}
Weather and time synchronization functions
OnTimeChanged()
This function is used to synchronize time with clients.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
local GameManager = SteamGameManager()
GameManager:OnTimeChanged()
}
OnWeatherChanged()
This function is used to synchronize weather with clients.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
local GameManager = SteamGameManager()
GameManager:OnWeatherChanged()
}
OnWeatherFXChanged()
This function is used to synchronize weather effects with clients.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
local GameManager = SteamGameManager()
GameManager:OnWeatherFXChanged()
}
Custom actions synchronization functions
OnICustomScriptAction()
This function is used to send custom action to clients.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
local GameManager = SteamGameManager()
GameManager:OnICustomScriptAction("ui_sleep_dialog.sleep_test", false)
}