Hallo,
ich brauche für einen mod ein script um Animationen aus der Fahrzeug-xml bzw aus der i3d abspielen zu können.
Wichtig ist, dass bei der Animation Componenten in der i3d rotiert werden müssen, deshalb funktioniert das toggleAnimatedParts-Script leider nicht.
Ich habe jetzt versucht ein kleines Script selbst zu schreiben:
[expander]Seitenschwader = {};
function Seitenschwader.prerequisitesPresent(specializations)
return SpecializationUtil.hasSpecialization(AnimatedVehicle, specializations);
end;
function Seitenschwader:load(xmlFile)
self.DoppelschwadAnimationName = getXMLString(xmlFile, "vehicle.Seitenschwader#DoppelschwadAnimation");
self.EinzelschwadAnimationName = getXMLString(xmlFile, "vehicle.Seitenschwader#EinzelschwadAnimation");
end;
function Seitenschwader:update(dt)
if InputBinding.hasEvent(InputBinding.Doppelschwad) then
self:playAnimation(self.DoppelschwadAnimationName, 1, nil, true);
end;
if InputBinding.hasEvent(InputBinding.Einzelschwad) then
self:playAnimation(self.EinzelschwadAnimationName, 1, nil, true);
end;end;[/expander]
Jetzt zum Problem: Ingame kann ich beide Animationen nur ein einziges mal ausführen und LS ballert mir die log zu:
[expander]Error: LUA running function 'draw'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1986) : attempt to call field 'draw' (a nil value)
Error: LUA running function 'keyEvent'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1650) : attempt to call field 'keyEvent' (a nil value)
Error: LUA running function 'mouseEvent'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1637) : attempt to call field 'mouseEvent' (a nil value)
Error: LUA running function 'mouseEvent'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1637) : attempt to call field 'mouseEvent' (a nil value)
Error: LUA running function 'draw'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1986) : attempt to call field 'draw' (a nil value)
Error: LUA running function 'mouseEvent'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1637) : attempt to call field 'mouseEvent' (a nil value)
Error: LUA running function 'draw'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1986) : attempt to call field 'draw' (a nil value)
Error: LUA running function 'mouseEvent'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1637) : attempt to call field 'mouseEvent' (a nil value)
Error: LUA running function 'mouseEvent'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1637) : attempt to call field 'mouseEvent' (a nil value)
Error: LUA running function 'draw'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1986) : attempt to call field 'draw' (a nil value)
Error: LUA running function 'draw'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1986) : attempt to call field 'draw' (a nil value)
Error: LUA running function 'mouseEvent'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1637) : attempt to call field 'mouseEvent' (a nil value)
Error: LUA running function 'draw'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1986) : attempt to call field 'draw' (a nil value)
Error: LUA running function 'mouseEvent'
D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/vehicles/Vehicle.lua(1637) : attempt to call field 'mouseEvent' (a nil value)
...[/expander]
Leider habe ich mit lua noch keinerlei Erfahrung und weiß deshalb nicht was ich an meinem Script noch ändern müsste....
Ich hoffe ihr könnt mir weiterhelfen.
Mfg
grünerBauer