Forum Jump :

Author Message


Posts: 55
Rank:


Level: Member

Country: de
Location: Hamburg
Occupation:
Age: 20
In-game name: Nerodenecro

 
#1 Posted at 2016-03-30 17:33        
     
Hey guys,

so wak once posted a script sandbag.sqf. It spawns a Sandbag if you scroll down and choose it, IF you have a Toolkit in your inventory.

That's the Script, full credit to wak!

removeSandbagAction = ["Remove Sandbag", {
    _unit = _this select 1;
    [_this select 0, _this select 2] remoteExec ["removeAction", 0, true];
    _anim = "AinvPknlMstpSnonWnonDnon_medic_1";
    _unit playMove _anim;
    waitUntil {animationState _unit == _anim || !alive _unit};
    waitUntil {animationState _unit != _anim || !alive _unit};
    if (!alive _unit) exitWith {};
    deleteVehicle (_this select 0);
}, [], 5, true, true, "", "'ToolKit' in items _this && (_target distance _this) < 3"];
putSandbagAction = ["Place Sandbag", {
    _unit = _this select 1;
    _anim = "AinvPknlMstpSnonWnonDnon_Putdown_AmovPknlMstpSnonWnonDnon";
    _unit playMove _anim;
    waitUntil {animationState _unit == _anim || !alive _unit};
    waitUntil {animationState _unit != _anim || !alive _unit};
    if (!alive _unit) exitWith {};
    _veh = createVehicle ["Land_BagFence_Long_F", _unit modelToWorld [0, 1.5, 0], [], 0, "CAN_COLLIDE"];
    _veh setDir (getDir _unit);
    [_veh, removeSandbagAction] remoteExec ["addAction", side _unit, true];
}, [], 4, true, true, "", "_this isEqualTo _target && 'ToolKit' in items _this"];
player addAction putSandbagAction;
player addEventHandler ["Respawn", {(_this select 0) addAction putSandbagAction}];

I tried to change it so you can spawn a Black Hornet UAV(Mod) if you got a UAV Terminal.

removeUAVAction = ["Remove UAV", {
    _unit = _this select 1;
    [_this select 0, _this select 2] remoteExec ["removeAction", 0, true];
    _anim = "AinvPknlMstpSnonWnonDnon_medic_1";
    _unit playMove _anim;
    waitUntil {animationState _unit == _anim || !alive _unit};
    waitUntil {animationState _unit != _anim || !alive _unit};
    if (!alive _unit) exitWith {};
    deleteVehicle (_this select 0);
}, [], 5, true, true, "", "'B_UavTerminal' in items _this && (_target distance _this) < 3"];
putUAVAction = ["Place UAV", {
    _unit = _this select 1;
    _anim = "AinvPknlMstpSnonWnonDnon_Putdown_AmovPknlMstpSnonWnonDnon";
    _unit playMove _anim;
    waitUntil {animationState _unit == _anim || !alive _unit};
    waitUntil {animationState _unit != _anim || !alive _unit};
    if (!alive _unit) exitWith {};
    _veh = createVehicle ["tut_R22", _unit modelToWorld [0, 1.5, 0], [], 0, "CAN_COLLIDE"];
    _veh setDir (getDir _unit);
    [_veh, removeUAVAction] remoteExec ["addAction", side _unit, true];
}, [], 4, true, true, "", "_this isEqualTo _target && 'B_UavTerminal' in items _this"];
player addAction putUAVAction;
player addEventHandler ["Respawn", {(_this select 0) addAction putUAVAction}];

Calling the Script from the Init
if (hasInterface) then {[] execVM "UAV.sqf"};

It doesn't work the way I tried it may someone help? Maybe wak? :D

Regards,

Nerodenecro


Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 20
In-game name: Wak

 
#2 Posted at 2016-03-30 19:39        
     
You have to add createVehicleCrew to spawn a UAV.

UAVs secretly have crew inside them, because of AI reasons.

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Advertisement


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#3 Posted at 2016-03-30 20:05        
     
"B_UavTerminal" in items _this; means that the terminal is in the unit's backpack...
"B_UavTerminal" in assigneditems _this; means that the terminal is in its slot, ready to work.

"TUT_R22" ? must be in your cfgVehicles. Not my case. And must be a BLUFOR UAV (side = 1) to work with this terminal.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 55
Rank:


Level: Member

Country: de
Location: Hamburg
Occupation:
Age: 20
In-game name: Nerodenecro

 
#4 Posted at 2016-03-31 11:53        
     
# Pierre MGI : "B_UavTerminal" in items _this; means that the terminal is in the unit's backpack...
"B_UavTerminal" in assigneditems _this; means that the terminal is in its slot, ready to work.

So I tried this, now I can place the UAV's but I'm not a scripting guy..I like to use them but I'm not good at it at all.
So what exactly do I have to add to the Script, I know as mentioned by wak the createVehicleCrew. I tried to get something done on my own but it doesn't work.
Could you help me out once more?

Regards,

Nerodenecro


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#5 Posted at 2016-03-31 17:27        
     
This should work... if your "TUT_R22" is an UAV! That means it inherits of "B_UAV_01_F" class or is a kind of "UAV_01_base_F", BLUFOR sided.
In other words, check your "TUT_R22" in cfgVehicles (config viewer) and tell what it is exactly.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS