Jump to content
Sign in to follow this  
Desrat

Random House Garrison Script

Recommended Posts

I was looking to populate buildings with enemies and having put this together over the last couple of days thought someone else may get some use from it too.

Script counts all available positions in radius, and spawns the units for you. It currently selects 10% of the total available positions at random and makes sure no duplicates (or really close) are spawned.

Useage:

_h = ["marker_name"(string), Max Distance from center to spawn(number), side (number 1=east, 2=west), Debug Markers(true - optional)] execVM "RndmHse.sqf;

Example:

_h = ["Target_Area", 100, 1, true] execVM "RndmHse.sqf";

Download Demo

Requires CBA_A3

UPDATE V1.1

CBA no longer required

DEMO V1.1

DEMO V1.2 - Now works - sorry

Edited by Desrat
typo

Share this post


Link to post
Share on other sites

cool, thanks

Could I request you edit the example line to match mine above (I had a typo initially)

EDIT : Appreciate the speedy edit Foxhound

Edited by Desrat

Share this post


Link to post
Share on other sites

Does this script require CBA on the server or just client ? Also, would be nice if you could make a vanilla ver of this too! :)

Share this post


Link to post
Share on other sites

server only.., uses 3 functions from CBA - if you can find me a suitable alternative I'll happily do a vanilla version

Functions are:

CBA_fnc_getNearestBuilding, CBA_fnc_createMarker, and CBA_fnc_shuffle

Although marker one is just because it's easier, I could replace that easy enough.

Edited by Desrat

Share this post


Link to post
Share on other sites
server only.., uses 3 functions from CBA - if you can find me a suitable alternative I'll happily do a vanilla version

Functions are:

CBA_fnc_getNearestBuilding, CBA_fnc_createMarker, and CBA_fnc_shuffle

Although marker one is just because it's easier, I could replace that easy enough.

Hi there,

First of all thaks a lot for this script, i was placing unit inside buildings by using the code below in the init field of a unit:

this setPosATL [2038.46,2704.55,4.13975];

and i was using this script in the init.sqf in order to get the right coords (x,y,z):

while {true} do {
   copyToClipboard str getposATL player;
   hint str getposATL player;
   sleep 0.2;
};

Secondly, back to your topic, it's very easy to get your script working on the VANILLA version..

CBA_fnc_getNearestBuilding

private ["_building", "_i"];

_building = nearestBuilding _this;
_i = 0;

while {str(_building buildingPos _i) != str([0,0,0])} do {
_i = _i + 1;
};
[_building, _i]

In order to replace CBA_fnc_shuffle you can use something like the following:

_allItems = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]; 
_selectedItems = []; 
_howManyToSelect = 20; 
while {_howManyToSelect != 0} do { 
  _add = _allItems select (floor(random(count _allItems))); 
  if (!(_add in _selectedItems)) then { 
     _selectedItems = selectedItems + [_add]; 
     _howManyToSelect  = howManyToSelect  - 1; 
  }; 
}; 

Let me know if you need any help!

CYA

Edited by vIP3r_75

Share this post


Link to post
Share on other sites

Is there sample mission without CBA?

not require addon

Share this post


Link to post
Share on other sites

The example mission doesn't seem to be working for me.

I just load it into the editor and make spawn in as player and no one spawns. Does the example line still go in a trigger like in a2?

Share this post


Link to post
Share on other sites

I'll do a quick vanilla version when I get home later, thx.

As for the demo not working only thing I can suggested is that you don't have CBA running.

Share this post


Link to post
Share on other sites

The demo should just be copied to your mpmissions folder (after extraction of course ) the script is called from the init.sqf file.

---------- Post added at 22:56 ---------- Previous post was at 22:03 ----------

Vanilla version 1.1 available - see 1st post

Share this post


Link to post
Share on other sites
Addon free version frontpaged on the Armaholic homepage

Appreciated, thanks

Share this post


Link to post
Share on other sites

Is there any way to have the soldiers within set to 'dismissed' or safe? I have a mission where you have to blow up a barracks full of enemy who are relaxed after they have returned from a successful mission.

Share this post


Link to post
Share on other sites
Is there any way to have the soldiers within set to 'dismissed' or safe? I have a mission where you have to blow up a barracks full of enemy who are relaxed after they have returned from a successful mission.

open the RndmHse.sqf file and go right to the bottom and find this line (it's like the 5th line from the end of the file)

_spawnUnit setPos _spawnPos;

after it add this

_grp setBehaviour "SAFE";

Share this post


Link to post
Share on other sites

1. the position of the enemy dot appears in the map. any possible disable??

2. too many AI respwaned on docks beach, any possible reduce AIs?

Edited by lee1hy

Share this post


Link to post
Share on other sites
1. the position of the enemy dot appears in the map. any possible disable??

Already explained in the documentation --

_h = ["marker_name"(string), Max Distance from center to spawn(number), side (number 1=east, 2=west), [b][color=#ff0000]Debug Markers(true - optional)[/color][/b]] execVM "RndmHse.sqf;

so change the 3rd parameter to false or omit completely. e.g

[color=#333333]_h = ["Target_Area", 100, 1, false] execVM "RndmHse.sqf";[/color]

2. too many AI respwaned on docks beach, any possible reduce AIs?

Spawning is random but obviously locations with more positions are statistically more likely to be populated. You could increase the distance check but this could prevent units spawning on multiple levels within the same building, anyway change the following section

// returns true/false if another unit within 2mif (_side == 1) then {
_skip = {side _x == east} count nearestObjects [_spawnPos,["Man","Car","Tank"],2] > 0;
} else {
_skip = {side _x == west} count nearestObjects [_spawnPos,["Man","Car","Tank"],2] > 0;
};

the number 2 (near the end of lines 2 and 4) represents the minimum distance between units - increase the value till you get the result your looking for.

Share this post


Link to post
Share on other sites

new version - 1.2 (see 1st thread)

Increased distance between spawned units.

Some units will now patrol their building instead of remaining static.

Share this post


Link to post
Share on other sites
IT seem the link for version 1.2 is broken. thanks in advance

Fixed - sorry.

Share this post


Link to post
Share on other sites

i made simple urban combat map, classic skimish style

this map name is "HARDCORE INFAN"

http://pds21.egloos.com/pds/201303/23/61/HARDCOREINFAN.Stratis.zip

anti-team kill in respwan_west

anti-demolition in respwan_west

TK punishiment with respwan_without gear

NAME on map

VAS ammo system

Random House Garrison Script - v1.0

light in house for night by tpw

First aid by DAP

Based on F3

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  

×