Community Forum

"lastFoundObject" variable in MP

Forum Overview >> Scripting

CategoryScripting
Created13.04.2017 22:37


Simon Lus (notallowed) 13.04.2017 22:39
Hello,

I have a simple question what is multiplayer equivalent for "g_currentMission.player.lastFoundObject"?

I am trying to get object which player has in range and can pickup.

I am printing tables of g_currentMission to log but it seems I can't find anything related to this o.O

Thx,
50keda

Emil Drefers (Unknown) 18.04.2017 06:54
Hi,

this variable holds an "objectId" (or "nil"), depending on what the player looks at.
So, for example if a player looks at a piece of wood this variable should have a valid value.
This variable is synchronised from the server to the clients.

Cheers,
Emil

Simon Lus (notallowed) 21.04.2017 00:08
Hi Emil,

first thank you for a response.

Well yeah meaning of it is quite self explanatory, however it doesn't appear that variable is synchronised (at least not in my case). Because I was intending to use this in my script, however there was a problem in multiplayer, as this variable was always nil. My condition looked like:
if g_currentMission.player.isObjectInRange then
if g_currentMission.player.lastFoundObject ~= nil then
-- my code doing sth with this object
end
end

Emil Drefers (Unknown) 24.04.2017 07:06
Hi,

sorry my bad, I did not look close enough.

So,
'lastFoundObject' is not sync'ed, but
'isObjectInRange', 'lastFoundObjectMass', 'isCarryingObject' are sync'ed

If you really need 'lastFoundObject' you could extend the Player script to synchronize that variable too.

Cheers,
Emil




Note: Log in to post. Create a new account here.