Category | Scripting |
Created | 31.10.2016 22:50 |
Andrei Sprinseana (xsenio) | 31.10.2016 22:54 |
---|---|
Help please change Lua script for the FS 17 KAMAZ = {}; function KAMAZ.prerequisitesPresent(specializations) return true ; end; function KAMAZ:load(xmlFile) self.anim = SpecializationUtil.callSpecializationsFunction("anim"); self.Go = {}; self.Done = {}; self.charId = {}; self.clipIndex = {}; self.CheckDone = {}; self.moveColli = {}; self.animParts1 = {} self.collisionArm = {}; local count = getXMLInt(xmlFile, "vehicle.animParts1#count"); local part = self.animParts1; for i=1, count do part[i] = {}; local partname = string.format("vehicle.animParts1.part".."%d", i); local nameR = getXMLString(xmlFile, partname.."#name"); self.charId[nameR] = Utils.indexToObject(self.components, getXMLString(xmlFile, partname.."#rootNode")); self.clipIndex[nameR] = getXMLString(xmlFile, partname.."#animationClip"); self.CheckDone[nameR] = false; end; end; function KAMAZ:delete() end; function KAMAZ:mouseEvent(posX, posY, isDown, isUp, button) end; function KAMAZ:keyEvent(unicode, sym, modifier, isDown) if isDown and sym==Input.KEY_b then self.Go.pillar = not self.Go.pillar; self.Done.pillar = true; end; end; function KAMAZ:update(dt) if self.Go.pillar ~= nil and self.Done.pillar ~= false then self:anim("pillar", false); end; if self.isEntered then self.input = InputBinding.getAnalogInputAxis(InputBinding.AXIS_MOVE_FORWARD_VEHICLE); if InputBinding.isAxisZero(self.input) then self.input = InputBinding.getDigitalInputAxis(InputBinding.AXIS_MOVE_FORWARD_VEHICLE); end; end; end; function KAMAZ:draw() end; function KAMAZ:onEnter() end; function KAMAZ:onLeave() end; function KAMAZ:anim(varName, loopCheck) if self.moveColli[varName] ~= nil then local Collision = self.collisionArm[varName]; setJointFrame(Collision.index, 0, Collision.armAttacher); end; if self.Go[varName] == true and self.Done[varName] ~= false then local charId = getAnimCharacterSet(self.charId[varName]); local clipIndex = getAnimClipIndex(charId, self.clipIndex[varName]); assignAnimTrackClip(charId , 0, clipIndex); setAnimTrackLoopState(charId, 0, loopCheck); setAnimTrackSpeedScale(charId, 0, 1); enableAnimTrack(charId, 0); if getAnimTrackTime(charId, 0) >= getAnimClipDuration(charId, clipIndex) and loopCheck == false then disableAnimTrack(charId, 0); self.Done[varName] = false; self.CheckDone[varName] = true; end; elseif self.Go[varName] == false and self.Done[varName] ~= false then local charId = getAnimCharacterSet(self.charId[varName]); local clipIndex = getAnimClipIndex(charId, self.clipIndex[varName]); if loopCheck == true then disableAnimTrack(charId, 0); self.Done[varName] = false; end; assignAnimTrackClip(charId , 0, clipIndex); setAnimTrackLoopState(charId, 0, loopCheck); setAnimTrackSpeedScale(charId, 0, -1); enableAnimTrack(charId, 0); if getAnimTrackTime(charId, 0) <= 0 then disableAnimTrack(charId, 0); self.Done[varName] = false; self.CheckDone[varName] = false; end; end; end; |
Tom Lindner (webalizer) | 01.11.2016 08:18 |
---|---|
First change function KAMAZ:load(xmlFile) to function KAMAZ:load(savegame) then change every xmlFile to self.xmlFile Test. |
Andrei Sprinseana (xsenio) | 01.11.2016 11:28 |
---|---|
Thank you very much, did all you have written and earned, but there is an error in the log, is such. Error: Running LUA method 'update'. dataS/scripts/InputBinding.lua:0: table index is nil Error: Running LUA method 'update'. dataS/scripts/InputBinding.lua:0: table index is nil Error: Running LUA method 'update'. dataS/scripts/InputBinding.lua:0: table index is nil Error: Running LUA method 'update'. dataS/scripts/InputBinding.lua:0: table index is nil Error: Running LUA method 'update'. dataS/scripts/InputBinding.lua:0: table index is nil Error: Running LUA method 'update'. dataS/scripts/InputBinding.lua:0: table index is nil Error: Running LUA method 'update'. dataS/scripts/InputBinding.lua:0: table index is nil I would be very grateful if you help solve the problem |
Andrei Sprinseana (xsenio) | 01.11.2016 11:39 |
---|---|
Bourgon Cedric (cbourgon) | 02.11.2016 15:38 |
---|---|
Hi, Check the lines with InputBinding.AXIS_MOVE_FORWARD_VEHICLE, i think AXIS_MOVE_FORWARD_VEHICLE isn't defined into the input binding file or in the kamaz xml file |
Andrei Sprinseana (xsenio) | 02.11.2016 19:19 |
---|---|
Thank you very much it was necessary to prescribe instead AXIS_MOVE_FORWARD_VEHICLE AXIS_MOVE_FORWARD_PLAYER |
Andrei Sprinseana (xsenio) | 02.11.2016 19:21 |
---|---|
You can close the topic did everything |
R Harris (Rambow145) | 17.04.2017 03:01 |
---|---|
Fs 17 uses I think AXIS_ACCELERATE_VEHICLE Replace the AXIS_MOVE_FORWARD_VEHICLE with AXIS_ACCELERATE_VEHICLE I think this is what your looking for. This should getting you going Rambow145 ;) |
Note: Log in to post. Create a new account here.