Jump to content
3l0ckad3

BIS_fnc_spawnGroup; Question.

Recommended Posts


Okay, after I spawn a unit in from BIS_fnc_spawnGroup, can I manipulate them with syntax in game ? or is their functions only able to be utilized within the sqf ?
 

          // Alpha East
        if (isServer) then {

_unit = [getmarkerpos "unitS, EAST, ["O_Survivor_F"],[],[],[],[],[],265.921] call BIS_fnc_spawnGroup;
_unit = call compile "New Name"; //what exactly will this do ? and can I pass scropt to them somehow ?

_wp1 = _unit addWaypoint [getmarkerpos "owp2", 0];
    _wp1 setWaypointType "MOVE";
    _wp1 setWaypointSpeed "NORMAL";
    _wp1 setWaypointBehaviour "AWARE";
    _wp1 setWaypointFormation "LINE";
    _wp1 setWaypointCombatMode "RED";
    _wp1 setWaypointCompletionRadius 5;
    _wp1 setWaypointDescription "Move here.";
    _wp1 setWaypointTimeout [60, 60, 60];
    
};

So, the premise of this little test is to see if I can pull crew out of a heli, and then spawn two pilots and two crew members.
Why you say ? because when they are all grouped up they won't shoot if fired upon, because the pilot has to be in a carless to land the heli under fire.
So, I want the ability to have the crew  grouped to the other crew, and the pilots grouped, that way the crew can be set to aware, and the pilots  in careless.

My issue is that vehicle inits are no longer accessible so easily , so, would this be a good way to give them a name in game ??


    

 

I didn't post the real project, 'ecause I figured it was much easier to mull over the same idea in a smaller form.
So, in short, if I can't get their name, or init, can I change their name that, way they would be  would be accessible during the game.
But, so far I can't do much with them once they've been spawned in. 

Share this post


Link to post
Share on other sites

Don't Call Compile "New Name", that will error.

BIS_fnc_SpawnGroup returns the group created, not the unit, i.e:    _group = [<< params >> ] call BIS_fnc_SpawnGroup;

Use Units command to select the unit from the group, i.e.:   _unit = (Units _group) select 0;

If you want the unit available to other scripts, define it as a global variable rather than a local one, i.e.:    NewUnit = (Units _group) select 0;

If you want other machines to use the unit in scripts, broadcast it as a public variable, i.e.:    PublicVariable "NewUnit";

Waypoints are a group function.  Use the group, not the unit, i.e.:   _wp1 = _group addWaypoint [getmarkerpos "owp2", 0];

 

Hope this helps.

  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, opusfmspol said:

Don't Call Compile "New Name", that will error.

BIS_fnc_SpawnGroup returns the group created, not the unit, i.e:    _group = [<< params >> ] call BIS_fnc_SpawnGroup;

Use Units command to select the unit from the group, i.e.:   _unit = (Units _group) select 0;

If you want the unit available to other scripts, define it as a global variable rather than a local one, i.e.:    NewUnit = (Units _group) select 0;

If you want other machines to use the unit in scripts, broadcast it as a public variable, i.e.:    PublicVariable "NewUnit";

Waypoints are a group function.  Use the group, not the unit, i.e.:   _wp1 = _group addWaypoint [getmarkerpos "owp2", 0];

 

Hope this helps.

Thank you very much for your reply, I'm where I always am, in my editor, and I think this is exactly what I was looking for, so I'll put it to the test.
 

 

Share this post


Link to post
Share on other sites
3 hours ago, 3l0ckad3 said:

So, the premise of this little test is to see if I can pull crew out of a heli, and then spawn two pilots and two crew members.
Why you say ? because when they are all grouped up they won't shoot if fired upon, because the pilot has to be in a carless to land the heli under fire.
So, I want the ability to have the crew  grouped to the other crew, and the pilots grouped, that way the crew can be set to aware, and the pilots  in careless.

 

I didn't post the real project, 'ecause I figured it was much easier to mull over the same idea in a smaller form.
So, in short, if I can't get their name, or init, can I change their name that, way they would be  would be accessible during the game.
But, so far I can't do much with them once they've been spawned in. 

 

Place your helo as usual. In init field of the helo:

  driver this setBehaviour "SAFE"; driver this disableAI "autoCombat";

 

This will do the trick: a "safe" driver following waypoints and landing among battle; gunners returning fire after automatic shift to combat mode.

But...

Once in these behaviors, that doesn't mean helo will return fire at once. Most of the time, gunners can be shot before using Gatlings... (tested with Huron)

 

 

Share this post


Link to post
Share on other sites
21 hours ago, pierremgi said:

 

Place your helo as usual. In init field of the helo:

  driver this setBehaviour "SAFE"; driver this disableAI "autoCombat";

 

This will do the trick: a "safe" driver following waypoints and landing among battle; gunners returning fire after automatic shift to combat mode.

But...

Once in these behaviors, that doesn't mean helo will return fire at once. Most of the time, gunners can be shot before using Gatlings... (tested with Huron)

 

 

For editor placed units I group and set both pilots to careless, and then I group the crew and set them to aware, and it works perfectly, the heli will even land on enemy units, and the crew will return fire lol
However, I'm working on a script, so, the way that it is written out so far is that you call it in, and you click on the map where you want it to pick you up and drop you off, but, I need the pilots and crew separated, so, I need to be able to get into their inits somehow, and I'm aware the vehicle inits are somewhat disabled ever since that dude was destroying servers back in 2013. So, this lil project I'm working on is to pass commands after the unit is spawned. I think I might have to spawn them 2 by 2 with the bis spawn fnc, and then spawn the chopper, and have them get into it, so that way I can better control their pairing, and commands passed.. 

Share this post


Link to post
Share on other sites

You can spawn a group, at once, with bis_fnc_spawnGroup. (You can place another group in cargo or all ai units in the same group).

Then you can do what you want without reference to the "init field" like edited:

 

_grp1 = [_pos, west,["B_Heli_Transport_03_F"], [], [], [], [], [], 0] call BIS_fnc_spawnGroup;
_lead1 = leader _grp1;

_veh = vehicle _lead1;

driver _veh setBehaviour "SAFE";

driver _veh disableAI "autoCombat";

 

  • Like 2

Share this post


Link to post
Share on other sites
6 hours ago, pierremgi said:

You can spawn a group, at once, with bis_fnc_spawnGroup. (You can place another group in cargo or all ai units in the same group).

Then you can do what you want without reference to the "init field" like edited:

 

_grp1 = [_pos, west,["B_Heli_Transport_03_F"], [], [], [], [], [], 0] call BIS_fnc_spawnGroup;
_lead1 = leader _grp1;

_veh = vehicle _lead1;

driver _veh setBehaviour "SAFE";

driver _veh disableAI "autoCombat";

 

I want 2 pilots, and two crewmen separated and in their own groups, that way I can have one group set to safe, and the crew set to aware, so they will return fire.  

Share this post


Link to post
Share on other sites
7 hours ago, pierremgi said:

You can spawn a group, at once, with bis_fnc_spawnGroup. (You can place another group in cargo or all ai units in the same group).

Then you can do what you want without reference to the "init field" like edited:

 

_grp1 = [_pos, west,["B_Heli_Transport_03_F"], [], [], [], [], [], 0] call BIS_fnc_spawnGroup;
_lead1 = leader _grp1;

_veh = vehicle _lead1;

driver _veh setBehaviour "SAFE";

driver _veh disableAI "autoCombat";

 


May I ask what is going on with the 


_lead1 = leader _grp1;

_veh = vehicle _lead1;

??

Share this post


Link to post
Share on other sites

Bis_fnc_spawnGroup returns... a group. So, if you want to identify the driver of the vehicle (here, you spawn a helo + crew), you need to point at the vehicle using some code. I chose leader because there is always a leader in a group (you could use units _grp select 0), then his vehicle because, here, I'm sure he is in vehicle. Then the driver (who is not always the leader).

  • Like 1

Share this post


Link to post
Share on other sites
5 minutes ago, pierremgi said:

Bis_fnc_spawnGroup returns... a group. So, if you want to identify the driver of the vehicle (here, you spawn a helo + crew), you need to point at the vehicle using some code. I chose leader because there is always a leader in a group (you could use units _grp select 0), then his vehicle because, here, I'm sure he is in vehicle. Then the driver (who is not always the leader).


So lead1 is the the heli, and grp1 is the crew, and then you selected the driver in the _veh to to pass the commands. I'm I understanding this right ??

Well, I came up with a little something, and might have come up with something, correct me if I'm wrong, if you simply do not give the driver a behaviour command, he will just follow the waypoints. Right now I have it working somehow with this.

 

_crew1 = [];
_heli = [];
_alpha1 = [];

if (isServer) then {

_crew1 = creategroup WEST; 
_heli = [getMarkerPos "mk1", 140, "B_Heli_Transport_01_F", _crew1] call BIS_fnc_spawnVehicle;
{
    [_x] execVM "IQ_Skill\BlueCon\BluCSkill.sqf";
} forEach units _crew1;

_wp1 = _crew1 addWaypoint [(getmarkerpos "mk2"), 0];
_wp1 setWaypointType "TR UNLOAD";
_wp1 setWaypointSpeed "LIMITED";
_wp1 setwaypointstatements ["this land 'land'"];

_wp2 = _crew1 addWaypoint [(getmarkerpos "mk3"), 0];
_wp2 setWaypointType "MOVE";
_wp2 setWaypointSpeed "LIMITED";


_wp3 = _crew1 addWaypoint [(getmarkerpos "mk3"), 0];
_wp3 setWaypointType "MOVE";
_wp3 setWaypointSpeed "NORMAL";
_wp3 setWaypointStatements ["true", "{deleteVehicle _x} forEach (thisList + [vehicle this]);"];



_alpha1 = [getmarkerpos "mk1", WEST, ["B_Soldier_TL_F","B_soldier_AR_F","B_HeavyGunner_F","B_Soldier_GL_F","B_soldier_LAT_F","B_soldier_LAT2_F","B_Sharpshooter_F","B_medic_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
{
    [_x] execVM "IQ_Skill\BlueCon\BluCSkill.sqf";
} forEach units _alpha1;

_wp1a = _alpha1 addWaypoint [getmarkerpos "mygwp1", 0];

sleep .5;
_alpha1 = _alpha1;
{ _x assignAsCargo (_heli select 0); _x moveIncargo (_heli select 0);} foreach units _alpha1;
}; 

I also defined my skill script to boost the crew's ability to return accurate and direct fire on the threat, so, if I was right on above defining your execution, I'll try to add it..   

  • Confused 1

Share this post


Link to post
Share on other sites
11 minutes ago, 3l0ckad3 said:


So lead1 is the the heli, and grp1 is the crew, and then you selected the driver in the _veh to to pass the commands. I'm I understanding this right ??
 

 

????

_lead1 is IN the heli.

Up to you to use spawnVehicle + create a crew instead of spawnGroup.

NOTE: in the completion code for a move waypoint, to land the helo, it's always:   vehicle this land 'land' instead of: this land 'land'

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, pierremgi said:

????

I never wrote that.

I'm just trying to make sense of who is who between your negotiation, I'm not really following you, I kind of understand..

Share this post


Link to post
Share on other sites
Just now, 3l0ckad3 said:

I'm just trying to make sense of who is who between your negotiation, I'm not really following you, I kind of understand..

corrected this answer.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×