sábado, 23 de febrero de 2019

Script to spawn specific enemies

Script para spawnear enemigos especificos / Script to spawn specific enemies
you can add more classes to use with the script

Descarga / Download

Or create a file named codegab_spawnenemies.sqf

/*****************************************************************
 Script file for Arma 3
 Created by: Codegab
 Crea enemigos a partir de un array
 Uso sin devolver el grupo / Usage without return the group
  [[[25, 342, 0], 0, 2, 8, 6]] execVM "codegab_spawnenemies.sqf";
  [[ getmarkerpos "marker_2", 0, 2, 8, 6, 5, 9, 1, 1, 1, 1]] execVM "codegab_spawnenemies.sqf"; 

 Si queremos que nos devuelva el grupo / If we want the returning group
  En Init.sqf / In init.sqf
  codegab_spawnenemies = compile preprocessFile "code_spawnenemies.sqf";

  llamo la funcion / call the function
  _grupo =[[posicion, 0, 2, 8, 6]] call codegab_spawnenemies;
  _grupo = [[ getmarkerpos "marker_2", 0, 2, 8, 6, 5, 9, 1, 1, 1, 1]] call codegab_spawnenemies; 
/***************************************************************/

//posibles enemigos CSAT:
0 = O_G_Soldier_lite_F Rifleman (Light)
1 = O_G_Soldier_SL_F Squad Leader
2 = O_G_Soldier_TL_F Team Leader
3 = O_G_Soldier_AR_F Autorifleman
4 = O_G_medic_F Combat Life Saver
5 = O_G_engineer_F Engineer
6 = O_G_Soldier_exp_F Explosive Specialist
7 = O_G_Soldier_GL_F Grenadier
8 = O_G_Soldier_M_F Marksman
9 = O_G_Soldier_LAT_F Rifleman (AT)
10 = O_G_Soldier_A_F Ammo Bearer
11 = O_G_officer_F Officer
12 = O_G_Soldier_unarmed_F Rifleman (Unarmed)
13 = O_G_Survivor_F Survivor

//CUP Takistani Militia
21 = CUP_O_TK_INS_Soldier_AA Specialist
22 = CUP_O_TK_INS_Soldier_AR Automatic rifleman
23 = CUP_O_TK_INS_Gerrilla_Medic Bonnester
24 = CUP_O_TK_INS_Soldier_MG Maachinegunner
25 = CUP_O_TK_INS_Bomber Militia bomb builder
26 = CUP_O_TK_INS_Mechanic Militia mechanic
27 = CUP_O_TK_INS_Soldier_GL AK74 GL
28 = CUP_O_TK_INS_Soldier AK 74
29 = CUP_O_TK_INS_Soldier_FNFAL FN Fal
30 = CUP_O_TK_INS_Soldier_Enfield Lee-Enfield
31 = CUP_O_TK_INS_Soldier_AAT RPG Ammo
32 = CUP_O_TK_INS_Soldier_AT RPG 7
33 = CUP_O_TK_INS_Sniper Sniper
34 = CUP_O_TK_INS_Soldier_tL Team leader
35 = CUP_O_TK_INS_Commander Warlord

*/

Params ["_array"];
_posicion = _array deleteAT 0;

_group = createGroup [east, true]; //creo el grupo al que van a pertenecer, bando este

{
_unit = nil;
switch (_x) do {
case 0: {_unit = "O_G_Soldier_lite_F";};
case 1: {_unit = "O_G_Soldier_SL_F";};
case 2: {_unit = "O_G_Soldier_TL_F";};
case 3: {_unit = "O_G_Soldier_AR_F";};
case 4: {_unit = "O_G_medic_F";};
case 5: {_unit = "O_G_engineer_F";};
case 6: {_unit = "O_G_Soldier_exp_F";};
case 7: {_unit = "O_G_Soldier_GL_F";};
case 8: {_unit = "O_G_Soldier_M_F";};
case 9: {_unit = "O_G_Soldier_LAT_F";};
case 10: {_unit = "O_G_Soldier_A_F";};
case 11: {_unit = "O_G_officer_F";};
case 12: {_unit = "O_G_Soldier_unarmed_F";};
case 13: {_unit = "O_G_Survivor_F";};

case 21: {_unit = "CUP_O_TK_INS_Soldier_AA";};
case 22: {_unit = "CUP_O_TK_INS_Soldier_AR";};
case 23: {_unit = "CUP_O_TK_INS_Gerrilla_Medic";};
case 24: {_unit = "CUP_O_TK_INS_Soldier_MG";};
case 25: {_unit = "CUP_O_TK_INS_Bomber";};
case 26: {_unit = "CUP_O_TK_INS_Mechanic";};
case 27: {_unit = "CUP_O_TK_INS_Soldier_GL";};
case 28: {_unit = "CUP_O_TK_INS_Soldier";};
case 29: {_unit = "CUP_O_TK_INS_Soldier_FNFAL";};
case 30: {_unit = "CUP_O_TK_INS_Soldier_Enfield";};
case 31: {_unit = "CUP_O_TK_INS_Soldier_AAT";};
case 32: {_unit = "CUP_O_TK_INS_Soldier_AT";};
case 33: {_unit = "CUP_O_TK_INS_Sniper";};
case 34: {_unit = "CUP_O_TK_INS_Soldier_tL";};
case 35: {_unit = "CUP_O_TK_INS_Commander";};

default {_unit = "O_G_Soldier_lite_F";};

};
//crea un enemigo en _posicion
_unit createunit [_posicion, _group];

} forEach _array;

//devuelvo el grupo
_group;

/***************************************************************/

A simple menu for a VIP, or a hostage.

Agrega las siguientes opciones a una unidad en el menu de la rueda del raton
Add the following options to the mouse wheel of a unit:


"Follow me"
"Stay here"
"Look for a house to hide"
"Where safe now"
"Hurry up"
"Get in that vehicle"
"Get out the vehicle"

Descarga / Download

Or create a script named VipMenu.sqf

03/13/19, change in waypoint deletion

/* ****************************************************************
Script file for ArmA 3: VipMenu.sqf

Created by: Codegab

Date: 2019-02-19


A una unidad se le asigna un menu en la rueda del raton con los comandos / Add the following options to the mouse wheel of a unit:
"Follow me"
"Stay here"
"Look for a house to hide"
"Where safe now"
"Hurry up"
"Get in that vehicle"
"Get out the vehicle"

variables del vip / variables of the VIP:
estado= si esta siguiendo al player o esta quieto / if the vip is following the player or not
auto=auto asignado / assigned car

Se llama en el init del Vip / It is called on the init of the VIP:
[this] execVM "VipMenu.sqf";

Para tener mas de un vip en la mision:
Se debe copiar el archivo de script y cambiar la linea vipunitmission = _unit por vipunitmission2 = _unit y asi sucesivamante

To have more than one VIP on the mission:
You must copy the script file and change the line vipunitmission = _unit to vipunitmission2 = _unit and so on


 while {(count (waypoints _group)) > 0} do
 {
  deleteWaypoint ((waypoints _group) select 0);
 };
while {(count (waypoints group vipunitmission)) > 0} do
{
deleteWaypoint ((waypoints group vipunitmission) select 0);
};
 *****************************************************************/

params ["_unit"];

vipunitmission = _unit;

vipunitmission setVariable ["estado", false,true];
vipunitmission setVariable ["auto", "no",true];


vipunitmission addAction ["<t size='1'><t color='#ffff00'>" + "Follow me" + "</t></t>", {
_jugador = player;
[vipunitmission,"Behind you"] remoteExec ["globalChat", 0];
vipunitmission setVariable ["estado", true,true];
while {vipunitmission getVariable "estado"} do
{
if (vipunitmission distance _jugador > 5) then
{
//deleteWaypoint [group vipunitmission, 0];
while {(count (waypoints group vipunitmission)) > 0} do
{
deleteWaypoint ((waypoints group vipunitmission) select 0);
};
group vipunitmission addWaypoint [_jugador getRelPos [2, 180], 0];
}else
{
deleteWaypoint [group vipunitmission, 0]; 
};
sleep 2;
};
}];

vipunitmission addAction ["<t size='1'><t color='#ffff00'>" + "Stay here" + "</t></t>", {
vipunitmission setVariable ["estado", false, true];
while {(count (waypoints group vipunitmission)) > 0} do
{
deleteWaypoint ((waypoints group vipunitmission) select 0);
};
[vipunitmission,"Staying here"] remoteExec ["globalChat", 0];
}];


vipunitmission addAction ["<t size='1'><t color='#ffff00'>" + "Look for a place to hide" + "</t></t>", {
vipunitmission setVariable ["estado", false, true];
(group vipunitmission) setBehaviour "COMBAT";

_nBuilding = nearestObjects [player, ["House"], 50];

if (count _nBuilding > 0) then
{
_house = _nBuilding select 0;
[vipunitmission,"Running away"] remoteExec ["globalChat", 0];
//deleteWaypoint [group vipunitmission, 0];
while {(count (waypoints group vipunitmission)) > 0} do
{
deleteWaypoint ((waypoints group vipunitmission) select 0);
};
group vipunitmission addWaypoint [_house getRelPos [5, 0], 0];
}else
{
[vipunitmission,"I can't see a fu...... good place!!!"] remoteExec ["globalChat", 0];
};
}];


vipunitmission addAction ["<t size='1'><t color='#ffff00'>" + "We are safe now" + "</t></t>", {
(group vipunitmission) setBehaviour "SAFE";
(group vipunitmission) setSpeedMode "LIMITED";
[vipunitmission,"Ok, thanks"] remoteExec ["globalChat", 0];
}];

vipunitmission addAction ["<t size='1'><t color='#ffff00'>" + "Hurry up" + "</t></t>", {
(group vipunitmission) setBehaviour "COMBAT";
(group vipunitmission) setSpeedMode "NORMAL";
[vipunitmission,"Let's go"] remoteExec ["globalChat", 0];
}];

vipunitmission addAction ["<t size='1'><t color='#ffff00'>" + "Get in that vehicle" + "</t></t>", {
vipunitmission setVariable ["estado", false, true];
//deleteWaypoint [group vipunitmission, 0];
while {(count (waypoints group vipunitmission)) > 0} do
{
deleteWaypoint ((waypoints group vipunitmission) select 0);
};
_vehiculos = nearestObjects [player, ["Car","Helicopter", "Boat", "Tank", "Plane"], 50];
if (count _vehiculos > 0) then
{
[vipunitmission,"Geting in"] remoteExec ["globalChat", 0];
_car = _vehiculos select 0;
vipunitmission setvariable ["auto", _car, true];
vipunitmission assignAsCargo _car;
[vipunitmission] orderGetIn true;
_car addAction ["<t size='1'><t color='#ffff00'>" + "Get out the vehicle" + "</t></t>", {
[vipunitmission,"Geting out"] remoteExec ["globalChat", 0];
[vipunitmission] orderGetIn false;
dogetout vipunitmission;
unassignVehicle vipunitmission;
_car = vipunitmission getvariable "auto";
removeAllActions _car;
}];
}else
{
[vipunitmission,"I can't see the vehicle"] remoteExec ["globalChat", 0];
};
 
}];