Einzelnen Beitrag anzeigen
Alt 24.01.2010, 21:39   #6 (permalink)
Cyborg11
500 Beiträge1000 Beiträge2.500 Beiträge
 
Benutzerbild von Cyborg11
 
Registriert seit: 26.03.2008
Beiträge: 2.822
Standard

Soooo ... nun habe ich ein Skript für das Container Problem geschrieben. Mit diesem Skript könnt ihr einem Container die Gear/Ausrüstung Option hinzufügen und dort Waffen / Magazine nehmen / verladen.

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;

WaitUntil {!(ctrlVisible 1101)};	// ctrlVisible 1101 is the gear menu
CYBP_weaponh setPos (_container modelToWorld [0,0,0]);
Konnte es noch nicht im MP testen, sollte aber dort auch funktionieren. Für den MP ist es auf jeden Fall geskripted
Cyborg11 ist offline