Community Forum

addVehicle - removeVehicle

Forum Overview >> Scripting

CategoryScripting
Created19.09.2015 23:49


Dirk Peeters (Unknown) 20.09.2015 00:11
hi,

i'm looking how to spawn a vehicle as vehicle and not a object.
what parameters i need to insert into Utils.loadSharedI3DFile() or Utils.loadI3DFile() ?

i found some code in scripts like
Utils.loadSharedI3DFile(file, baseDirectory, true, true, true, self.loadFinished, self, {xmlFile, positionX, offsetY, positionZ, yRot, asyncCallbackFunction, asyncCallbackObject, asyncCallbackArguments});

or

Utils.loadSharedI3DFile(i3dFilename);

assume i use this code to get my model and xml info

local i3dFilename = i3dFilename;
local customEnvironment, baseDirectory = Utils.getModNameAndBaseDirectory(i3dFilename);
local xmlFile = Utils.getFilename("mod.xml", baseDirectory);

Utils.loadSharedI3DFile(i3dFilename, baseDirectory, true, true, true,?, ?, {xmlFile, positionX, offsetY, positionZ, yRot, asyncCallbackFunction, asyncCallbackObject, asyncCallbackArguments});

thx
jeng

Emil Drefers (Unknown) 21.09.2015 08:11
Hi,

probably you can stick to the Vehicle.lua and check how it is done there:

http://ls-mods.de/scriptDocumentation.php?lua_file=vehicles/Vehicle

function Vehicle:load(configFile, ....


Cheers,
Emil

Dirk Peeters (Unknown) 23.09.2015 10:06
Hi,

i found how to do it but i alway's get stuck on line 127 & 143.

could it be that i'm running this from outside the vehicle itself and it could not find the self.
as the xml file is correct for the vehicle.

so quick overview of workflow
you load the sharedi3d, then you load the xml true self.loadFinished i do directly to vehicle.loadfisnished.

spawning the object is doing what it must do only the loading of the xml fails, but we getting close :-)
this it could not find if i understand the log correct, i not going to paste the output from the log here t
its only refering to the two lines 127 & 143

<components count="1">
<component1 centerOfMass="0.00 0.00 0.00" solverIterationCount="4" />
</components>

thx
jeng

Emil Drefers (Unknown) 23.09.2015 15:58
Hi,

please check if the path to the xml file is correct.
Just use some prints to see what path you are using.
Maybe you have to adjust the way how you set up that path.

Cheers,
Emil


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