Tankbuster 1746 Posted September 18, 2011 Ah OK. Gotcha. :) Share this post Link to post Share on other sites
gnarly_rider 0 Posted September 19, 2011 Looks very nice, will give it a go today, random building population and patrol scripts are my nirvana! PS. With regards to AI view direction, I've never actually been a big fan of 'static' view directions (put a guy on a balcony looking 'outwards' and he will never therefore turn around to check the interior door. After playing with Wolffy and Tophe's various building patrol scripts (and hacking them to make them static building positiom placers), I found Tophes Simple Guard Post Script. This allows you to have the AI look around a bit more realistically: http://forums.bistudio.com/showthread.php?t=102815 with my specific usage: http://forums.bistudio.com/showpost.php?p=1689287&postcount=12 Probably too messy to implement, but just some ideas for you anyways. Keep up the great work! Share this post Link to post Share on other sites
darkxess 60 Posted September 19, 2011 Example Mission Thanks mate :) Share this post Link to post Share on other sites
jakerod 254 Posted September 20, 2011 (edited) I have a question for you scripting gurus out there. The code below is a segment of code from the bigger script. The only alteration is the addition of code that should make it so that only random houses of this type have guys with them respective to the value found in percentBuildGar. I just wanted to ask you guys who are more familiar with scripting than I if this is a good way to do it. My main concern is that there will be some kind of problem that will end up doubling guys in a building or something. Does anyone notice anything that might cause problems before I go adding this code into the other 100 buildings? I've done numerous tests which have turned out fine but I want to make sure there won't be a problem I didn't think of. Edit: Additionally I added four things in so that if 4 of the parameters are 2 then there should be a random chance of them appearing at doors, windows, balconies, and roofs. Although I don't think this one is fluctuating on a per individual building like I want it to. ///----------------------- ///----------------------- ///----------------------- ///Start Squad for House L_1 ///----------------------- ///----------------------- ///----------------------- _countarr = 0; {if (random 1 <= _percentBuildGar) then { if (_PosWindowOnOff == 2) then {_PosWindowOnOff = floor(random 1.9)}; if (_PosDoorOnOff == 2) then {_PosDoorOnOff = floor(random 1.9)}; if (_PosRoofOnOff == 2) then {_PosRoofOnOff = floor(random 1.9)}; if (_PosBalconyOnOff == 2) then {_PosBalconyOnOff = floor(random 1.9)}; _H_L_1_pos_00 = _x modelToWorld (_house_L_1_List select 0); _H_L_1_pos_01 = _x modelToWorld (_house_L_1_List select 1); _H_L_1_pos_02 = _x modelToWorld (_house_L_1_List select 2); _HL1_pos00Unit = _rifPosPos select (round(random _rifPosPosNum)); _HL1_pos01Unit = _rifPosPos select (round(random _rifPosPosNum)); _HL1_pos02Unit = _mgPosPos select (round(random _mgPosPosNum)); _L1_squad = createGroup _factionside; _unitskill = _minSkillValue + (random ( _maxSkillValue - _minSkillValue)); if (random 1 <= _percentPosGar && _PosWindowOnOff == 1) then { _HL1_pos00Unit createUnit [getmarkerpos _initialSpawn, _L1_squad,"L1_squad_mem_00 = this;", _unitskill, _unitrank] }; if (random 1 <= _percentPosGar && _PosWindowOnOff == 1) then { _HL1_pos01Unit createUnit [getmarkerpos _initialSpawn, _L1_squad,"L1_squad_mem_01 = this;", _unitskill, _unitrank] }; if (random 1 <= _percentPosGar && _PosDoorOnOff == 1) then { _HL1_pos02Unit createUnit [getmarkerpos _initialSpawn, _L1_squad,"L1_squad_mem_02 = this;", _unitskill, _unitrank] }; {_x enableattack false} forEach units _L1_squad; {dostop _x} foreach units _L1_squad; _L1_squad_members = units _L1_squad; L1_squad_mem_00 setunitpos "up"; L1_squad_mem_00 setPosATL _H_L_1_pos_00; L1_squad_mem_01 setunitpos "up"; L1_squad_mem_01 setPosATL _H_L_1_pos_01; L1_squad_mem_02 setunitpos "Middle"; L1_squad_mem_02 setPosATL _H_L_1_pos_02; }; _countarr = _countarr + 1; } foreach _HL_1_list; ///----------------------- ///----------------------- ///----------------------- ///End of Squad for House L_1 ///----------------------- ///----------------------- ///----------------------- Edited September 20, 2011 by Jakerod Share this post Link to post Share on other sites
twirly 11 Posted September 20, 2011 (edited) Hi mate.... There's so much code it's hard to follow.... it seems only you know what you are doing! What I did in my little snippet I posted for you is remove any positions that were used. Delete them from the array. That way they couldn't be used again. I'm not quite sure if that has any bearing on what you are doing or asking for here. I'm really struggling to understand why you aren't trying to find the positions using an algorithm?. Your script is already at 348 kilobytes. As far as I know that is unheard of....and you are going to add even more!!! The scripting commands were created to help avoid this kind of tedious programming and to make things flexible. There must be a way to do what you are doing... in let's say.... less than 100 lines of code and be useable everywhere. Anyway mate... to each his own... and if you are having fun.... well that's what it is all about. Keep at it. Sorry I couldn't really help. Edited September 20, 2011 by twirly Share this post Link to post Share on other sites
Tankbuster 1746 Posted September 20, 2011 I have to say, I with twirly on this. What you've done works nicely, but needs optimising. I'd worry that such a huge script will be hard to maintain and potentially to tough on a server. Is there not a way of iterating automatically through each building, rather than using hand coded definitions, when placing soldiers? Share this post Link to post Share on other sites
jakerod 254 Posted September 20, 2011 (edited) Is there not a way of iterating automatically through each building, rather than using hand coded definitions, when placing soldiers? What exactly do you mean by that? Also if you guys are suggesting that I use the building positions, as in the ones that appear when you put a waypoint on a building, then that won't work because the positions that I use are not building positions. Part of the point of doing this was because I wanted the possibility of guys being at every window, balcony, door, etc. which most buildings don't have enough positions for. Edited September 20, 2011 by Jakerod Share this post Link to post Share on other sites
Tankbuster 1746 Posted September 20, 2011 From what I can see in your script, you have individual routines for each building type. I'm wondering if there's a more efficient way of doing that? Share this post Link to post Share on other sites
jakerod 254 Posted September 20, 2011 From what I can see in your script, you have individual routines for each building type. I'm wondering if there's a more efficient way of doing that? I don't think that there is since each building type is unique in regards to how many soldiers it has, what unit type the soldier is, where they are, and what stances they are in. Additionally, I need it the way it is so that things can be random. That way you don't end up with an RPG soldier standing in the same place on every building of that type. It is possible that there is a better way to do it but I'm new to scripting and I haven't found one yet. Share this post Link to post Share on other sites
Tankbuster 1746 Posted September 20, 2011 I'm not having ago, mate, really I'm not. I want to use this so I won't diss or it you. Generally, when you're doing similar things over and over again, you do it in a loop, rather than individual code chunks, but as you say, that may not be possible given the features of this script. Share this post Link to post Share on other sites
Muzzleflash 111 Posted September 20, 2011 (edited) I made a script once to do something close to this. The builtin buildingPos was not enough for me so I made a script. I called it EBP - Extended Building Positions. Basically you could walk around in a building and "copy" your position, direction and stance. You could also make it "populating" the building and it would create units in the same position and stances as you have defined for the building so you could see how it all looked witout ever having to go back to the map. When you were done with a building you could go over to another building and do the same. When you were done you could export the data and put it into a data (text) file. The other part of the script was a small script file that provided functions get this data out again. You could also specify which data file it should use. You could have one data file for combat positions and others for something else. EDIT: EBP: http://wikisend.com/download/308580/EBP.Takistan.zip You can remove a position either by populating the building and use the remove action on the person or by setting positions from scratch. If anyone tries it out try walking over to the barracks and use "select nearest building" and then "populate" from the action menu. It uses the default provided data file which has defines for most of the building on takistan. Mostly ambushy positions inside buildings though. Edited September 20, 2011 by Muzzleflash Share this post Link to post Share on other sites
jakerod 254 Posted September 20, 2011 I made a script once to do something close to this. The builtin buildingPos was not enough for me so I made a script. I called it EBP - Extended Building Positions. Basically you could walk around in a building and "copy" your position, direction and stance. You could also make it "populating" the building and it would create units in the same position and stances as you have defined for the building so you could see how it all looked witout ever having to go back to the map.When you were done with a building you could go over to another building and do the same. When you were done you could export the data and put it into a data (text) file. The other part of the script was a small script file that provided functions get this data out again. You could also specify which data file it should use. You could have one data file for combat positions and others for something else. EDIT: EBP: http://wikisend.com/download/308580/EBP.Takistan.zip You can remove a position either by populating the building and use the remove action on the person or by setting positions from scratch. If anyone tries it out try walking over to the barracks and use "select nearest building" and then "populate" from the action menu. It uses the default provided data file which has defines for most of the building on takistan. Mostly ambushy positions inside buildings though. I wish I would've known about that earlier. That would've made a few missions of mine much easier to make. New Version Up (v1.2) ***Added the ability to pick a percentage of buildings that will be occupied. See original post. Share this post Link to post Share on other sites
twirly 11 Posted September 21, 2011 Hey Jakerod.... maybe this can help you find your special positions more easily. Look in the spoiler. Create a triggger:- Activation: RADIO JULIET (or whatever)... REPEATEDLY OnAct: nul = [] execVM "copyToClip.sqf"; Create a script "copyToClip.sqf":- _posarray = []; _plyrpos = getposATL player; _posarray = _posarray + [_plyrpos]; _posarray = _posarray + [getDir player]; _box = boundingbox player; _boxz = (_box select 1) select 2; _unitpos = ""; if (_boxz < 1) then {_unitpos = "down"}; if (_boxz > 1) then {_unitpos = "up"}; _posarray = _posarray + [_unitPos]; copyToClipboard (str (_posarray)); diag_log format ["%1",_posarray]; titleText [format ["Coords: %1",_posarray],"plain down"]; Move to the position...face the direction you want....go prone or stand.... hit 000 or Radio Juliet and an array like the one below will be copied to the clipboard, displayed onscreen and written to your .rpt file. [[3582.95,3681.46,0.00144196],55.7746,"up"] It contains the position, the direction and the stance. It does not work with "middle" stance because there just does not seem to be a proper way to get the units stance. I'm using boundingBox. The height or z value is in ATL and seems to work fine...I tested a bit and had no problems spawning stuff at the positions returned. Hope it can help in some way.... Share this post Link to post Share on other sites
jakerod 254 Posted September 21, 2011 I've actually been using something kind of similar. I have a bunch of radio triggers set-up for different things. The main one I use is pretty much what you did there with the only difference being that it copies it to the clipboard instead of the rpt. When I'm editing I have the game in windowed mode and I just paste it into an excel file and use that to keep track of everything. It also gets direction and I just write the stance next to it and number the position. I also have some for finding building information and unit numbers so that I can more easily find mistakes. Thank you though. Share this post Link to post Share on other sites
twirly 11 Posted September 21, 2011 Ah...ok mate. You seem to have a good system going already for tracking the numbers....that's sweet. Share this post Link to post Share on other sites
pitpines 1 Posted September 21, 2011 Future Plans (if I have time):Men will hopefully face the right direction. Trigger Area and/or Marker Area based instead of Radius based. Cleaner Code, easier customization. Chernarus, Utes, and Proving Ground Buildings The Buildings of the Fallujah-Map would be great ;). Share this post Link to post Share on other sites
Guest Posted September 21, 2011 Release frontpaged on the Armaholic homepage. Garrison House Area Script v1.2 Share this post Link to post Share on other sites
orcinus 121 Posted September 21, 2011 The Buildings of the Fallujah-Map would be great ;). I hope to use this script for some missions on Podagorsk, if/when I can get positions that work (perhaps using Muzzleflash's script). Also looking forward to the release of the Taviana beta. Might it be useful to have a separate thread for sharing Island-specific position libraries at some point, to save other people having to replicate such work? @Muzzleflash: thanks for making your script available. I haven't even unzipped the file yet but it sounds great. Cheers Orcinus Share this post Link to post Share on other sites
noricum 10 Posted September 26, 2011 First of all, thanks for your script, pretty cool stuff! I have some questions regarding it, had some problems with the grouplimit. Has every soldier, that gets spawned his own group? And would it be possible to add another param, where you could enter the amount of soldiers that get spawned? Share this post Link to post Share on other sites
jakerod 254 Posted September 28, 2011 First of all, thanks for your script, pretty cool stuff!I have some questions regarding it, had some problems with the grouplimit. Has every soldier, that gets spawned his own group? And would it be possible to add another param, where you could enter the amount of soldiers that get spawned? Not every soldier is his own group. The units in each house are their own group. I don't know how I would go about doing the exact number parameter. So for now I'm going to say that I will not do that. However, if I find a way that I think will work I will give it a shot. Share this post Link to post Share on other sites
panda123 10 Posted October 11, 2011 Excellent script thanks :) Can we define the number of spawned ennemies ? Share this post Link to post Share on other sites
jakerod 254 Posted October 12, 2011 Excellent script thanks :)Can we define the number of spawned ennemies ? No. The script decides the number based on the random probabilities for individual units and buildings as well as the number of buildings there are. Share this post Link to post Share on other sites
Skelt 10 Posted October 12, 2011 Jakerod, I'm running your script in my mission, for task spacific locations, it's great! And yes, looking through it, it is loooong! - I thought my Arma Edit crashed when I opened it because it took so long LoL. I appreciate the work that went into making this script. Thank you* Share this post Link to post Share on other sites
McLupo 118 Posted October 22, 2011 Hello Jakerod :)! First of all thx for this amazing work! As an absolute beginner in scripting and editing - i did it! Your great explanation helps alot and so i was able to make a tutorial for the community of my home site www.Arma2Base.de to introduce your great work for everyone, so that the users are well-informed about your clever Garrison House Area Script! Thx alot for this useful and smart AddOn! Best regards McLupo Share this post Link to post Share on other sites
billsirkill 10 Posted June 6, 2012 LOVE THE SCRIPT!! Works great with TAKISTAN.. Tried it with Chenarus.. no men populate any buildings.. am I doing something wrong? thanks...bill Share this post Link to post Share on other sites