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

Als ich die Lösung geschrieben habe, wusste ich noch nicht, dass man so den Backpack nicht überprüfen kann. Habe da aber ein andere Lösung

Mein Skript ist fertig. Nur funktioniert das mit dem UAV nicht, da man das UAV nur an einem Fahrzeug / leeren Objekt aktivieren kann. Ich schau einfach mal, ob ich es doch irgendwie hinbekomme. Wir werden sehen. Ich poste dann einfach das neue Skript, wenn ich Erfolg hatte

Aber hier die Skriptlösung für das ULB:
Code:
/*
===============================================================================================
TerminalBackpack - by Cyborg11
Version: 1.0
Date: 01.07.2010
Description:    A unit with a UAV Terminal Backpack has access to an ULB
                1. Synchronize the ULB to the ULB module
                2. Execute the script on the soldier that should have the action
                
Parameter: nul = [unit, ULB module] execVM "TerminalBackpack.sqf";
        _unit = object which should have access to UAV/ULB
        _ulbm = name of ULB module
        
Example:    nul = [this, ULBM1] execVM "TerminalBackpack.sqf";
===============================================================================================
*/

private ["_unit", "_ulbm", "_unitList", "_newUnitList"];

_unit = _this select 0;
_ulbm = _this select 1;
If (isNil "_ulbm") exitWith{
    hint "ERROR in script TerminalBackpack.sqf!!\n\nULB module is NIL, cancel script!!!!"; 
    diag_log text format ["**** ERROR in Script 'TerminalBackpack.sqf' in mission %1!!!", missionName];
    diag_log text format ["**** Module _ulbm is 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";
            _newUnitList = _unitList + [_unit];
            _ulbm setVariable ["unitList", _newUnitList, true];
        };
    } else {
        If (!isNil "_ulbm") then {
            _newUnitList = _newUnitList - [_unit];
            _ulbm setVariable ["unitList", _newUnitList, true];
        };
    };

    sleep 2;
};
Funktioniert. Hab ich gestern getestet
Cyborg11 ist offline