28.01.2010, 16:39 | #1 (permalink) |
Registriert seit: 26.03.2008
Beiträge: 2.822
|
MP Skriptproblem
Ich dachte, ich mach mal dafür einen neuen Thread auf
Habe ein Problem mit meinem Skript im Multiplayer. Und zwar folgendes: Beim Spieler, der die Action zum ersten Mal auslöst, funktioniert alles. Beim zweiten Spieler hingegen passiert gar nichts. Er führt auch keine Ausrüstungsanimation aus. Das heißt also, dass der Waffenhalter nicht auf dem Client erstellt wird. Das Skript wird zwar lokal auf dem PC des Auslösers ausgelöst, aber durch setVehicleInit sollte doch der Weaponholder auf jedem Client befüllt werden oder? Dies geschieht aber nicht. Die Frage ist hier warum? createVehicle ist doch eigentlich ein globaler Befehl oder nicht? Code:
/* ====================================================================================================== Add Gear option - by Cyborg11 Version: 1.0 Date: 24.01.2010 Description: Use this script to give a container a Gear option which is not enabled at default Information: If you want to add weapons and magazines to the container then go to line 54 and write your addWeaponCargo/addMagazineCargo after the createVehicle code. !!!! Don't remove the FakeWeapon/FakeMagazine !!!! And don't forget to write the Classnames of the Weapons/Magazines in "" "" or ' '. Example: CYBP_weaponh addWeaponCargo ['M16A2', 5]; CYBP_weaponh addMagazineCargo ['M136', 5]; Good in combination with my vehicle-parachute Script: http://hx3.de/editing-scripting-167/kistenabwurf-kriege-waffen-container-18499/#post292216 Parameter: container addAction ["Gear", "gear.sqf", [debug]]; _container = object which doesn't have a gear option at default _debug = true / false (optional - default is false) Example: this addAction ["Gear", "gear.sqf", [true]]; Example 2: container1 addAction ["Gear", "gear.sqf"]; ====================================================================================================== */ private ["_container","_unit","_action","_array","_debug","_distance","_type","_conarray","_maxdistance"]; _container = _this select 0; _unit = _this select 1; _action = _this select 2; _array = _this select 3; _distance = _unit distance _container; _type = typeOf _container; If ((count _array) > 0) then {_debug = _array select 0} else {_debug = false}; switch (_type) do { case "Misc_Cargo1B_military" : {_maxdistance = 5}; case "Misc_Cargo1Bo_military" : {_maxdistance = 5}; case "Misc_cargo_cont_tiny" : {_maxdistance = 2.8}; default {_maxdistance = 3.5}; }; If (_distance >= _maxdistance) exitWith{ If (_debug) then {hint format ["EXIT!!!\n\nAlive: %1\nDistance: %2\nMaxDistance: %3", alive CYBP_weaponh, _distance, _maxdistance];}; _unit groupChat format ["Distance to Object > %1 Meter! Move closer to the object!", _maxdistance]; }; If (isNil ("CYBP_varweaponholder")) then { _container setVehicleInit " CYBP_weaponh = 'WeaponHolder' createVehicle (_unit modelToWorld [0,0,0]); CYBP_weaponh addWeaponCargo ['FakeWeapon', 1]; CYBP_weaponh addMagazineCargo ['FakeMagazine', 1]; "; processInitCommands; CYBP_varweaponholder = true; publicVariable "CYBP_varweaponholder"; }; WaitUntil {alive CYBP_weaponh}; If (_debug) then {hint format ["Alive: %1\nDistance: %2\nMaxDistance: %3", alive CYBP_weaponh, _distance, _maxdistance]}; CYBP_weaponh setPos (_unit modelToWorld [0,2.5,0]); _unit action ["GEAR", CYBP_weaponh]; sleep 2; // Wait 2 seconds till gear menu is open WaitUntil {!(ctrlVisible 1101)}; // id 1101 is gear menu CYBP_weaponh setPos (_container modelToWorld [0,0,0]);
__________________
|
28.01.2010, 17:52 | #2 (permalink) |
Registriert seit: 11.03.2005
Ort: HH
Alter: 52
Beiträge: 1.930
|
Hm... probier mal folgendes:
Aus der Variable _container machst Du eine globale Variable und sendest die mittles publicVariabale an die anderen Clients: Code:
DeinContainer setVehicleInit " CYBP_weaponh = 'WeaponHolder' createVehicle (_unit modelToWorld [0,0,0]); CYBP_weaponh addWeaponCargo ['FakeWeapon', 1]; CYBP_weaponh addMagazineCargo ['FakeMagazine', 1]; "; publicVariable "DeinContainer"; processInitCommands; |
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
Themen-Optionen | |
Ansicht | |
|
|
Ähnliche Themen | ||||
Thema | Autor | Forum | Antworten | Letzter Beitrag |
Mal wieder ein Skriptproblem | Cyborg11 | Editing | 17 | 30.03.2008 16:23 |