Community Forum

Frontloader animation

Forum Overview >> Farming Simulator 2009

CategoryFarming Simulator 2009
Created21.06.2009 19:13

Julian Schlüter (Unknown) 21.06.2009 19:15
My problem is: How can I script a frontloader animation that when I pess a ky the animation start and when i the key unhand the animation stop

Matthias B. (Unknown) 22.06.2009 13:44

just use:

function yourFileName:update(dt)

if InputBinding.isPressed(InputBinding.YOURBINDSETINMODDESCFILE) then
enableAnimTrack(charSetId, 0)
-- this starts the animation

if InputBinding.isPressed(InputBinding.YOURBINDSETINMODDESCFILE) then
disableAnimTrack(charSetId, 0)
-- this disable the animation


this is only the use of the animation, look at the Frontlader.lua for more informations!

Matthias B. (Unknown) 22.06.2009 13:45
note: this do only play the animation once time and didn´t move backward!

Julian Schlüter (Unknown) 22.06.2009 16:13
hey Mxy.rlp thanks but how can I make that it move backward too?

Julian Schlüter (Unknown) 22.06.2009 16:23
hey Mxy.rlp thanks but how can I make that it move backward too?

Matthias B. (Unknown) 22.06.2009 18:03
setAnimTrackSpeedScale(characterSetId, 0, 1);

-- should move forward i think

setAnimTrackSpeedScale(characterSetId, 0, -1);

-- should move backward i think

i do not know it works or not (never tested)

Julian Schlüter (Unknown) 22.06.2009 19:52
okay thank you very much

Matthias B. (Unknown) 22.06.2009 20:18
does it works?

Julian Schlüter (Unknown) 22.06.2009 21:30
oh i don't konow I script that a little bit different because I don't use InputBinding and I use more animations with counts so i sript it a little bit different.

Matthias B. (Unknown) 22.06.2009 21:54
ok right!

Michael Pillkahn (Unknown) 23.06.2009 13:24
I currently work on animation script and saving script.
the status of animationscript is 95%
by saving i have 2-3 bugs and one open misson

there you must say only
true(end of clip)/false(beginn) or keytime (somewher between start and end)

Jim Panousis (Jimi540) 28.05.2010 23:14
Matthias, i used your script from your first post here but it didn't worked to me.
But then i read the documentation again and i realize that i must use the getAnimCharacterSet function to get the number of the character set, to use it to the enableAnimTrack and disableAnimTrack functions.
So, i wrote this code:

at :load(xmlFile) function:
local forkId = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.forkA#index"));
self.forkA = getAnimCharacterSet(forkId);

at :update(dt) function
if InputBinding.isPressed(InputBinding.TEST) then
self.testmod = not self.testmod;

if self.testmod then
enableAnimTrack(self.forkA, 0);
disableAnimTrack(self.forkA, 0);

But it didn't worked that either :(
The animation is playing excellent in the Maya2008 and in the GE.
Also i used the function getAnimCharacterSet in the GE and it returns to me the number 102.
I run this:
print(getAnimCharacterSet(95)); 95 is the Id of the component in the Attributes window.
But in lua the:
local forkId = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.forkA#index"));
returns the 12|0, because i put this at the .xml

Any ideas whats wrong?

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