Category | Scripting |
Created | 30.11.2018 19:23 |
Ilya Kazakov (Aluha74rus) | 30.11.2018 19:23 |
---|---|
Hello, need help with the script envelope with FS17 in FS19, as there are no original scripts then I can not rewrite the script. Thank you in advance. here is the script itself. -- -- Trac Anim -- TracAnim = {}; function TracAnim.prerequisitesPresent(specializations) return SpecializationUtil.hasSpecialization(Motorized, specializations) and SpecializationUtil.hasSpecialization(Drivable, specializations); end; function TracAnim:load(savegame) self.charIdAnim = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.animTracLeft#Node")); self.clipIndexAnim = getXMLString(self.xmlFile, "vehicle.animTracLeft#animationClip"); self.charIdAnim1 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.animTracRight#Node")); self.clipIndexAnim1 = getXMLString(self.xmlFile, "vehicle.animTracRight#animationClip"); self.spedTracLeft = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.spedTracLeft#index")); self.spedTracRight = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.spedTracRight#index")); self.charId = getAnimCharacterSet(self.charIdAnim); local clipIndex = getAnimClipIndex(self.charId, self.clipIndexAnim); assignAnimTrackClip(self.charId , 0, clipIndex); setAnimTrackLoopState(self.charId, 0, true); self.charId1 = getAnimCharacterSet(self.charIdAnim1); local clipIndex1 = getAnimClipIndex(self.charId1, self.clipIndexAnim1); assignAnimTrackClip(self.charId1 , 0, clipIndex1); setAnimTrackLoopState(self.charId1, 0, true); self.lastTranslation1 = nil; -- = {0,0,0}; self.lastSpeedReal1 = 0; self.lastMovedDistance1 = 0; self.speedDisplayDt1 = 0; self.movingDirection1 = 0; self.speedDisplayScale1 = 1; self.lastTranslation2 = nil; -- = {0,0,0}; self.lastSpeedReal2 = 0; self.lastMovedDistance2 = 0; self.speedDisplayDt2 = 0; self.movingDirection2 = 0; self.speedDisplayScale2 = 1; self.lastRotR,_,_ = getRotation(self.wheels[2].repr); self.lastRotL,_,_ = getRotation(self.wheels[1].repr); end; function TracAnim:delete() end; function TracAnim:mouseEvent(posX, posY, isDown, isUp, button) end; function TracAnim:keyEvent(unicode, sym, modifier, isDown) end; function TracAnim:update(dt) self.speedDisplayDt1 = self.speedDisplayDt1 + dt; if self.speedDisplayDt1 > 130 then local newX1, newY1, newZ1 = getWorldTranslation(self.spedTracLeft); if self.lastTranslation1 == nil then self.lastTranslation1 = {newX1, newY1, newZ1}; end; local dx1, dy1, dz1 = worldDirectionToLocal(self.spedTracLeft, newX1-self.lastTranslation1[1], newY1-self.lastTranslation1[2], newZ1-self.lastTranslation1[3]); self.lastMovedDistance1 = Utils.vector3Length(dx1, dy1, dz1); self.lastSpeedReal1 = (self.lastMovedDistance1/8); self.lastTranslation1 = {newX1, newY1, newZ1}; self.speedDisplayDt1 = self.speedDisplayDt1 - 130; end; self.speedDisplayDt2 = self.speedDisplayDt2 + dt; if self.speedDisplayDt2 > 130 then local newX2, newY2, newZ2 = getWorldTranslation(self.spedTracRight); if self.lastTranslation2 == nil then self.lastTranslation2 = {newX2, newY2, newZ2}; end; local dx2, dy2, dz2 = worldDirectionToLocal(self.spedTracRight, newX2-self.lastTranslation2[1], newY2-self.lastTranslation2[2], newZ2-self.lastTranslation2[3]); self.lastMovedDistance2 = Utils.vector3Length(dx2, dy2, dz2); self.lastSpeedReal2 = (self.lastMovedDistance2/8); self.lastTranslation2 = {newX2, newY2, newZ2}; self.speedDisplayDt2 = self.speedDisplayDt2 - 130; end; local tx1,ty1,tz1 = getRotation(self.wheels[1].repr); local tx2,ty2,tz2 = getRotation(self.wheels[2].repr); if tx1 > self.lastRotL then self.movingDirection2 = 1; end; if tx2 > self.lastRotR then self.movingDirection1 = 1; end; if tx1 == self.lastRotL then self.movingDirection2 = 0; end; if tx2 == self.lastRotR then self.movingDirection1 = 0; end; if tx1 < self.lastRotL then self.movingDirection2 = -1; end; if tx2 < self.lastRotR then self.movingDirection1 = -1; end; self.lastRotL = tx1; self.lastRotR = tx2; if ty2 > -0.5 then setAnimTrackSpeedScale(self.charId, 0, 30 * self.lastSpeedReal1 * self.movingDirection1); enableAnimTrack(self.charId, 0); else disableAnimTrack(self.charId, 0); end; if ty1 < 0.5 then setAnimTrackSpeedScale(self.charId1, 0, 30 * self.lastSpeedReal2 * self.movingDirection2); enableAnimTrack(self.charId1, 0); else disableAnimTrack(self.charId1, 0); end; if self:getIsActive() then if self.vehicleCharacter.isCharacterLoaded then for ikChainId, target in pairs(self.vehicleCharacter.ikChainTargets) do IKUtil.setTarget(self.vehicleCharacter.ikChains, ikChainId, target); end; self.vehicleCharacter:setCharacterDirty(); end end end; function TracAnim:updateTick(dt) end; function TracAnim:onLeave() end; function TracAnim:onLeave() end; function TracAnim:draw() end; |
Den Beny (ben686686) | 02.12.2018 12:04 |
---|---|
Mr. Buruh! since you can't figure it out, delete the game and go home |
Note: Log in to post. Create a new account here.