Beiträge von Pitzmann Tuning

    Hallo, ich möchte zwei verschiedene Input.Binding Befehle (einmal hasEvent und einmal getPressed) für die selbe Aktion nutzen ohne das sie sich gegenseitig im Weg stehen. So wie es jetzt ist schalte ich mit getPressed die Funktion nur an oder ab, ich möchte aber das mit getPressed die Funktion nur funktioniert wenn der Knopf gehalten wird.


    Weiß jemand Rat?


    [lua]function setVehicleRpm:update(dt)
    if self.isMotorStarted and self:getIsActiveForInput() and self.isEntered then
    if InputBinding.hasEvent(InputBinding.setVehicleRpmonoff) then
    self.engine = not self.engine;
    end;
    if InputBinding.isPressed(InputBinding.setVehicleRpmpress) then
    self.engine = not self.engine;
    end;
    end;
    end;[/lua]

    Vielen herzlichen Dank das Du da noch vor Deinem Urlaub drübergeschaut hast... :thumbsup::thumbsup:
    Wünsch Dir einen super Urlaub!! 8)


    Jetzt scheint der Fehler in der Funktion zu sein, den es funktioniert irgendwie immer no net... ;(


    [lua] setVehicleRpm = {};


    function setVehicleRpm.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Motorized, specializations);
    end;


    function setVehicleRpm:load(xmlFile)
    self.setVehicleRpmUp = SpecializationUtil.callSpecializationsFunction("setVehicleRpmUp");
    self.saveMinRpm = 0;
    end;


    function setVehicleRpm:delete()
    end;


    function setVehicleRpm:mouseEvent(posX, posY, isDown, isUp, button)
    end;


    function setVehicleRpm:keyEvent(unicode, sym, modifier, isDown)
    end;


    function setVehicleRpm:update(dt)
    if self:getIsActiveForInput() then
    local isKeyEvent = false; -- wir erzeugen die Variable local hier, somit gilt sie in diesem Block und seinen Untergeordneten Blocks
    if InputBinding.isPressed(InputBinding.setVehicleRpm) then -- wenn die Taste gedrückt ist dann:
    isKeyEvent = true;
    else -- ansonsten
    isKeyEvent = false;
    end;
    self:setVehicleRpmUp(dt, isKeyEvent)
    end;
    end;


    function setVehicleRpm:updateTick(dt)
    end;


    function setVehicleRpm:setVehicleRpmUp(dt, isActive)
    if self.saveMinRpm ~= 0 then
    if dt ~= nil then
    if isActive == true then
    self.motor.minRpm = math.max(self.motor.minRpm-dt, -1000);
    else
    self.motor.minRpm = math.min(self.motor.minRpm+dt*2, self.saveMinRpm);
    end;
    else
    self.motor.minRpm = self.saveMinRpm;
    end;
    end;
    end;



    function setVehicleRpm:draw()
    end;


    function setVehicleRpm:onLeave()
    end; [/lua]

    Ich glaub so müsste es heißen, aber was kommt bei den Fragezeichen hin?


    [lua]setVehicleRpm = {};


    function setVehicleRpm.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Motorized, specializations);
    end;


    function setVehicleRpm:load(xmlFile)
    self.setVehicleRpmUp = SpecializationUtil.callSpecializationsFunction("setVehicleRpmUp");
    self.saveMinRpm = 0;
    end;


    function setVehicleRpm:delete()
    end;


    function setVehicleRpm:mouseEvent(posX, posY, isDown, isUp, button)
    end;


    function setVehicleRpm:keyEvent(unicode, sym, modifier, isDown)
    end;


    function setVehicleRpm:update(dt)
    if self:getIsActiveForInput() then
    InputBinding.isPressed(InputBinding.setVehicleRpm) then
    ???;
    isKeyEvent = true;
    end;
    self:setVehicleRpmUp(dt, isKeyEvent);
    end;
    end;


    function setVehicleRpm:updateTick(dt)
    end;


    function setVehicleRpmUp(dt, isActive)
    if self.saveMinRpm ~= 0 then
    if dt ~= nil then
    if isActive == true then
    elf.motor.minRpm = math.max(self.motor.minRpm-dt, -1000);
    else
    self.motor.minRpm = math.min(self.motor.minRpm+dt*2, self.saveMinRpm);
    end;
    else
    self.motor.minRpm = self.saveMinRpm;
    end;
    end;
    end;



    function setVehicleRpm:draw()
    end;


    function setVehicleRpm:onLeave()
    end;
    [/lua]

    Ich möchte per Knopfdruck das Standgas meines Trekkers erhöhen und wieder normalisieren. Hab jetzt mal versucht mit meinen sehr schmalen lua-kentnissen das ganze zu bewerkstelligen. Hab dann ne Speci erstellt, die aber irgendwie net funktioniert... ?(?(?(


    Findet jemand von euch den (oder noch schlimmer die) Fehler?


    [lua]setVehicleRpm = {};


    function setVehicleRpm.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Motorized, specializations);
    end;


    function setVehicleRpm:load(xmlFile)
    self.saveMinRpm = 0;
    end;


    function setVehicleRpm:delete()
    end;


    function setVehicleRpm:mouseEvent(posX, posY, isDown, isUp, button)
    end;


    function setVehicleRpm:keyEvent(unicode, sym, modifier, isDown)
    end;


    function setVehicleRpm:update(dt)
    if self:getIsActiveForInput() and InputBinding.isPressed(InputBinding.setVehicleRpm) then
    self.setVehicleRpm = self.setVehicleRpm;
    end;
    end;




    function setVehicleRpm:updateTick(dt)
    end;



    function setVehicleRpm:draw()
    if self.saveMinRpm ~= 0 then
    if isActive == true then
    self.motor.minRpm = math.max(self.motor.minRpm-dt, -1000);
    else
    self.motor.minRpm = math.min(self.motor.minRpm+dt*2, self.saveMinRpm);
    end;
    else
    self.motor.minRpm = self.saveMinRpm;
    end;
    end;


    function setVehicleRpm:onLeave()
    end;


    [/lua]

    Hallo FIAT80-90DT,


    vielen Dank für Deine schnelle Antwort. Gab noch zwei kleine Fehlermeldungen in der Log, aber anhand selbiger konnte ich das jetzt fertig machen:


    [lua]function PThorn:update(dt)
    if self:getIsActiveForInput() and self:getIsActiveForSound() then
    if InputBinding.isPressed(InputBinding.PThorn1) then
    if not self.horn1Playing then
    playSample(self.horn1SoundId, 0, 0.35, 0);
    self.horn1Playing = true;
    end;
    else
    if self.horn1Playing then
    stopSample(self.horn1SoundId);
    self.horn1Playing = false;
    end;
    end;

    if InputBinding.isPressed(InputBinding.PThorn2) then
    if not self.horn2Playing then
    playSample(self.horn2SoundId, 0, 0.14, 0);
    self.horn2Playing = true;
    end;
    else
    if self.horn2Playing then
    stopSample(self.horn2SoundId);
    self.horn2Playing = false;
    end;
    end;
    end;
    end;[/lua]


    Vielen Dank nochmal für Deine Hilfe, jetzt funktionierts genauso wie ich gern hätte...
    :thumbsup::thumbsup::thumbsup:

    Hallo, ich brauche dringend Hilfe...


    Ich wollte mit der Horn Speci aus dem Beispielmod 2 verschiedene Melodien abspielen. Irgendwie hat das aber nicht funktioniert. Hab einiges versucht und das Spiel zig mal gestartet, leider ohne Ergebniss...
    So wie es jetzt ist wird per Knopfdruck nur die PThorn1.wav abgespielt...
    Kann mir jemand sagen was ich falsch gemacht hab?


    ?(?(?(


    Danke schonmal im Vorraus



    [lua]--
    -- lizard2000
    -- Specialization for lizard2000 mod
    --
    -- @author Stefan Geiger
    -- @date 10/01/09
    --
    -- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved.


    PThorn = {};


    function PThorn.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Motorized, specializations);
    end;


    function PThorn:load(xmlFile)
    horn1SoundFile = Utils.getFilename("PThorn1.wav", self.baseDirectory);
    horn2SoundFile = Utils.getFilename("PThorn2.wav", self.baseDirectory);
    self.horn1SoundId = createSample("PThorn1sound");
    self.horn2SoundId = createSample("PThorn2sound");
    loadSample(self.horn1SoundId, horn1SoundFile, false);
    loadSample(self.horn2SoundId, horn2SoundFile, false);
    self.horn1Playing = false;
    self.horn2Playing = false;
    end;


    function PThorn:delete()
    delete(self.burnerSoundId);
    end;


    function PThorn:mouseEvent(posX, posY, isDown, isUp, button)
    end;


    function PThorn:keyEvent(unicode, sym, modifier, isDown)
    end;


    function PThorn:update(dt)
    if self:getIsActiveForInput() and self:getIsActiveForSound() and InputBinding.isPressed(InputBinding.PThorn1) then
    if not self.horn1Playing then
    playSample(self.horn1SoundId, 0, 0.35, 0);
    self.horn1Playing = true;
    end;
    else
    if self.horn1Playing then
    stopSample(self.horn1SoundId);
    self.horn1Playing = false;
    end;
    end;

    if self:getIsActiveForInput() and self:getIsActiveForSound() and InputBinding.isPressed(InputBinding.PThorn2) then
    if not self.horn2Playing then
    playSample(self.horn2SoundId, 0, 0.35, 0);
    self.horn2Playing = true;
    end;
    else
    if self.horn2Playing then
    stopSample(self.horn2SoundId);
    self.horn2Playing = false;
    end;
    end;
    end;


    function PThorn:draw()
    end;


    [/lua]

    Hallo,


    ich habe mir den Quickie Q55 Frontlader runtergeladen und in an meinen Agrotron x720 montiert. Um das zu erreichen musste ich den Frontlader etwas vergrößern. Hat soweit alles ganz gut funktioniert...


    Leider wackelt jetzt das Werkzeug. Wenn ich Mist laden will schiebts mir die Schaufel umher. Wenn ich die Gabelzinken auf den Boden ausrichte und das Fahrzeug hebe drückt es mir die Gabel in den Frontlader. Das Werkzeug bleibt bei Belastung nicht dort wo es soll... ?(


    Ohne Belastung:



    Mit Belastung:



    Kennt jemand diese Problem oder gar eine Lösung dafür?