Einzelnen Beitrag anzeigen
Alt 02.07.2010, 13:25   #9 (permalink)
Cyborg11
500 Beiträge1000 Beiträge2.500 Beiträge
 
Benutzerbild von Cyborg11
 
Registriert seit: 26.03.2008
Beiträge: 2.822
Standard

Als Spieler kannst du keine Rakete abfeuern. Da müsstest du mal versuchen dem Spieler die Hellfirewaffe + Hellfireraketen per addWeapon zu geben

Hier übrigens eine neue Version. Die funktioniert jetzt auf jeden Fall richtig und besser. UAV Code ist auch mit enthalten, ist aber nicht aktiviert. Muss da erst noch ein bisschen testen.
Dem Skript ist es jetzt auch egal, ob das ULB module schon Einheiten synchronisiert hat wie einen Apache oder keine Einheit.
Code:
/*
===============================================================================================
TerminalBackpack - by Cyborg11
Version: 1.1
Date: 01.07.2010
Description:    A unit with a UAV Terminal Backpack has access to an UAV and ULB
                1. Synchronize the ULB to the ULB module and the UAV to the UAV module
                2. Execute the script on the soldier that should have the action
                UAV does not work atm! It is nil by default.
                
Parameter: nul = [unit, ULB module, UAV module] execVM "TerminalBackpack.sqf";
        _unit = object which should have access to UAV/ULB
        _ulbm = name of ULB module - if you don't have a ULB module use nil
        _uavm = name of UAV module - if you don't have a UAV module use nil
        
Example:    nul = [this, ULBM1, nil] execVM "TerminalBackpack.sqf";
            nul = [this, nil, UAVM1] execVM "TerminalBackpack.sqf";
===============================================================================================
*/

private ["_unit", "_uavm", "_ulbm", "_terminal", "_terminalArray", "_unitList", "_newUnitList", "_rules", "_newRules"];

_unit = _this select 0;
_ulbm = _this select 1;
_uavm = nil;                // Funktioniert im Moment nicht
If (isNil "_ulbm" && isNil "_uavm") exitWith{
    hint "ERROR in script TerminalBackpack.sqf!!\n\nBoth modules are NIL, cancel script!!!!"; 
    diag_log text format ["**** ERROR in Script 'TerminalBackpack.sqf' in mission %1!!!", missionName];
    diag_log text format ["**** Both module values (_ulbm / _uavm) are NIL!!!"];
};

// [98,97,99,107,112,97,99,107,95,117,115,95,97,117,118,46,112,51,100] - backpack_us_auv.p3d - Classname: US_UAV_Pack_EP1

While {alive _unit} do {
    _condition = toArray(str(unitBackpack _unit));
    
    If (117 IN _condition && 118 IN _condition && 46 IN _condition) then {
        If (!isNil "_ulbm") then {
            _unitList = _ulbm getVariable "unitList";
            If (!(_unit IN _unitList)) then {
                _newUnitList = _unitList + [_unit];
                _ulbm setVariable ["unitList", _newUnitList, true];
            };
        };
        
        If (!isNil ("_uavm")) then {
            _rules = _uavm getVariable "rules";
            If (!(_unit IN _rules)) then {
                _newRules = _rules + [_unit];
                _uavm setVariable ["rules", _newRules, true];
            };
        };        
    } else {
        If (!isNil "_ulbm") then {
            _unitList = _ulbm getVariable "unitList";
            If (_unit IN _unitList) then {
                _newUnitList = _unitList - [_unit];
                _ulbm setVariable ["unitList", _newUnitList, true];
            };
        };
        
        If (!isNil ("_uavm")) then {
            _rules = _uavm getVariable "rules";
            If (_unit IN _rules) then {
                _newRules = _newRules - [_unit];
                _uavm setVariable ["rules", _newRules, true];
            };
        };
    };

    sleep 2;
};
Cyborg11 ist offline