Armed-Assault.de Twitter
 
 
Themen-Optionen Ansicht
Alt 28.01.2010, 16:39   #1 (permalink)
500 Beiträge1000 Beiträge2.500 Beiträge
 
Benutzerbild von Cyborg11
 
Registriert seit: 26.03.2008
Beiträge: 2.822
Standard 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]);
Cyborg11 ist offline  
Alt 28.01.2010, 17:52   #2 (permalink)
10 Jahre hx3
500 Beiträge1000 Beiträge
 
Benutzerbild von Buliwyf
 
Registriert seit: 11.03.2005
Ort: HH
Alter: 52
Beiträge: 1.930
Standard

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;
__________________
Buliwyf ist offline  
 


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Mal wieder ein Skriptproblem Cyborg11 Editing 17 30.03.2008 16:23


Kontakt - HX3.de - Archiv - Nach oben

Angetrieben durch vBulletin, Entwicklung von Philipp Dörner & Tobias



SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119