Jump to content
Sign in to follow this  
doomanchu

Group Spawn Trigger

Recommended Posts

To be honest, I didn't read the whole thread, just saw 15 lines of code that could be replaced by 1 and offered the method. :)

You don't need to name the Function Module, just have it on your map anywhere. The "BIS_fnc_SpawnGroup" thing is a function that's enabled by having the Function Module on your map.

I suppose you could include the 3 lines of code i posted in an SQF, or even just from a trigger.

To fully use the function module you'll want to have this line in your init.sqf:

waituntil {!isnil "bis_fnc_init"};

The spawn group function is very expandable too, like you can specify which units to spawn as well.

Share this post


Link to post
Share on other sites

that doesnt work for me with function manager .... can someone explain step by step for a noob like me how i can spawn units with a script activated with a trigger.

Share this post


Link to post
Share on other sites

Download this test mission. It shows how to spawn groups via action menu leading to a script and a trigger without a script.

Share this post


Link to post
Share on other sites
Download this test mission. It shows how to spawn groups via action menu leading to a script and a trigger without a script.

not that what i was looking for

Can someone help me and make a mission example ? I want units to spawn when i enter an area for example im 1000 meters away from a town and the units spawn so there are not many AI units on the map and it saves performance

Edited by tobmic

Share this post


Link to post
Share on other sites
please help :(

I'm making one, but at work, so the going is slow.

Share this post


Link to post
Share on other sites

Ok, finally finished it, kind of. :)

Demo Mission

Two towns which you need to clear, neither of which spawn anything from the beginning. A trigger and marker and variable control the spawns.

Set the Trigger to Condition of this && !townSpawned (townSpawned set to 'false' in the init.sqf) That will make sure that BLUFOR is present, but also that spawning is allowed (only one town active at a time). The actual spawning is called by:

_null = ["Kamenyy",3,[250,150],East] execVM "spawnOpp.sqf";

So in the town of Kamenyy (as described by the kamenyy_active marker) we want to spawn 3 East faction men in a group and want our completion trigger to be the size of 250 x 150.

The spawnOpp.sqf will turn the town solid red, disallow spawning at the other town, create your group and create a trigger which looks for you to clear the town. When you do it allows spawning in the other town and turns the city marker green.

Try it out. Once you kill the first three, teleport over to Strelka and clear that town. Or spawn Kamenyy first, then teleport over to Strelka and notice that nothing spawns.

To Do: Auto detect trigger area (or even use the existing one, do triggers disappear after they activate?). Make the spawn arguments make more sense, I added "East" at the end since it was an afterthought. :) Allow multiple groups or armor groups or something. Make sure it's multiplayer compliant. Add in briefing links.

Hope that helps.

Share this post


Link to post
Share on other sites
Can you not just set it for each _unit? So...

?! (isServer): exit
WestGrp01a = CreateGroup WEST;
_leader = WestGrp01a createUnit ["USMC_Soldier_SL", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_leader setpos [getpos this select 0, getpos this select 1,(getpos this
select 2) +1000];
_leader flyinheight 1000;
_leader setvelocity [0,0,0];
[_leader] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";
_unit = WestGrp01a createUnit ["USMC_Soldier_AR", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit setpos [getpos this select 0, getpos this select 1,(getpos this
select 2) +1000];
_unit flyinheight 1000;
_unit setvelocity [0,0,0];
[_unit] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";
_unit = WestGrp01a createUnit ["USMC_Soldier", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit setpos [getpos this select 0, getpos this select 1,(getpos this
select 2) +1000];
_unit flyinheight 1000;
_unit setvelocity [0,0,0];
[_unit] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";
_unit = WestGrp01a createUnit ["USMC_Soldier_LAT", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit setpos [getpos this select 0, getpos this select 1,(getpos this
select 2) +1000];
_unit flyinheight 1000;
_unit setvelocity [0,0,0];
[_unit] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";
_leader = leader WestGrp01a;
[_leader,"obj01","NOFOLLOW"] execVM "ups.sqf";

Wouldn't that work?[/code]

It kind of worked. They never ejected from their parachutes so they just floated around the area on the ground.

Share this post


Link to post
Share on other sites

Woo! Mucho Gracias for that demo mission. It makes sense, I'm excited to see how you add in ability to add vehicles and what not..

Share this post


Link to post
Share on other sites

Hi SIR Gaffa,

Hi to everybody

I'm new on forum... (I'm noob for it and for arma editing, Lol!)

So, I have a basic question about editing concepts!

I'm despaired!!

I'm editing an already existing Arma1 map;

I've put a few addons in but, I think it's not the right way to work:

In fact, all default objects on map, are invisible and get to activate only

when a Bluefor stay in red zone; OK!

When I start to editing and I put in the new addons, objects and so on ...

they are all there; just since when the mission start! ... (though I've used 'doStop' and 'DoFollow' commands for their init and triggers...)

WHICH script have I to use, in order to keep that particular object sleeping, invisible, deactivate or similar as by default? - In fact, I think map becomes heavy and without fluidity, later a few minutes I'm playing!

Then,

Does exist a command in the init line and related script of object, to keep it disabled, invisible, deactivated or ... however

not existing till when Us (Bluefor) go in that zone, trigger and so on?

I think it's a basic concept in arma editing and I didn't understand this important way to work and how to start adding objects to have a light and performancing map!

I've searched everywhere on internet... ( the right way seems to be the "Setpos" use.. or "createCenter" .. but my mind in blank!)

Please Sir Gaffa... if You could to explain or to show me the right way about

how have I to start by a simple Gamelogic, trigger, script or that strange "createCenter" and right starting way for editing and building a map

I'm sorry for my bad English

and if You would email me with private message... no problem..

I'll wait for Your response...

Kind Regards

Paolo

Edited by Aloha!

Share this post


Link to post
Share on other sites

I'm attempting to use the script Starlight posted, and would love some help to why this won't work for me. I'm sure it's something fairly basic since I'm a noob.

I've created two empty markers named "newpatrol1" and "newpatrol2"

I then created two triggers in different areas to be activated when Independent detects anybody. In the activations:

1st trigger

null = execVM "spawn1.sqf";

2nd trigger

null = execVM "spawn2.sqf";

Both new squads are then ordered to run the UPS.sqf, and patrol marker areas called "alpha" & "delta".

spawn1.sqf:

Alpha1 = CreateGroup Guer;
_leader = Alpha1 createUnit ["GUE_Commander", [(getMarkerPos "newpatrol1") select 0,(getMarkerPos "newpatrol1") select 1,0], [], 3, "FORM"];
_unit = Alpha1 createUnit ["GUE_Soldier_Scout", [(getMarkerPos "newpatrol1") select 0,(getMarkerPos "newpatrol1") select 1,0], [], 3, "FORM"];
_unit = Alpha1 createUnit ["GUE_Soldier_Sab", [(getMarkerPos "newpatrol1") select 0,(getMarkerPos "newpatrol1") select 1,0], [], 3, "FORM"];
_unit = Alpha1 createUnit ["GUE_Soldier_AT", [(getMarkerPos "newpatrol1") select 0,(getMarkerPos "newpatrol1") select 1,0], [], 3, "FORM"];
_unit = Alpha1 createUnit ["GUE_Soldier_1", [(getMarkerPos "newpatrol1") select 0,(getMarkerPos "newpatrol1") select 1,0], [], 3, "FORM"];
_unit = Alpha1 createUnit ["GUE_Soldier_2", [(getMarkerPos "newpatrol1") select 0,(getMarkerPos "newpatrol1") select 1,0], [], 3, "FORM"];
_unit = Alpha1 createUnit ["GUE_Soldier_3", [(getMarkerPos "newpatrol1") select 0,(getMarkerPos "newpatrol1") select 1,0], [], 3, "FORM"];
_unit = Alpha1 createUnit ["GUE_Soldier_MG", [(getMarkerPos "newpatrol1") select 0,(getMarkerPos "newpatrol1") select 1,0], [], 3, "FORM"];
_unit = Alpha1 createUnit ["GUE_Soldier_Sniper", [(getMarkerPos "newpatrol1") select 0,(getMarkerPos "newpatrol1") select 1,0], [], 3, "FORM"];
_leader = leader Alpha1;
[_leader,"alpha"] execVM "ups.sqf";

spawn2.sqf

Delta1 = CreateGroup Guer;
_leader = Delta1 createUnit ["GUE_Commander", [(getMarkerPos "newpatrol2") select 0,(getMarkerPos "newpatrol2") select 1,0], [], 3, "FORM"];
_unit = Delta1 createUnit ["GUE_Soldier_Scout", [(getMarkerPos "newpatrol2") select 0,(getMarkerPos "newpatrol2") select 1,0], [], 3, "FORM"];
_unit = Delta1 createUnit ["GUE_Soldier_Sab", [(getMarkerPos "newpatrol2") select 0,(getMarkerPos "newpatrol2") select 1,0], [], 3, "FORM"];
_unit = Delta1 createUnit ["GUE_Soldier_AT", [(getMarkerPos "newpatrol2") select 0,(getMarkerPos "newpatrol2") select 1,0], [], 3, "FORM"];
_unit = Delta1 createUnit ["GUE_Soldier_1", [(getMarkerPos "newpatrol2") select 0,(getMarkerPos "newpatrol2") select 1,0], [], 3, "FORM"];
_unit = Delta1 createUnit ["GUE_Soldier_2", [(getMarkerPos "newpatrol2") select 0,(getMarkerPos "newpatrol2") select 1,0], [], 3, "FORM"];
_unit = Delta1 createUnit ["GUE_Soldier_3", [(getMarkerPos "newpatrol2") select 0,(getMarkerPos "newpatrol2") select 1,0], [], 3, "FORM"];
_unit = Delta1 createUnit ["GUE_Soldier_MG", [(getMarkerPos "newpatrol2") select 0,(getMarkerPos "newpatrol2") select 1,0], [], 3, "FORM"];
_unit = Delta1 createUnit ["GUE_Soldier_Sniper", [(getMarkerPos "newpatrol2") select 0,(getMarkerPos "newpatrol2") select 1,0], [], 3, "FORM"];
_leader = leader Delta1;
[_leader,"delta"] execVM "ups.sqf";

Each time I run it I get the following errors:

'KRON_TRGFlag|#|-'

Error Generic error in expresssion

&

'.....s.utes\spawn2.sqf

Error Undefined variable in expression: guer

Delta1 = CreateGroup |#|Guer;

_leader = Delta1 createUnit ["GUE_...'

File XXXXX\Utes_PVP_COOP_SpecialForces.utes\Spawn2.sqf, line 1

Share this post


Link to post
Share on other sites

my error is the GUER variable. For the life of me I can't find what is to be used for guerillas or independents. I only find examples of EAST and WEST, but I thought for sure it was Guer.

Share this post


Link to post
Share on other sites
my error is the GUER variable. For the life of me I can't find what is to be used for guerillas or independents. I only find examples of EAST and WEST, but I thought for sure it was Guer.

i think its GUE for guerillas at least its when i use zonerestriction or zora module to spawn guerillas

Share this post


Link to post
Share on other sites

What's wrong with this? I can't seem to set the direction of the spawned group.

AirSquad = [getMarkerPos "airSpawn", side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Air" >> "US_C130JFlight")] call BIS_fnc_spawnGroup;  
wp = AirSquad addwaypoint [getMarkerPos "airWaypoint",20];  
wp setWaypointType "MOVE"; 
AirSquad setdir 90;

The plane spawns in the flying but I can't set the way it faces when it spawns.

Share this post


Link to post
Share on other sites

Because Airsquad is the group not the vehicle.

you can try to do it like this, tho this will stop the plane and it will plummit to the earth, unless you set its velocity again.

{if ((getDir (vehicle _x)) != 90) then {(vehicle _x) setDir 90}} foreach units Airsquad;

this should probably work instead.

AirSquad = [getMarkerPos "airSpawn", side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Air" >> "US_C130JFlight"),[],[],[],[],[],90] call BIS_fnc_spawnGroup;

Share this post


Link to post
Share on other sites
this should probably work instead.

AirSquad = [getMarkerPos "airSpawn", side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Air" >> "US_C130JFlight"),[],[],[],[],[],90] call BIS_fnc_spawnGroup;

Worked a treat, thanks man. :bounce3:

Edited by Magicpanda

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  

×