redo arsenal scripting

This commit is contained in:
commy2 2017-12-22 19:44:31 +01:00
parent 774aca4a1d
commit 6865c95f16
4 changed files with 102 additions and 71 deletions

View File

@ -1,6 +1,7 @@
#include "script_component.hpp"
enableSaving [false, false];
cba_diagnostic_projectileMaxLines = 10;
[QGVAR(displayOpened), {
private _player = player;
@ -9,13 +10,13 @@ enableSaving [false, false];
[{
switch (true) do {
case (primaryWeapon _this != ""): {
[_this, "amovpercmstpslowwrfldnon", 2] call EFUNC(common,doAnimation);
_this switchMove "amovpercmstpslowwrfldnon";
};
case (handgunWeapon _this != ""): {
[_this, "amovpercmstpslowwpstdnon", 2] call EFUNC(common,doAnimation);
_this switchMove "amovpercmstpslowwpstdnon";
};
default {
[_this, "amovpercmstpsnonwnondnon", 2] call EFUNC(common,doAnimation);
_this switchMove "amovpercmstpsnonwnondnon";
};
};
}, _player] call CBA_fnc_execNextFrame;
@ -24,7 +25,7 @@ enableSaving [false, false];
{
_x enableSimulation false;
_x hideObject true;
} forEach (entities [[], [], true] - [_player]);
} forEach (allMissionObjects "" - [_player]);
_player call CBA_fnc_removeUnitTrackProjectiles;
_player setFatigue 0;
@ -37,7 +38,7 @@ enableSaving [false, false];
{
_x enableSimulation true;
_x hideObject false;
} forEach entities [[], [], true];
} forEach allMissionObjects "";
// update VR unit gear
{

View File

@ -1,8 +1,9 @@
#include "script_component.hpp"
private ["_pos","_side","_obj","_grp","_type","_target"];
_pos = [_this,0,[],[[],objnull]] call bis_fnc_param;
_type = [_this,1,"B_Soldier_VR_F",["",objnull]] call bis_fnc_param;
//_pos = [_this,0,[],[[],objnull]] call bis_fnc_param;
//_type = [_this,1,"B_Soldier_VR_F",["",objnull]] call bis_fnc_param;
params ["_type", "_pos"];
_obj = _pos;
_grp = grpnull;

View File

@ -4,13 +4,11 @@ params ["_display"];
private _ctrlButtonAbort = _display displayCtrl 104;
_ctrlButtonAbort ctrlSetText localize LSTRING(Mission);
_ctrlButtonAbort ctrlSetEventHandler [
"ButtonClick", {
params ["_control"];
ctrlParent _control closeDisplay 2;
{[player, player, true] call FUNC(openBox)} call CBA_fnc_execNextFrame;
true
} call EFUNC(common,codeToString)
];
_ctrlButtonAbort ctrlSetEventHandler ["ButtonClick", {
params ["_control"];
ctrlParent _control closeDisplay 2;
{[player, player, true] call FUNC(openBox)} call CBA_fnc_execNextFrame;
true
} call EFUNC(common,codeToString)];
true

View File

@ -4,67 +4,73 @@ params ["_unit"];
_unit allowDamage false;
/*
//--- Static targets in various distance
{
_pos = [_unit,_x,180 + _foreachindex] call bis_fnc_relpos;
[_pos,"O_Soldier_VR_F"] call arsenal_fnc_createTarget;
} foreach [10,20,30,40,50,100,500,1000,2000];
private _position = _unit getRelPos [_x, _forEachIndex];
["O_Soldier_VR_F", _position] call FUNC(createTarget);
} forEach [10, 20, 30, 40, 50, 100, 500, 1000, 2000];
//--- Target line
_pos = [_unit,20,90] call bis_fnc_relpos;
private _position = _unit getRelPos [20, -90];
for "_i" from 0 to 5 do {
_iPos = [(_pos select 0),(_pos select 1) - 3 + _i,0];
[_ipos,"O_Soldier_VR_F"] call arsenal_fnc_createTarget;
private _position = _position vectorAdd [0, -3 + _i, 0];
["O_Soldier_VR_F", _position] call FUNC(createTarget);
};
//--- Target cluster
_pos = [_unit,20,-90] call bis_fnc_relpos;
for "_i" from 0 to 8 do {
_index = floor (_i / 3);
_iPos = [
(_pos select 0) + _index * 1.5,
(_pos select 1) + 1.5 + (_i % 3),
0
];
_target = [_ipos,"O_Soldier_VR_F"] call arsenal_fnc_createTarget;
_position = _unit getRelPos [20, 90];
_target switchmove (["aidlpercmstpslowwrfldnon","aidlpknlmstpslowwrfldnon_ai","aidlppnemstpsraswrfldnon_ai"] select _index);
_target setunitpos (["up","middle","down"] select _index);
for "_i" from 0 to 8 do {
private _index = floor (_i / 3);
private _position = _position vectorAdd [_index * 1.5, 1.5 + (_i % 3), 0];
private _target = ["O_Soldier_VR_F", _position] call FUNC(createTarget);
_target switchMove (["aidlpercmstpslowwrfldnon", "aidlpknlmstpslowwrfldnon_ai", "aidlppnemstpsraswrfldnon_ai"] select _index);
_target setUnitPos (["UP", "MIDDLE", "DOWN"] select _index);
};
//--- Target patrol
_grp = creategroup east;
{
_wp = _grp addwaypoint [[_unit,10,_x] call bis_fnc_relpos,0];
if (_foreachindex == 4) then {_wp setwaypointtype "cycle";};
} foreach [0,90,180,270,0];
private _group = createGroup east;
{
private _position = _unit getRelPos [10, _x];
private _waypoint = _group addWaypoint [_position, 0];
if (_forEachIndex == 4) then {
_waypoint setWaypointType "CYCLE";
};
} forEach [0, 90, 180, 270, 0];
_position = _unit getRelPos [10, 180];
_pos = [_unit,10,0] call bis_fnc_relpos;
for "_i" from 0 to 1 do {
_target = [_pos,"O_Soldier_VR_F"] call arsenal_fnc_createTarget;
[_target] join _grp;
private _target = ["O_Soldier_VR_F", _position] call FUNC(createTarget);
[_target] join _group;
_target stop false;
_target enableai "move";
_target setspeedmode "limited";
_target enableAI "MOVE";
_target setSpeedMode "LIMITED";
};
/*
//--- Armored vehicles
_vehicles = [];
if (isclass (configfile >> "cfgvehicles" >> "Land_VR_Target_MRAP_01_F")) then {
_step = 15;
_posCenter = [position _unit select 0,(position _unit select 1) + 30,0];
_positionCenter = [position _unit select 0,(position _unit select 1) + 30,0];
{
_row = _foreachindex;
_rowCount = (count _x - 1) * 0.5;
{
_pos = [
(_posCenter select 0) + (-_rowCount + _foreachindex) * _step,
(_posCenter select 1) + _row * _step,
_position = [
(_positionCenter select 0) + (-_rowCount + _foreachindex) * _step,
(_positionCenter select 1) + _row * _step,
0
];
_veh = createvehicle [_x,_pos,[],0,"none"];
_veh setpos _pos;
_veh = createvehicle [_x,_position,[],0,"none"];
_veh setpos _position;
_veh setdir 180;
_veh setvelocity [0,0,-1];
[_veh] call bis_fnc_VRHitpart;
@ -96,42 +102,67 @@ _vehicles spawn {
_allDisabled
};
setstatvalue ["MarkMassVirtualDestruction",1];
};
};*/
//--- Cover objects
_coverObjects = [
private _coverObjects = [
"Land_VR_CoverObject_01_kneel_F",
"Land_VR_CoverObject_01_kneelHigh_F",
"Land_VR_CoverObject_01_kneelLow_F",
"Land_VR_CoverObject_01_stand_F",
"Land_VR_CoverObject_01_standHigh_F"
];
_dis = 3;
for "_i" from 5 to 11 do {
_dir = _i * 45;
_pos = [position _unit,(abs sin _dir + abs cos _dir) * _dis,_dir] call bis_fnc_relpos;
_block = createvehicle [_coverObjects select (_i % count _coverObjects),_pos,[],0,"none"];
_block setpos _pos;
private _direction = 180 + _i * 45;
private _position = _unit getRelPos [(abs sin _direction + abs cos _direction) * 3, _direction];
private _block = createVehicle [_coverObjects select (_i % count _coverObjects), _position, [], 0, "NONE"];
_block setPos _position;
};
//--- Starting point
_square = createvehicle ["VR_Area_01_square_1x1_grey_F",position _unit,[],0,"none"];
_square setpos position _unit;
_marker = createmarker ["bis_start",position _unit];
_marker setmarkertype "mil_start";
private _square = createVehicle ["VR_Area_01_square_1x1_grey_F", position _unit, [], 0, "NONE"];
_square setPosASL getPosASL _unit;
//--- Garage position
_centerPos = [_unit,[16,16,0] vectorDistance [0,0,0],135] call bis_fnc_relpos;
_squareGarage = createvehicle ["VR_Area_01_square_4x4_grey_F",_centerPos,[],0,"none"];
_squareGarage setpos _centerPos;
BIS_fnc_garage_center = createvehicle ["Land_HelipadEmpty_F",_centerPos,[],0,"none"];
BIS_fnc_garage_center setpos _centerPos;
BIS_fnc_garage_center enablesimulation false;
*/
private _marker = createMarker [QGVAR(start), getPosWorld _unit];
_marker setMarkerType "mil_start";
//--- Open Arsenal
[_unit, true, false] call FUNC(initBox);
[{!isNull findDisplay 46}, {
[player, player, true] call FUNC(openBox);
}] call CBA_fnc_waitUntilAndExecute;
[_this, _this, true] call FUNC(openBox);
}, _unit] call CBA_fnc_waitUntilAndExecute;
//--- Salute
_unit addEventHandler ["AnimChanged", {
params ["_unit", "_anim"];
_anim = _anim splitString "_";
if ("salute" in _anim) then {
{
_x playAction "salute";
} forEach ((_unit nearObjects ["CAManBase", 10]) - [_unit]);
};
}];
["#(argb,8,8,3)color(0,0,0,1)", false, nil, 0.1, [0,0.5]] spawn BIS_fnc_textTiles;
//--- Target markers
/*[] spawn {
_targets = [];
{
_targets pushback vehiclevarname _x;
_var = vehiclevarname _x;
_marker = createmarker [_var,position _x];
_marker setmarkertype "mil_dot";
_marker setmarkercolor "colororange";
} foreach (allmissionobjects "man") - [player];
while {true} do {
{
_t = missionnamespace getvariable _x;
(vehiclevarname _t) setmarkerpos position _t;
} foreach _targets;
sleep 0.1;
};
};