Beiträge von mx 270

    So dasmit dem Event usw. hab ich jetzt fest im kopf nur habe ich jetzt das Problem ich will wie im Beispiel oben etwas drehen lass aber diesmal nur wenn die taste gedrückt ist


    Also in etwa so


    [lua] if InputBinding.isPressed(InputBinding.TASTE1) then
    local x, y, z = getRotation(self.Rotation1.node);
    local rot = {x,y,z};
    local newRot = Utils.getMovedLimitedValues(rot, self.Rotation1.maxRot, self.Rotation1.minRot, 3, self.Rotation1.rotTime, dt, true );
    setRotation(self.Rotation1.node, unpack(newRot));
    end;


    if InputBinding.isPressed(InputBinding.TASTE2) then
    local x, y, z = getRotation(self.Rotation1.node);
    local rot = {x,y,z};
    local newRot = Utils.getMovedLimitedValues(rot, self.Rotation1.maxRot, self.Rotation1.minRot, 3, self.Rotation1.rotTime, dt, false );
    setRotation(self.Rotation1.node, unpack(newRot));
    end;[/lua]


    So sieht das dann in etwa in der Update aus und das möchte ich MPready machen

    So hier mal wieder was von mir eine Ladeplattform für den Agroliner HKL.
    Hat vielleicht ähnlichkeit mit dem aus 09 ist aber ein Komplett neues Modell


    Er ist sowohl Spiel aus auch MP ready


    Funktionen:
    Wenn die Rampen zu sind ist der Traktor oder das Gerät fest.(by Geri-G aus 09)


    Modell/Textur/Ingame: by Mx270


    So und hier die Bilder




    Ich habe mal ne Frage oder nen Thema was sicher für vile interessant ist unzwar wie mann Scripte MP Ready macht (Der Aufbau der "Event" LUA mit der Standart LUA) ich habe mal ganz einfaches geschrieben und hab das mal soweit gemacht wie ich es weiß.


    [lua]
    myScript = {};


    function myScript.prerequisitesPresent(specializations)
    return true;
    end;


    function myScript:load(xmlFile)


    self.-kp- = SpecializationUtil.callSpecializationsFunction("setRotation");


    local rotationPartNodeRotation1= Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.Rotation1#index"));
    if rotationPartNodeRotation1 ~= nil then
    self.Rotation1 = {};
    self.Rotation1.node = rotationPartNodeRotation1;


    local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.Rotation1#minRot"));
    self.Rotation1.minRot = {};
    self.Rotation1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
    self.Rotation1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
    self.Rotation1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));


    x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.Rotation1#maxRot"));
    self.Rotation1.maxRot = {};
    self.Rotation1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
    self.Rotation1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
    self.Rotation1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));


    self.Rotation1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.Rotation1#rotTime"), 2)*1000;
    end;


    end;


    function myScript:delete()
    end;


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


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


    function myScript:readStream(streamId, connection)
    end;


    function myScript:writeStream(streamId, connection)
    end;


    function myScript:update(dt)

    if InputBinding.isPressed(InputBinding.TASTE) then
    self.drehen = not self.drehen;
    end;

    end;



    function myScript:updateTick(dt)

    if self.Rotation1 ~= nil then
    local x, y, z = getRotation(self.Rotation1.node);
    local rot = {x,y,z};
    local newRot = Utils.getMovedLimitedValues(rot, self.Rotation1.maxRot, self.Rotation1.minRot, 3, self.Rotation1.rotTime, dt, not self.drehen);
    setRotation(self.Rotation1.node, unpack(newRot));
    end;
    end;


    function myScript:setRotation(Rotation, noEventSend)
    end;


    function myScript:draw()
    end;[/lua]


    Aber von der "Event" LUA hab ich 0 Plan


    [lua]RotationEvent = {};
    RotationEvent_mt = Class(RotationEvent, Event);


    InitEventClass(RotationEvent, "RotationEvent");


    function RotationEvent:emptyNew()
    end;


    function RotationEvent:new(vehicle, Rotation)
    end;


    function RotationEvent:readStream(streamId, connection)
    end;


    function RotationEvent:writeStream(streamId, connection)
    end;


    function RotationEvent:run(connection)
    end;


    function RotationEvent.sendEvent(vehicle, Rotation, noEventSend)
    end;
    [/lua]
    Würde mich über Antworten freuen

    Kann mir jemand hierbei auch noch helfen


    Zitat

    -Wie schreieibe ich das denn ich z.B. eine Greifer Rotation das man ich
    links und rechts rum drehen kann ohne das irgentwann ende ist.

    @ John Deere 6930


    Ich hab geschrieben

    Zitat

    oder hab ich das Falsch

    und du hast geschrieben

    Zitat

    ja

    da dachte ich das was ist gepostet habe sei Falsch, kleines missverstäntnis :D


    @ Skullman


    Das ist mir schon klar nur als "Platzhalter" mir ist nix besseres eingefallen :whistling:


    Danke für die hilfe euch allen oder ehr gesagt John Deere 6930 und Skullman schnelle gute hilfe :thumbsup: :D

    Und die Index Variable dann


    inder LUA so


    [lua]self.?? = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.??#index"));[/lua]


    und in der xml so


    XML
    <?? index="?" />


    oder hab ich das Falsch

    So meine Fragen sind,


    -Wie muss ich das schreiben wenn ich per tasten druck o.ä. ein objekt zum drehen bekomme was dann immer durch läuft bis man es stoppt z.B. wie bei Schwadkreiseln.


    -Wie schreieibe ich das denn ich z.B. eine Greifer Rotation das man ich links und rechts rum drehen kann ohne das irgentwann ende ist.


    Ich hoffe ihr wisst was ich meine :whistling:


    Mfg mx270