Client to Server Call and Vice Versa Example

-- FIRST, Client -> Server call
-- Client Context (send): 
Events.BroadcastToServer("Build", _ob, _spawnPos)

-- Server Context (receive):
function Build(player,data,pos)
    if(data == "ush" or data == "planta" or data == "plant1")then
        _oOffset = pos + Vector3.New(0,0,70)
        print ("[",data,"] @ ",_oOffset)
        World.SpawnAsset(plant1_SpawnTemplate, {position = _oOffset})

    elseif(data == "coins" or data == "gold" or data == "manticoin" or data == "coin")then
        _oOffset = pos + Vector3.New(0,0,140)
        print ("[",data,"] @ ",_oOffset)
        World.SpawnAsset(coin_SpawnTemplate, {position = _oOffset})
end
 Events.ConnectForPlayer("Build", Build)
 
 
 
 
 -- Now, Server -> Client call
 -- Server Context (send): 
Events.BroadcastToAllPlayers("ClientAction")

-- Client Context (receive): 
function ClientAction() -- testing call from Server
    UI.PrintToScreen("change block..")
    --World.FindObjectByName("bwob").visibility = Visibility.FORCE_OFF
    --World.FindObjectByName("bwob2"):SetPosition(Vector3.New(33,33,33))    
end
Events.Connect("ClientAction", ClientAction)

Latest Posts

Emulation ProcessEmulation Process

  Record Locs for Emulation in Core Grab data. Here, I am recording x,yz, and name data to emulate. Next Convert to usable array for Core template data. Snippet>> Pattern  Core template replacement pattern: Path:[C:\Users\soandso\Documents\My Games\CORE\Saved\Maps\mycoregame\Data\Tree\Emulator_