Jump to content
Sign in to follow this  
Provac

BIS_fnc_spawnGroup

Recommended Posts

Yet another function me and my group has some questions about. We aren't super scripted but were learning more day by day and these functions are very nice to have around. But alas we have hit some questions again.

Now this time we actually manage to make it work. To spawn a unit using this function here is the execution line for those that wonders.

Spawns pre instructed units:

[getMarkerPos "markername", west, ["FR_Miles", "FR_Cooper"],[], ["CORPORAL", "PRIVATE"],[0.3,0.6,0.3]] call BIS_fnc_spawnGroup;

Spawns random units

[getMarkerPos "markername", west, 8,[], ["CORPORAL", "PRIVATE"],[0.3,0.6,0.3]] call BIS_fnc_spawnGroup;

getMarkerPos "markername" position where the unit spawns.

west side the unit belongs to

the next part you can decide if you want a random ammount of spawned units by just putting in a number, or you can decide which unit the function spawns by adding classnames. so instead of ["FR_Miles", "FR_Cooper"] you could just put 8.

ranks should be pretty self explanatory.

now [0.3,0.6,0.3] is the randomization of skills for the units.

0.3 = lowest skill

0.6 = highest skill

0.3 = value between lowest and highest skill

the code it executes takes the lowest skill + the value between the lowest and highest skill to get a random skill between 0.3 and 0.6

so 0.3, 0.8, would be 0.5.

Thats what we know about it so far.

What we want to know is how these groups are named, because we want to spawn them and move them to a marker like triggers for ambushes etc. Right now we have no clue how to give the group a command after spawn as it seems the group spawned gets no identity.

Any help here would be appreciated.

Share this post


Link to post
Share on other sites
What we want to know is how these groups are named, because we want to spawn them and move them to a marker like triggers for ambushes etc. Right now we have no clue how to give the group a command after spawn as it seems the group spawned gets no identity.

The function's return value is the group that was created. With that returned group you can find all units inside, including the leader. In the sample below the variable _group will receive the newly created group.

private ["_group"];
_group = [getMarkerPos "markername", west, 8,[], ["CORPORAL", "PRIVATE"],[0.3,0.6,0.3]] call BIS_fnc_spawnGroup;

Share this post


Link to post
Share on other sites

ok now it seems like they are grouped correctly under our name.

private ["_taskforceone"];

_taskforceone = [getMarkerPos "markername", west, 8,[], ["CORPORAL", "PRIVATE"],[0.3,0.6,0.3]] call BIS_fnc_spawnGroup;

_taskforceone doMove (getMarkerPos "attackmarkerone");

or

taskforceone = [getMarkerPos "markername", west, 8,[], ["CORPORAL", "PRIVATE"],[0.3,0.6,0.3]] call BIS_fnc_spawnGroup;

taskforceone doMove (getMarkerPos "attackmarkerone");

doMove doesnt seem to be working though. We have tried a few move commands to get taskforceone to move at all but although they are now grouped (have checked) they arent reacting to any move commands.

EDIT!!!

We found one way of making it work

private ["_taskforceone"];

_taskforceone = [getMarkerPos "spawngrp", west, 8] call BIS_fnc_spawnGroup;

_taskforceone addwaypoint[getmarkerpos"goto",0]

[_taskforceone,1] setwaypointtype"Move";

hope this helps people out there :D

more additions will be appreciated to expand on the knowledge of these functions.

Edited by Provac

Share this post


Link to post
Share on other sites
doMove doesnt seem to be working though. We have tried a few move commands to get taskforceone to move at all but although they are now grouped (have checked) they arent reacting to any move commands.

According to the comref you'e moving units via domove:

unit doMove position

Taskforceone is a group. So you could try to use:

(leader taskforceone) domove (getMarkerPos "attackmarkerone");

Share this post


Link to post
Share on other sites
ok now it seems like they are grouped correctly under our name.

doMove doesnt seem to be working though. We have tried a few move commands to get taskforceone to move at all but although they are now grouped (have checked) they arent reacting to any move commands.

EDIT!!!

We found one way of making it work

hope this helps people out there :D

more additions will be appreciated to expand on the knowledge of these functions.

could you tell me how you got the units to move with

_taskforceone addwaypoint[getmarkerpos"goto",0]

[_taskforceone,1] setwaypointtype"Move";

where do I put that? can I do this in the same trigger I use to spawn the units? I get the first part I can put that in the onact in a trigger and it spawns 8 west infantry.

Also can you change the direction the unit is facing when they spawn?

Share this post


Link to post
Share on other sites

Here is an example to set waypoints to spawned groups. I used it in one of my new missions and it works fine.

_pos = getPos guepos;
_pos2 = getPos guepos2;
_skill = [0.6, 0.6];
_side = Resistance;

_units = ["GUE_Soldier_CO", "GUE_Soldier_MG", "GUE_Soldier_2", "GUE_Soldier_3","GUE_Soldier_SCOUT"];

_newGroup = [_pos, _side, _units, [], [], _skill] call BIS_fnc_spawnGroup;

_newGroup2 = [_pos2, _side, 7] call BIS_fnc_spawnGroup;

_this = _newGroup addWaypoint [getMarkerPos "red1", 0];
_this setWaypointSpeed "FULL";
_this setWaypointBehaviour "COMBAT";
_this setWaypointType "SAD";
[_this, 0] setWaypointCombatMode "RED";
_waypoint_0 = _this;

_this = _newGroup2 addWaypoint [getMarkerPos "red2", 0];
_this setWaypointSpeed "FULL";
_this setWaypointBehaviour "COMBAT";
_this setWaypointType "SAD";
[_this, 0] setWaypointCombatMode "RED";
_waypoint_0 = _this;

Share this post


Link to post
Share on other sites

I'm having bother with bis_fnc_spawngroup when used as part of a trigger in MP. Trigger is in editor and set to fire ONCE when blufor enter (to allow spawning of enemy troops in a location rather than populate whole map at once).

Problem is that the trigger seems to go off once for every blufor client, which causes HUGE patrols =[

anyone got ideas on MP functionality of this function?

Share this post


Link to post
Share on other sites

anyone got ideas on MP functionality of this function?

if (isServer) then {[...] call BIS_fnc_spawnGroup;}

Xeno

Share this post


Link to post
Share on other sites

That'll do it - thanks xeno!

On a related note, I'm using the same trigers to move the location of a respawn_west marker. The marker DOES move, but position doesn't seem to get updated simultaneously for all clients.

Can publicvariable be used to globally update a marker's position to ensure that once the marker s moved, it STAYS moved?

Presumably use of xeno's if(isServer) check will help here also?

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
Sign in to follow this  

×