Jump to content
Sign in to follow this  
spookygnu

How do I Garrison after spawning in units?

Recommended Posts

Hi all!

Can someone please advise me on where to call the garrison script after I have spawned in enemy AI.

I'm using a trigger (which I thought would be the best place for the code to go that fires the script) No Joy so far????

My units spawn in fine, but after that I can't get them to garrison nearby buildings.

I'm using zorilya's script for garrisoning and this line for spawning:

[getMarkerPos "spawn", EAST, (configFile >> "CfgGroups" >> "East" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Group")] call BIS_fnc_spawnGroup; 

You may probably know but, I only need to have one opfor unit on the map to set the side using the functions module and his probabilty of presence is 0%.

the line I need to use for calling the script is:

nul = [tl,500,true] execVM "Garrison_script.sqf";

"tl" is the name of the opfor unit I have on the map to set the side. I'm not sure if that is correct??or whether it is needed.

In the README, it is mentioned that the init line for the script goes in the team leaders init field for the group that you place on the map. But I don't have any groups set on the map, just the one unit to set the side along side the functions module.

Any help would be grand thanks!

Share this post


Link to post
Share on other sites

Hi, have you looked at this one?

http://www.armaholic.com/page.php?id=15241

comes with a demo, uses a marker that covers the area that you wish to garrison, and when spawn is activated Ai will

spawn in the building positions, no need to spawn enemy and then get them to garrison nearby buildings, this will

spawn them into those positions in and on the buildings.

Share this post


Link to post
Share on other sites
Hi, have you looked at this one?

http://www.armaholic.com/page.php?id=15241

comes with a demo, uses a marker that covers the area that you wish to garrison, and when spawn is activated Ai will

spawn in the building positions, no need to spawn enemy and then get them to garrison nearby buildings, this will

spawn them into those positions in and on the buildings.

thanks for the tip Gunter! I'm not sure this script is what I am looking for. Although the two garrison scripts pretty much do the same thing, zorilya's script, puts them in positions and gives them a direction to look in, I have also noticed while messing about with it, that units patrol the given area you want them to garrison.

Jakerod's script (by what I was reading) looks like it still needs a little bit of work on it (ie, units facing a direction once spawned and air control tower not set up for positions yet).

I'd really like to use the one I have tbh, plus it would help me out with a bit of coding knowledge if someone could explain a couple of things to me. I appreciate the link and all, but I'd rather not get pointed to another place and someone say try looking here, seems a little like cheating and laziness in some ways tbh.

Share this post


Link to post
Share on other sites

SpookyGnu, put this in your trigger:

ldr1 = leader ([getMarkerPos "spawn", EAST, (configFile >> "CfgGroups" >> "East" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Group")] call BIS_fnc_spawnGroup); null = [ldr1,500,true] execVM "Garrison_script.sqf";

name the leader whatever you want...

or you can pass the group:

grp = [getMarkerPos "spawn", EAST, (configFile >> "CfgGroups" >> "East" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Group")] call BIS_fnc_spawnGroup; null = [grp,500,true] execVM "Garrison_script.sqf";

because _this select 0 in the Garrison_script is:

_unit = leader (_this select 0);

Edited by panther42

Share this post


Link to post
Share on other sites
SpookyGnu, put this in your trigger:

ldr1 = leader ([getMarkerPos "spawn", EAST, (configFile >> "CfgGroups" >> "East" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Group")] call BIS_fnc_spawnGroup); null = [ldr1,500,true] execVM "Garrison_script.sqf";

name the leader whatever you want...

or you can pass the group:

grp = [getMarkerPos "spawn", EAST, (configFile >> "CfgGroups" >> "East" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Group")] call BIS_fnc_spawnGroup; null = [grp,500,true] execVM "Garrison_script.sqf";

because _this select 0 in the Garrison_script is:

_unit = leader (_this select 0);

thanks panther! that worked and was exactly what I wanted to happen.

apologise for the noobness here on this next question but you mention I could pass it as a group! What would the main difference between the two options be??

If I did it as a group would it assign each unit spawned as an individual leader and spread the order out more for them to garrison. At the moment I have the radius set to 500 and they all tend to accumulate in the same cluster of buildings or building, not spread out in a 500 meter radius like I was hoping. Otherwise I would have to spawn more groups in and have them set to different radius' to occupy Garmsar.

Edited by SpookyGnu

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  

×