Jump to content
Sign in to follow this  
MiXeR

Creating group with BIS_fnc_spawnGroup

Recommended Posts

I think I had the same problem once, can't remember what I did, but it was probably just sleep 1 or 2 secs before adding wp.

Share this post


Link to post
Share on other sites
Even this doesn't work:

_grp1 = [position spawngroup, side player, (configFile >> "CfgGroups" >> "West" >> "USMC" >> "Infantry" >> "USMC_InfSquad")] call BIS_fnc_spawnGroup
_wp = _grp1 addWaypoint [position wp1, 0];
_wp setWaypointType "MOVE"; 
_wp setWaypointSpeed "FULL";
_wp = _grp1 addWaypoint [position wp2, 0];
_wp setWaypointType "MOVE"; 
_wp setWaypointSpeed "FULL";
_wp = _grp1 addWaypoint [position wp3, 0];
_wp setWaypointType "DISMISS"; 
_wp setWaypointSpeed "FULL";

Not sure why the group will not move. I have 3 invisible H's named wp1, wp2, and wp3 but the spawned group does not move.

Does anyone have any suggestions?

Put the missing ; after spawngroup :hmmm: .

Share this post


Link to post
Share on other sites
Put the missing ; after spawngroup :hmmm: .

Jesus you gotta be kidding me, thanks bud.

Share this post


Link to post
Share on other sites

Do you check arma2.rpt or use -showscripterrors? It pretty much always picks up typos.

Share this post


Link to post
Share on other sites

Hmm, this spawnGroup function is neat but it needs random placement, sort of how createVehicle_array works.

It would be much better if it spawned the units in a random position in relation to an object or marker.

Share this post


Link to post
Share on other sites
Hmm, this spawnGroup function is neat but it needs random placement, sort of how createVehicle_array works.

It would be much better if it spawned the units in a random position in relation to an object or marker.

Making a new random position in relation to an object based on random direction and random distance can be done in a single line (and that's the hard way, its easier to simply randomize x and y)... So I dont quite see what's so difficult about doing that.

Share this post


Link to post
Share on other sites
Making a new random position in relation to an object based on random direction and random distance can be done in a single line (and that's the hard way, its easier to simply randomize x and y)... So I dont quite see what's so difficult about doing that.

Could you provide an example? I'd really like to know this but my scripting knowledge is nil.

Share this post


Link to post
Share on other sites
Could you provide an example? I'd really like to know this but my scripting knowledge is nil.

Over several lines for simplicity, an example:

_rOrig = getPos whateverObject; // Base object position
_rDir = round (random 360); // random direction
_rDist = 100 + (round (random 100)); // random distance (between 100-200 meters)

_rPos = [(_rOrig select 0)+(sin _rDir)*_rDist,(_rOrig select 1)+(cos _rDir)*_rDist,0]; // new 2D position

I think I got it right. Its less script and more math ;)

There's always easier ways, but this is quite flexible.

Share this post


Link to post
Share on other sites

Hi. I want to spawn a T72 with crew, and make it NEVER FIRE, 0 ammo, Locked, and move from helipad named wp1 to wp2 to wp3.

I tried something myself, but nothing really happens. I know it says M1A1, but thats just for testing.

?(!isServer): goTo "end";

_side1 = EAST;

_side2 = WEST;

_grp2 = [position wp1, _side1, "M1A1"] call BIS_fnc_spawnVehicle;

~2

_wp = _grp2 addWaypoint [position wp1, 0];

_wp setWaypointType "MOVE";

_wp setWaypointSpeed "FULL";

_wp = _grp2 addWaypoint [position wp2, 0];

_wp setWaypointType "MOVE";

_wp setWaypointSpeed "FULL";

_wp = _grp2 addWaypoint [position wp10, 0];

_wp setWaypointType "DISMISS";

_wp setWaypointSpeed "FULL";

I'm also trying to clear the AT shooting range, and I'm looking for a script which will delete ALL units, and vehicles except players within a area, including the dead tanks and units.

Edited by speeder

Share this post


Link to post
Share on other sites
Hi. I want to spawn a T72 with crew, and make it NEVER FIRE, 0 ammo, Locked, and move from helipad named wp1 to wp2 to wp3.

I tried something myself, but nothing really happens. I know it says M1A1, but thats just for testing.

I'm also trying to clear the AT shooting range, and I'm looking for a script which will delete ALL units, and vehicles except players within a area, including the dead tanks and units.

several mistakes:

Looks like you are mixing sqs and sqf..

stick with sqf as its much more efficient and reliable. its like the notebook VS the laptop.

you call side instead of tank in spawn, should be switched.

also created wps are named same so that would be error as well once you get tank spawned.

and use getPos object/unitname or getMArkerPos "anymarkername"

Use this:

execute with:

_null = [] execVM "scriptname.sqf"

script saved as sqf not sqs:

if (isServer) then {
_side1 = EAST;
_side2 = WEST;
_grp2 = [getPos wp1, "M1A1", _side1] call BIS_fnc_spawnVehicle;

sleep 2;

_wp1 = _grp2 addWaypoint [getPos wp1, 0];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "FULL";

_wp2 = _grp2 addWaypoint [getPos wp2, 0];
_wp2 setWaypointType "MOVE";
_wp2 setWaypointSpeed "FULL";

_wp3 = _grp2 addWaypoint [getPos wp3, 0];
_wp3 setWaypointType "DISMISS";
_wp3 setWaypointSpeed "FULL";
};

Edited by Demonized

Share this post


Link to post
Share on other sites

Airborne = [getmarkerPos "startRU", east, (configFile >> "CfgGroups" >> "East" >> "RU" >> "Infantry" >> "RU_InfSquad")] call BIS_fnc_spawnGroup;

sleep 16;

[] execVM "spawnRU.sqf";

THIS WORKS.......WOOO!!!!!!..........BEFORE THEY WOULD SPAWN, THEN KILL EACH OTHER.....THIS IS THE SCRIPT I HAD BEFORE

Airborne = [getmarkerPos "startRU",side player, (configFile >> "CfgGroups" >> "East" >> "RU" >> "Infantry" >> "RU_InfSquad")] call BIS_fnc_spawnGroup;

sleep 16;

[] execVM "spawnRU.sqf";

I WAS A CIVILIAN......

Share this post


Link to post
Share on other sites
BEFORE THEY WOULD SPAWN, THEN KILL EACH OTHER ... I WAS A CIVILIAN ...

Sounds like normal civilians to me :D

Share this post


Link to post
Share on other sites

haha i made the same mistake trying to create an ambush group in my ied script and was like FRIENDLY FIRE WTF

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  

×