Community Forum

g_currentMission documentation

Forum Overview >> Scripting

CategoryScripting
Created02.06.2016 13:23


Pascal Stahl (Unknown) 02.06.2016 13:25
Can i look up what i can access through g_currentMission.something? I am new to FS15-scripting and i just want to know my own coordinates and print them

thanks in advance

Emil Drefers (Unknown) 03.06.2016 07:14
Hi,

you could cycle through a table and print its items ...

Anyhow, whwat do you mean with "my own coordinates"?

The position of you, the player taking a walk?
Or the vehicle's position which is controlled by you?

Cheers,
Emil

Pascal Stahl (Unknown) 07.06.2016 08:58
"you could cycle through a table and print its items ... "
pretty obvious, thank you :-D

"Anyhow, whwat do you mean with "my own coordinates"?
The position of you, the player taking a walk?
Or the vehicle's position which is controlled by you?"

I Think both would be interesting but i want to know the coordinates of the vehicle which is controlled by me. I am currently searching for a function or a variable to access them but i canĀ“t find it.



Emil Drefers (Unknown) 08.06.2016 06:55
Hi,

that's why I wanted you to have a closer look at the g_currenttMission table:
g_currentMission.controlledVehicle

local x,y,z = getWorldTranslation(g_currentMission.controlledVehicle.components[1].node);

Cheers,
Emil


R Harris (Rambow145) 24.03.2017 01:54
Hi, can you help me with this I am really new to lua and I have gotten this far but I have been working on this for around 7 hours and still clueless what this means.

Warning (LUA): 'link': Argument 1 has wrong type. Expected: Int. Actual: Table
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (624): expectedType == Value::VoidType || expectedType == Value::ObjectType
LUA call stack:
=C:/Users/Harris/Documents/My Games/FarmingSimulator2017/mods/winch/winch.lua (301) : link
dataS/scripts/vehicles/Vehicle.lua (2598) : update
dataS/scripts/network/Server.lua (56) : update
dataS/scripts/BaseMission.lua (1508) : update
dataS/scripts/FSBaseMission.lua (2171) : update
dataS/scripts/missions/mission00.lua (333) : update
dataS/scripts/main.lua (1876) : update

The line 301 link(g_currentMission.player.cameraId, self.w.searchNodes.center);

This is for fs 17 mod.

Thanks a bunch ;)

Rambow145



Emil Drefers (Unknown) 24.03.2017 07:13
Hi,

that's hard to say, because by dfeault there is no variable/table stored in the player table which is called cameraId.
I'ld say you have to check what you are doing in your mod.

So, in general the function link() will change the hierachy by setting the second argument as a child of the first argument.
Obviously both arguments must point to a scene graph object.

Cheers,
Emil

R Harris (Rambow145) 24.03.2017 09:24
Ok, Thanks so much for getting back to me.

Most of the time I can work stuff out.

Thanks again

Rambow145


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