Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
sas troop

Creating group, need some help

Recommended Posts

I am trying to create group, which has randomly selected teammates in it. Here is the script:

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: SaS TrooP
//////////////////////////////////////////////////////////////////

private ["_squad","_member1","_member2","_member3","_member4","_member5","_banditgroup","_soldier1"];
_squad = 
[
"GUE_Soldier_AR",
"GUE_Soldier_CO",
"GUE_Soldier_Crew",
"GUE_Soldier_GL",
"GUE_Soldier_Sniper",
"GUE_Soldier_MG",
"GUE_Soldier_Medic",
"GUE_Soldier_Pilot",
"GUE_Soldier_3",
"GUE_Soldier_2",
"GUE_Soldier_1",
"GUE_Soldier_AT",
"GUE_Soldier_AA",
"GUE_Soldier_Sab",
"GUE_Soldier_Scout",
"GUE_Commander"
];

_member1 = _squad call BIS_fnc_selectRandom;
_member2 = _squad call BIS_fnc_selectRandom;
_member3 = _squad call BIS_fnc_selectRandom;
_member4 = _squad call BIS_fnc_selectRandom;
_member5 = _squad call BIS_fnc_selectRandom;

_banditgroup = creategroup resistance;

"GUE_Soldier_1" createUnit [getMarkerPos "marker_1", _banditgroup,"loon1 = this ;
this addweapon {binocular}", 0.6, "corporal"];
//To this moment no bugs show up, but also unit is not respawning. Lower //parts of the script swarms with bugs. Hard to define what exactly goes //wrong. 
//PS: logic_bandit_group1 was everything from marker through logic ending //on a mine. Still nothing
/*_soldier2 = _member2 createUnit [getMarkerPos "logic_bandit_group1", _banditgroup,"[this] exec {random_arm_hl.sqs}", 0.5, "corporal"];
_soldier3 = _member3 createUnit [getMarkerPos "logic_bandit_group1", _banditgroup,"[this] exec {random_arm_hl.sqs}", 0.6, "corporal"];
_soldier4 = _member4 createUnit [getMarkerPos "logic_bandit_group1", _banditgroup,"[this] exec {random_arm_hl.sqs}", 0.5, "corporal"];
_soldier5 = _member5 createUnit [getMarkerPos "logic_bandit_group1", _banditgroup,"[this] exec {random_arm_hl.sqs}", 0.5, "corporal"];

hint "works";

Share this post


Link to post
Share on other sites

Do you have other Ressistence units on the map?

If not you need to create a center:

for example:

createCenter WEST

Other thing, are you loading the Functions module? Since you are using BIS_fnc_selectRandom.

If you are, just make sure to wait for it to initialize:

if (isNil { BIS_fnc_init }) then { waitUntil { !isNil { BIS_fnc_init } } };

_neo_

Share this post


Link to post
Share on other sites

I have changed thr script to:

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: SaS TrooP
//////////////////////////////////////////////////////////////////

if (isNil { BIS_fnc_init }) then { waitUntil { !isNil { BIS_fnc_init } } }; 
_resHQ = createCenter resistance;
private ["_squad","_member1","_member2","_member3","_member4","_member5","_banditgroup","_soldier1"];
_squad = 
[
   "GUE_Soldier_AR",
   "GUE_Soldier_CO",
   "GUE_Soldier_Crew",
   "GUE_Soldier_GL",
   "GUE_Soldier_Sniper",
   "GUE_Soldier_MG",
   "GUE_Soldier_Medic",
   "GUE_Soldier_Pilot",
   "GUE_Soldier_3",
   "GUE_Soldier_2",
   "GUE_Soldier_1",
   "GUE_Soldier_AT",
   "GUE_Soldier_AA",
   "GUE_Soldier_Sab",
   "GUE_Soldier_Scout",
   "GUE_Commander"
];

_member1 = _squad call BIS_fnc_selectRandom;
_member2 = _squad call BIS_fnc_selectRandom;
_member3 = _squad call BIS_fnc_selectRandom;
_member4 = _squad call BIS_fnc_selectRandom;
_member5 = _squad call BIS_fnc_selectRandom;


_banditgroup = creategroup resistance;

"GUE_Soldier_1" createUnit [getMarkerPos "marker_1", _banditgroup,"loon1 = this ;
this addweapon {binocular}", 0.6, "corporal"];
/*_soldier2 = _member2 createUnit [getMarkerPos "logic_bandit_group1", _banditgroup,"[this] exec {random_arm_hl.sqs}", 0.5, "corporal"];
_soldier3 = _member3 createUnit [getMarkerPos "logic_bandit_group1", _banditgroup,"[this] exec {random_arm_hl.sqs}", 0.6, "corporal"];
_soldier4 = _member4 createUnit [getMarkerPos "logic_bandit_group1", _banditgroup,"[this] exec {random_arm_hl.sqs}", 0.5, "corporal"];
_soldier5 = _member5 createUnit [getMarkerPos "logic_bandit_group1", _banditgroup,"[this] exec {random_arm_hl.sqs}", 0.5, "corporal"];

hint "works";

But unit still simply don't respawn. I have currently no idea. Marker created properly and -what is the best - just to see if it works I am using example from BIWiki:

http://community.bistudio.com/wiki/createUnit

Only name of the group has changed.

Share this post


Link to post
Share on other sites

You can use this to check if the funtions module is init. It is much simpler and less room for an error.

waituntil {!isnil "bis_fnc_init"};

Edited by Riouken

Share this post


Link to post
Share on other sites

Lads, o be honest, BIS function is the thing I care least...

I unpacked SEAL Team Six campaign, there is syntacs of group creation eg:

_Unit3= Grp2 createUnit ["GUE_Soldier_1",[(getMarkerPos "Airfield1") select 0,(getMarkerPos "Airfield1") select 1,0],[],0,"FORM"];

Naturally set whole command to my situaction and still nothing happens and no error is returned, both in game and .rtp format.

Share this post


Link to post
Share on other sites

Here is a segemtent of code from a mission that I made a couple of weeks ago that uses BIS_fnc_spawnGroup, hopefully you can get some ideas from it.

if (dif_hard) then
{
   _pos = (getMarkerPos (_markers select (floor(random(count _markers)))));
   _pos2 = (getMarkerPos (_markers select (floor(random(count _markers)))));
   _pos3 = (getMarkerPos (_markers select (floor(random(count _markers))))); 
   _pos4 = (getMarkerPos (_markers select (floor(random(count _markers)))));
   _pos5 = (getMarkerPos (_markers select (floor(random(count _markers)))));
   _pos6 = (getMarkerPos (_markers select (floor(random(count _markers))))); 

   grp1 = [_pos, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp2 = [_pos2, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp3 = [_pos3, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp4 = [_pos4, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp5 = [_pos5, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp8 = [_pos6, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;

   [grp8, getMarkerPos "m24",75 ] call bis_fnc_taskPatrol;
};

Share this post


Link to post
Share on other sites

Problem solved. I suggest not to ask what was exactly wrong...

Thank you for your help!

Share this post


Link to post
Share on other sites
Sign in to follow this  

×