Game Development Reference
In-Depth Information
The PositionUpdate event
Instead of directly looking up a teammate's position within the sandbox, we can message
out periodic updates as teammates move around the environment. As our move behavior
only executes every half second, we can update teammates on the agent's position once the
behavior has terminated:
AgentCommunications.lua :
AgentCommunications.EventType.PositionUpdate =
"PositionUpdate";
SoldierActions.lua :
local function SendPositionUpdate(sandbox, agent, position)
AgentCommunications_SendTeamMessage(
sandbox,
agent,
AgentCommunications.EventType.PositionUpdate,
{ agent = agent, position = position });
end
function SoldierActions_PursueCleanUp(userData)
SendPositionUpdate(
userData.agent:GetSandbox(),
userData.agent,
userData.agent:GetPosition());
end
Search WWH ::




Custom Search