jshock 513 Posted December 4, 2014 (edited) Hello Arma Community,I present to you:Shock's Building Garrison Function (SBGF) Short Description:1. Garrison Function (Spawned Units):This function allows a mission developer to garrison buildings in a town/city/village with a user defined percentage based on the overall building count.The function returns an array of all units spawned in >> [unit,unit,unit]For the center position you can use a marker, object, or a position array.When using the percentage parameter, the value must be between 0-1 (i.e. (0.2)).Parameters: 1- Center position: (string/object/position array) (default: objNull) 2- Side of units: (side) (default: EAST) 3- Radius for building search: (scalar) (default: 200) 4- Percentage of used building positions: (scalar (0-1)) (default: 0.2) 5- Types of units to spawn: (array of classnames) (default: ["O_Soldier_F","O_Soldier_AR_F"]) 6- (Optional)Define the limit of spawned units: (scalar) (default: -1) **This overrides parameter 4 (percent of used building positions) unless (-1) is used** 2. Garrison Function (Editor Placed Units):This function allows a mission developer to garrison groups of editor-placed units with a simple function call in the group leaders' init field.For the center position you can use a marker, object, or a position array.Parameters: 1- Unit/Group Leader: (object) (note: for use with unit's name or init field using "this" as the parameter) 2- Center position: (string/object/position array) (default: objNull)3- Radius for building search: (scalar) (default: 200) Usage:Place the SBGF folder in your mission directory.In your description.ext: class CfgFunctions { #include "SBGF\cfgfunctions.hpp" }; Example call line (trigger, script, etc.): //For function spawned units _units = ["mrkName",EAST,300,0.3,["O_Soldier_F","O_Soldier_AR_F"],-1] call SBGF_fnc_garrison; //For editor placed units (in group leader's init field) 0 = [this,"mrkName",200] call SBGF_fnc_groupGarrison; Download:Changelog: v1.2 >>Optimizations and error fixesv1.1>>Added second function to garrison editor-placed units (SBGF_fnc_groupGarrison).v1.0>>Initial Release Edited December 19, 2015 by jshock 1 Share this post Link to post Share on other sites
Guest Posted December 4, 2014 Release frontpaged on the Armaholic homepage. Shock's Building Garrison Function (SBGF) v1.0 ================================================ We have also "connected" these pages to your account on Armaholic. This means soon you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have. When you have any questions already feel free to PM or email me! Share this post Link to post Share on other sites
TheMightyKovacs 6 Posted December 25, 2014 It works great, however (there's always a catch with me) when the units spawn they say "2 - Rearm - 30 -0". Otherwise, it works perfectly. Thanks:) Oh, and Merry Christmas J. Shock:xmas: Share this post Link to post Share on other sites
jshock 513 Posted December 25, 2014 It works great, however (there's always a catch with me) when the units spawn they say "2 - Rearm - 30 -0". Otherwise, it works perfectly. Thanks:) Hmm, interesting, this is 3D sound correct? I will look into it. Share this post Link to post Share on other sites
TheMightyKovacs 6 Posted December 25, 2014 Just tried it again, and it stopped doing it? I don't know how. Arma confuses me, sometimes (okay most times). Share this post Link to post Share on other sites
austin_medic 109 Posted December 25, 2014 Just tried it again, and it stopped doing it? I don't know how. Arma confuses me, sometimes (okay most times). The AI aren't that bright upstairs. Half the time they don't know what they want to do. Though theres a chance that the AI SL thought one of his guys had no ammo left (probably because his gear didn't load into his equipment fast enough) and checked one of his guys for ammo. Share this post Link to post Share on other sites
jandrews 116 Posted January 17, 2015 I would like to use this for a larger type mission, any chance I could use groups or place command in units INIT to garrision? I can see having 50+ classnames in _units = ["mrkName",EAST,300,0.3,["O_Soldier_F","O_Soldier_AR_F"],-1] spawn SBGF_fnc_garrison; Share this post Link to post Share on other sites
jshock 513 Posted January 17, 2015 I would like to use this for a larger type mission, any chance I could use groups or place command in units INIT to garrision? I can see having 50+ classnames in _units = ["mrkName",EAST,300,0.3,["O_Soldier_F","O_Soldier_AR_F"],-1] spawn SBGF_fnc_garrison; I get what your saying, give me a couple days/weeks and I may have something for it, main issue is that it's a bit off of the current system, but should be a simple function to write, just need time to sit down and do it :). Share this post Link to post Share on other sites
jshock 513 Posted January 17, 2015 ****UPDATED**** Had a minute today. v1.1 >>Added second function to garrison editor-placed units (SBGF_fnc_groupGarrison). Share this post Link to post Share on other sites
jandrews 116 Posted January 18, 2015 (edited) ****UPDATED****Had a minute today. v1.1 >>Added second function to garrison editor-placed units (SBGF_fnc_groupGarrison). awesome dude!! is there a link? never mind I see the code. Thanks. Edited January 18, 2015 by JAndrews1 Share this post Link to post Share on other sites
jshock 513 Posted January 18, 2015 Yea, waiting on Foxhound to grab it :). Share this post Link to post Share on other sites
Guest Posted January 18, 2015 (edited) Thanks for sending us the updated version and sorry for the delay. I was enjoying movies, beer and fun evening with friends :) Release frontpaged on the Armaholic homepage. Shock's Building Garrison Function (SBGF) v1.1 ================================================ We have also "connected" these pages to your account on Armaholic. This means soon you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have. When you have any questions already feel free to PM or email me! Edited January 18, 2015 by Guest Share this post Link to post Share on other sites
jshock 513 Posted January 18, 2015 All good Foxhound, I was doing the same actually :). Share this post Link to post Share on other sites
jandrews 116 Posted January 20, 2015 hey JShock, I would like to add some commands so far I have these added. _x setBehaviour "SAFE"; _x setCombatMode "YELLOW"; I would like to add a command to make the units look around. I haven't found one YET that is random or to have the units look around in buildings, mostly to look out the windows if possible. Ideas? Share this post Link to post Share on other sites
jshock 513 Posted January 20, 2015 I may be able to add an inside building patrol mode, but having them look out windows I have seen how to do it referencing some other scripts and such, and is way more work than I want to do for this script, at this time. Share this post Link to post Share on other sites
jandrews 116 Posted January 20, 2015 I may be able to add an inside building patrol mode, but having them look out windows I have seen how to do it referencing some other scripts and such, and is way more work than I want to do for this script, at this time. I follow ya. does freelook or dowatch help, I know they may need a marker. just scanning through the commands. Share this post Link to post Share on other sites
jshock 513 Posted January 20, 2015 No, you have to physically get the direction of whatever window for each building position (some with 8+ positions) in every type of building (quite a few for just vanilla), or at least that's what I've seen, there may be another way I haven't seen, but yea...lot's of work... Share this post Link to post Share on other sites
jandrews 116 Posted January 20, 2015 well I would be happy with some random building patrols. IF you had the time. So if I understand it correct, you place the group garrison code in team leader of group and the other units are directed to random buildings in radius to garrison. Now once they find a spot they just stand there for now? Share this post Link to post Share on other sites
jshock 513 Posted January 20, 2015 (edited) Yes you place the call to the group garrison function in the TL's init field, but the units are set into position, they don't walk into those positions, and yes, at least for now they stand there and will shoot anyone who comes within the room/area they are placed in. EDIT: Ugh....I hate when I do this, but simple things cause simple issues, I started thinking about it and forgot to actually set each unit's position in one of the positions within the radius....noob mistake. ****UPDATE**** v1.1 hotfix >>Fixed a few errors in the code. Edited January 24, 2015 by JShock Share this post Link to post Share on other sites
jandrews 116 Posted January 22, 2015 Yes you place the call to the group garrison function in the TL's init field, but the units are set into position, they don't walk into those positions, and yes, at least for now they stand there and will shoot anyone who comes within the room/area they are placed in.EDIT: Ugh....I hate when I do this, but simple things cause simple issues, I started thinking about it and forgot to actually set each unit's position in one of the positions within the radius....noob mistake. ****UPDATE**** https://www.dropbox.com/s/gntr2a3cvl7s33z/SBGF.7z?dl=0 No worries. Thanks for the script. Share this post Link to post Share on other sites
owmyeye 14 Posted January 23, 2015 //For editor placed units (in group leader's init field) [this,"mrkName",200] spawn SBGF_fnc_groupGarrison;[/php] When I copy and paste: "[this,"mrkName",200] spawn SBGF_fnc_groupGarrison", into the init of a group leader in the editor, I get the error "Type Script, expected Nothing". I've already put the SBGF folder in my game directory and put the description.ext in my directory. Share this post Link to post Share on other sites
jshock 513 Posted January 23, 2015 When I copy and paste: "[this,"mrkName",200] spawn SBGF_fnc_groupGarrison", into the init of a group leader in the editor, I get the error "Type Script, expected Nothing".I've already put the SBGF folder in my game directory and put the description.ext in my directory. Sorry that is partly my fault, try: 0 = [this,"mrkName",200] spawn SBGF_fnc_groupGarrison; Share this post Link to post Share on other sites
owmyeye 14 Posted January 23, 2015 Sorry that is partly my fault, try: 0 = [this,"mrkName",200] spawn SBGF_fnc_groupGarrison; Thanks! This is brilliant! Share this post Link to post Share on other sites
Guest Posted January 24, 2015 Thanks again for informing us about the updated version :) Release frontpaged on the Armaholic homepage. Shock's Building Garrison Function (SBGF) v1.1 hotfix ================================================ We have also "connected" these pages to your account on Armaholic. This means soon you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have. When you have any questions already feel free to PM or email me! Share this post Link to post Share on other sites
bent92 10 Posted February 1, 2015 Doesn't do anything? What am I doing wrong? The SBGF folder in my mission directory along with the description.ext Placed command below in group leader's init field: 0 = [this,"mrkName",200] spawn SBGF_fnc_groupGarrison; Preview mission - units stand still. Share this post Link to post Share on other sites