Hi,
ich habe seit längerem das BalloonWheel Script raus welches auf Basis der LUA Video Tuts entstand.
Leider habe ich damit ein Problem.
Im Multiplayer kann ich als Host die Balloon Reifen einschalten und sehen aber als Client nicht.
Ich habe mir zu dem Thema mal einige andere Scripts angeguckt (Einblendung, toggleAnimatedParts u.s.w).
Wenn ich das richtig verstehe muss man ein Event einbauen ähnlich wie das hier:
[lua]Setblends1Event = {};
Setblends1Event_mt = Class(Setblends1Event, Event);
InitEventClass(Setblends1Event, "Setblends1Event");
function Setblends1Event:emptyNew()
local self = Event:new(Setblends1Event_mt);
self.className="Setblends1Event";
return self;
end;
function Setblends1Event:new(object, active)
local self = Setblends1Event:emptyNew()
self.active = active;
self.object = object;
return self;
end;
function Setblends1Event:readStream(streamId, connection)
local id = streamReadInt32(streamId);
self.active = streamReadBool(streamId);
self.object = networkGetObject(id);
self:run(connection);
end;
function Setblends1Event:writeStream(streamId, connection)
streamWriteInt32(streamId, networkGetObjectId(self.object));
streamWriteBool(streamId, self.active);
end;
function Setblends1Event:run(connection)
self.object:setblends1Visibility(self.active, true);
if not connection:getIsServer() then
g_server:broadcastEvent(Setblends1Event:new(self.object, self.active), nil, connection, self.object);
end;
end;[/lua]
Leider habe ich keine Ahnung wie das bei mir aussehen müsste.
Hier mal das aktuelle Script:
[lua]balloonWheels = {};
function balloonWheels.prerequisitesPresent(specializations)
return SpecializationUtil.hasSpecialization(Motorized, specializations);
end;
function balloonWheels:load(xmlFile)
self.wheelToBalloonRearLeft = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.balloonWheels.wheelToBalloonRearLeft#index"));
self.wheelToBalloonRearRight = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.balloonWheels.wheelToBalloonRearRight#index"));
self.wheelToBalloonFrontLeft = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.balloonWheels.wheelToBalloonFrontLeft#index"));
self.wheelToBalloonFrontRight = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.balloonWheels.wheelToBalloonFrontRight#index"));
self.bwRLX, self.bwRLY, self.bwRLZ = getScale(self.wheelToBalloonRearLeft);
self.bwRRX, self.bwRRY, self.bwRRZ = getScale(self.wheelToBalloonRearRight);
self.bwFLX, self.bwFLY, self.bwFLZ = getScale(self.wheelToBalloonFrontLeft);
self.bwFRX, self.bwFRY, self.bwFRZ = getScale(self.wheelToBalloonFrontRight);
self.bwTRLX, self.bwTRLY, self.bwTRLZ = getTranslation(self.wheelToBalloonRearLeft);
self.bwTRRX, self.bwTRRY, self.bwTRRZ = getTranslation(self.wheelToBalloonRearRight);
self.bwTFLX, self.bwTFLY, self.bwTFLZ = getTranslation(self.wheelToBalloonFrontLeft);
self.bwTFRX, self.bwTFRY, self.bwTFRZ = getTranslation(self.wheelToBalloonFrontRight);
self.balloonWheelsWidth = getXMLFloat(xmlFile, "vehicle.balloonWheels#wheelWidth");
self.balloonWheelsAxleDiv = getXMLFloat(xmlFile, "vehicle.balloonWheels#axleDiv");
self.isSelectable = true
self.balloonWheelsState = false;
end;
function balloonWheels:delete()
end;
function balloonWheels:mouseEvent(posX, posY, isDown, isUp, button)
end;
function balloonWheels:keyEvent(unicode, sym, modifier, isDown)
end;
function balloonWheels:update(dt)
if self:getIsActiveForInput() then
if InputBinding.hasEvent(InputBinding.BALLOONWHEELS) then
self.balloonWheelsState = not self.balloonWheelsState;
end;
if self.balloonWheelsState == true then
setScale(self.wheelToBalloonRearLeft, (self.bwRLX / 100) + self.balloonWheelsWidth, self.bwRLY ,self.bwRLZ);
setScale(self.wheelToBalloonRearRight, (self.bwRRX / 100) + self.balloonWheelsWidth, self.bwRRY ,self.bwRRZ);
setScale(self.wheelToBalloonFrontLeft, (self.bwFLX / 100) + self.balloonWheelsWidth, self.bwFLY ,self.bwFLZ);
setScale(self.wheelToBalloonFrontRight, (self.bwFRX / 100) + self.balloonWheelsWidth, self.bwFRY ,self.bwFRZ);
setTranslation(self.wheelToBalloonRearLeft, self.bwTRLX + self.balloonWheelsAxleDiv, self.bwTRLY, self.bwTRLZ);
setTranslation(self.wheelToBalloonRearRight, self.bwTRRX - self.balloonWheelsAxleDiv, self.bwTRRY, self.bwTRRZ);
setTranslation(self.wheelToBalloonFrontLeft, self.bwTFLX + self.balloonWheelsAxleDiv, self.bwTFLY, self.bwTFLZ);
setTranslation(self.wheelToBalloonFrontRight, self.bwTFRX - self.balloonWheelsAxleDiv, self.bwTFRY, self.bwTFRZ);
elseif self.balloonWheelsState == false then
setScale(self.wheelToBalloonRearLeft, self.bwRLX, self.bwRLY ,self.bwRLZ);
setScale(self.wheelToBalloonRearRight, self.bwRRX, self.bwRRY ,self.bwRRZ);
setScale(self.wheelToBalloonFrontLeft, self.bwFLX, self.bwFLY ,self.bwFLZ);
setScale(self.wheelToBalloonFrontRight, self.bwFRX, self.bwFRY ,self.bwFRZ);
setTranslation(self.wheelToBalloonRearLeft, self.bwTRLX, self.bwTRLY, self.bwTRLZ);
setTranslation(self.wheelToBalloonRearRight, self.bwTRRX, self.bwTRRY, self.bwTRRZ);
setTranslation(self.wheelToBalloonFrontLeft, self.bwTFLX, self.bwTFLY, self.bwTFLZ);
setTranslation(self.wheelToBalloonFrontRight, self.bwTFRX, self.bwTFRY, self.bwTFRZ);
end;
end;
end;
function balloonWheels:draw()
if self.balloonWheelsState then
g_currentMission:addHelpButtonText(g_i18n:getText("BALLOONOFF"), InputBinding.BALLOONWHEELS);
else
g_currentMission:addHelpButtonText(g_i18n:getText("BALLOONON"), InputBinding.BALLOONWHEELS);
end;
end;
function balloonWheels:loadFromAttributesAndNodes(xmlFile, key, resetVehicles)
local balloonWheelsState = getXMLBool(xmlFile, key.."#balloonWheelsState");
if balloonWheelsState ~= nil then
self.balloonWheelsState = balloonWheelsState;
end;
return BaseMission.VEHICLE_LOAD_OK;
end;
function balloonWheels:getSaveAttributesAndNodes(nodeIdent)
local attributes = ""
if self.balloonWheelsState ~= nil then
attributes = ' balloonWheelsState="'.. tostring(self.balloonWheelsState) ..'"';
end;
return attributes, nil;
end;
function balloonWheels:onLeave()
end;
[/lua]
Ich hoffe ihr könnt mir da weiter helfen.
Lg
Webby