Forum Jump :

Author Message


Posts: 11
Rank:


Level: Member

Country: us
Location: Arizona
Occupation:
Age:
In-game name:

 
#1 Posted at 2015-11-21 20:16        
     
I was able to finally get a group to spawn via a trigger after reading up on BIS_fnc_spawnGroup I went with the marker method as I have an area where I want a gang to ambush at.
[getMarkerPos "gang", EAST, 5] call BIS_fnc_spawnGroup
Marker name is "gang"
Simple. Now what if I want the group to all look like my gang members using a load out? Loadout

comment "Enemy Gang";

comment "Remove existing items";
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;

comment "Add containers";
this forceAddUniform "U_C_Poor_1";
this addItemToUniform "FirstAidKit";
this addVest "V_PlateCarrierGL_rgr";
for "_i" from 1 to 2 do {this addItemToVest "HandGrenade";};
this addItemToVest "Chemlight_red";
for "_i" from 1 to 3 do {this addItemToVest "7Rnd_408_Mag";};
this addBackpack "B_FieldPack_cbr";
for "_i" from 1 to 2 do {this addItemToBackpack "16Rnd_9x21_Mag";};
this addItemToBackpack "30Rnd_9x21_Mag";
for "_i" from 1 to 14 do {this addItemToBackpack "7Rnd_408_Mag";};
this addHeadgear "H_Bandanna_blu";
this addGoggles "G_Bandanna_beast";

comment "Add weapons";
this addWeapon "srifle_LRR_camo_F";
this addPrimaryWeaponItem "optic_DMS";
this addWeapon "hgun_Rook40_F";
this addHandgunItem "muzzle_snds_L";
this addWeapon "Laserdesignator_02";

comment "Add items";
this linkItem "ItemMap";
this linkItem "ItemCompass";
this linkItem "I_UavTerminal";

comment "Set identity";
this setFace "WhiteHead_16";
this setSpeaker "Male01ENG";
[this,"GryffinRegiment"] call bis_fnc_setUnitInsignia;

I am still learning and I know I can place guys down on the map and simply paste this loadout into their init but I want there to be no ai unless called to keep fps up.
I also want the gang to hunt the player so how would I add: mygangmove getPos player to this?


Author Message


Posts: 1589
Rank:


Level: Member

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

 
#2 Posted at 2015-11-22 00:34        
     
You just have to write a code after this function.
Say, it's for SP (other things to do for MP mission)

_my_group = [getMarkerPos "gang", EAST, 5] call BIS_fnc_spawnGroup;
// personally, I prefer:
_my_group = [_pos, east, [array of units here], [], [], [], [], [], 0] call BIS_fnc_spawnGroup; // where aray of units is something like : ["rhs_vdv_rifleman","rhs_vdv_RShG2","rhs_vdv_grenadier","rhs_vdv_strelok_rpg_assist","rhs_vdv_junior_sergeant"]

then:
{removeAllWeapons _x;
removeAllItems _x;
...
_x addHandgunItem "muzzle_snds_L";
_x addWeapon "Laserdesignator_02";
... } foreach units _my_group;  // _x is a local variable in {...} forEach array   code.

then for waypoint:
_wp = _my_group addWaypoint [getpos player,0];
      _wp setWaypointType "MOVE"; // or "SAD"
      _wp setWaypointBehaviour "COMBAT"; // see all possibilities on BIKI, behavior, combat mode, speed...
and actualize position of player:
 0 = [_wp,_my_group] spawn {while {alive player && (count units (_this select 1)) >0} do {
        sleep 2;
        (_this select 0) setWaypointPosition [getpos player,0]}};
here this loop is spawned because you can continue the script if you need, instead of staying in the loop until a condition fails: player dies or nobody remaining in _my_group. As you spawn (run in parallel), you must pass the arguments (_wp and _my_group).

This post was edited by Pierre MGI (2015-11-22 00:40, 698 days ago)

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

Advertisement


Author Message


Posts: 11
Rank:


Level: Member

Country: us
Location: Arizona
Occupation:
Age:
In-game name:

 
#3 Posted at 2015-11-22 04:40        
     
I see it now. Thank you for laying it out like that it makes complete sense.
I am getting a blank error in editor

_my_group = [getMarkerPos "gang", EAST, 5] call BIS_fnc_spawnGroup;
{removeAllWeapons _x;
removeAllItems _x;
...
_x addHandgunItem "muzzle_snds_L";
_x addWeapon "Laserdesignator_02";
_x addWeapon "srifle_LRR_camo_F";
_x addPrimaryWeaponItem "optic_DMS";
_x addWeapon "hgun_Rook40_F";
_x addHandgunItem "muzzle_snds_L";
_x addWeapon "Laserdesignator_02";
_x forceAddUniform "U_C_Poor_1";
_x addItemToUniform "FirstAidKit";
_x linkItem "ItemMa_x linkItem "ItemCompa_x linkItem "I_UavTerminal";
_x addVest "V_PlateCarrierGL_rgr";
_x addHeadgear "H_Bandanna_blu";
_x addGoggles "G_Bandanna_beast";
... } foreach units _my_group; // _x is a local variable in {...} forEach array code

_wp = _my_group addWaypoint [getpos player,0];
_wp setWaypointType "MOVE"; // or "SAD"
_wp setWaypointBehaviour "COMBAT"; // see all possibilities on BIKI, behavior, combat mode, speed...

0 = [_wp,_my_group] spawn {while {alive player && (count units (_this select 1)) >0} do {
sleep 2;
(_this select 0) setWaypointPosition [getpos player,0]}};

This post was edited by beastxjason (2015-11-22 16:55, 698 days ago)


Author Message


Posts: 1589
Rank:


Level: Member

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

 
#4 Posted at 2015-11-22 17:24        
     
One player hunted but several players means MP. In MP, you need to cope with JIP and respawn.
The initialization order of the initialization is not the same. Have a look at:
https://community.bistudio.com/wiki/Initialization_Order
By the way, you can see some scripts (called event scripts) very useful for JIP and respawn cases).

If you want to spawn something, just call a script with:
if !(isServer) exitWith {};
then the script here,
in init field or in any sqf called from init field but don't forget condition if you don't need to spawn this group at start, or in a trigger, in onact field:
0 = [] spawn {
if !(isServer) exitWith {};
then the script here;
 };
For player(s), you need to define which player is hunted. Player in server means local player if hosted server and none on a dedicated one! Players are localized on each player's PC (the reason you can do what you want when you play) but server keeps their track of course. Name your playable units in editor and add a (loop) condition to hunt one identified player at a time: one player = one objective = one waypoint.

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

Author Message


Posts: 11
Rank:


Level: Member

Country: us
Location: Arizona
Occupation:
Age:
In-game name:

 
#5 Posted at 2015-11-22 18:56        
     
ya I dont want them there at start I want them to be trigger based when entering an area which is why I was trying to do it all via the trigger init. Creating a script is out of my league I have over 9hrs just trying to get these guys to spawn with my loadout.I have so much to learn/
Creating a script would be ideal because I need these guys to ambush player that enter any city but this is a bit out of my league. I tried to look at a dynamic spawn script on here but could not figure out how to make it work with my loadout i want. I will stick with sp and try to get this to work and then move onto mp as I already have issues with the initialization order on a server i run. baby steps. I can see why a lot of people give up on the editor this is a bit overwhelming to do such a simple task. Thanks for your time if I figure it out I will post it here for anybody else trying to do the same thing.


Author Message


Posts: 1589
Rank:


Level: Member

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

 
#6 Posted at 2015-11-23 05:46        
     
You can place a trigger on each city / village you want, or work with locations embedded in world map.
Locations are sometimes disappointing, leaving interesting areas and giving several location sites in a non-strategic place.
If you want to have a rather good idea for existing locations on a map, write in debug console:
0 = []spawn {
_types = ["nameCity","cityCenter","nameCityCapital","nameLocal","nameVillage","hill"];
_radius = [800,600,1000,300,400,500];
_all_locations = [];

for "_i" from 0 to 5 do {
     _type_location = _types select _i;
     _these_Locations = nearestLocations [[worldSize/2,worldSize/2,0],[_type_location] , worldSize/2];
     _weight = _radius select _i;

_all_locations pushback _these_Locations;

_raz = -1;
{
_pos = locationPosition _x;
_text = text (nearestLocation [_pos, ""]);
_text2 = format ["%1%2%3%4","xx",str(round(_pos select 0)),"yy",str(round(_pos select 1))];
call {
if (_text =="") exitWith {_text = _type_location+str(_forEachIndex- _raz)};
if (_text =="power plant" or _text =="factory" or _text =="military" or _text =="quarry" or _text =="dump") exitWith {_text = _text+str(_forEachIndex - _raz)};
     _raz = _raz + 1;
};

          _mark = createMarker [_text2, _pos];
          _mark setMarkerShape "ELLIPSE";
          _mark setMarkerSize [_weight, _weight];
          _mark setMarkerColor "colorBlack";
          _mark setMarkerAlpha 0.5;
          
          _mark1 = createMarker [_text, _pos];
          _mark1 setMarkerType "hd_dot";
          _mark1 setMarkerText _text2;

      } forEach _these_Locations;
};
};
then look at your map!
You can change the end of _mark1 by _mark1 setMarkerText _text to change the text for location's name. I created _text2 for coordinate in several scripts for dynamic missions (to be issued soon).
You can also modify list of locations, adding: "nameMarine" in _types and then for "_i" from 0 to 6... of course.

Step by step!
This code is mine. Use at will.

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