So yea i need some help whit how to fill a house efficient.
I'm working me ass off to build a big custom mission line.
1 of the parts is to clear a town, and of-course for that i want a real challenge.
Whit at-least at every house 1 AI or more, so if you gonna put them in manual you run against the cap very fast!
Can't really remember what the cap was, but i reached it at 20% of filling the town +/-.
It is because arma has a Squad cap, and since every guy has to be in no squad or the placements fuck up.
So yea i didn't had much choice then to start scripting them in whit a trigger and sqf file.
What i did was this:
It does work, and does exactly whatever i want, however...
I need to look up every building way-point manually and even that ain't the problem.
Because looking them up gives you more control over it then placing them randomly. (mine exp whit random = bugs out)
But after i spawned this list, i needed to go make a new sqf to continue?
Did i do something wrong? or is there a cap on how many squads u can spawn per sqf to?
So i was wondering if someone knows a better way of doing this?
I'm not asking to give me a script that works and does everything for me, most likely i won't even be happy whit it.
I'm just asking if someone can point me in the right direction whit this.
Thanks a lot!
P.s. my scripting skills are very basic keep that in mind.
(ofc the script has only 1 soldier, and the same. i know how to randomize this, this just a test)
Do not go where the path may lead, go instead where there is no path and leave a trail...
Sometimes I like to think as I started the whole "earplugs" thing.
W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.
Use also random for all you want!
I generally randomize my groups: nbr of units, type of units, even skills (in a slot).
Prepare your group in an array: for "_i" from 1 to whatYouwant do {[] pushback (type of unit randomized)}
then this array in spawnGroup
Same for waypoints: an array, then pick them with arrays_of_waypoints select floor random (count array_of_waypoints).
(a new dev command: selectRandom , will be issued next stable version).
But the main challenge, when filling a town, is that you dramatically drop down FPS with all these units/objects!
So, have on mind a way to spawn /de-spawn units along with player(s) distance(s).
This post was edited by Pierre MGI (2016-02-09 17:34, ago)
PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS
But if you put them all at random, won't you have the problem whit 2 / 3 AI standing in the same place?
Or does it prevent that from happening? because that is the main reason i do it manual right now.
And yes i do now that about the fps ;)
thanks
Do not go where the path may lead, go instead where there is no path and leave a trail...
AI standing at the same place? With randomized waypoints, this situation doesn't carry on. Sometimes, guts seems to talk then leave on their own paths. don't forget setWaypointTimeOut , another way to randomize the time a civilian stay on a waypoint.
PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS
Oh no what i ment was i tried to spawn in a group at random locations in a house.
When a previewed it, they where all standing in the same spot.
I'll might have just screwed that script up, but i though it was because of the randomize.
Could you give me a example line you would use to fill a small building?
{_x setPos ((nearestBuilding _x) buildingPos 7);} foreach units _mygroup;
I though this change would make it random? right?
{_x setPos ((nearestBuilding _x) buildingPos x);} foreach units _mygroup;
Do not go where the path may lead, go instead where there is no path and leave a trail...
No, you can't use the same "_x scope" for two arrays at the same time (units my_group and building positions).
Try:
{_rooms = [nearestBuilding _x] call BIS_fnc_buildingPositions;
if (count _rooms >0) then {
_x setPos (_rooms select floor random (count _rooms))} else {
_x setpos (nearestBuilding _x)}
} foreach units _mygroup;
This works but 2 remarks:
- Don't let your units in a group. They always return in formation, even if "none" choosen instead of "in formation". I think it's a bug from Arma. Prefer an array of units (not grouped). Units can decide to leave their position, according to their behavior facing a threat (civilians are often fleeing).
- nearest building can be different for these units. So you can populate several buildings with the same script, depending on where nearest building is. That's the reason why I added a "else" for building without room, like some walls in some maps.
PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS
Here is another old snipped that is very easy to use. It doesn't fill a house but it automatically places an object at the nearest available building position.
Though this probably isn't that useful anymore, now that we have 3DEN. ^^
There are a lot of very capable people on this forum, willing to spend some of their time to help you out. So if you have a problem, it surely isn't too much to ask that you atleast take the time to describe it properly. Thanks.
I discovered recently, nearestBuilding doesn't work for edited buildings (all maps) or the embedded houses on Unsung map. I don't know the behavior with the other modded maps.
So, I had to write:
_building = nearestObject [_unit,"house"];
instead of
_building = nearestBuilding _unit;
And this helped by the fact a wall isn't a house but a building, so you don't want to spawn something at every walls!. Small objects like small transmission tower (looking like a pole) remains houses (and buildings of course)...
This post was edited by Pierre MGI (2016-02-22 17:42, ago)
PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS
Here is another old snipped that is very easy to use. It doesn't fill a house but it automatically places an object at the nearest available building position.
Though this probably isn't that useful anymore, now that we have 3DEN. ^^
Oh heck it is, Eden is amazing, hell yes.
But if you really want to make a big mision you need to script them in otherwise you lagging u *ss off. cheers
#Pierre MGI :
I discovered recently, nearestBuilding doesn't work for edited buildings (all maps) or the embedded houses on Unsung map. I don't know the behavior with the other modded maps.
So, I had to write:
_building = nearestObject [_unit,"house"];
instead of
_building = nearestBuilding _unit;
And this helped by the fact a wall isn't a house but a building, so you don't want to spawn something at every walls!. Small objects like small transmission tower (looking like a pole) remains houses (and buildings of course)...
This is why it didn't work everywhere...
aiight thankS! :D
Do not go where the path may lead, go instead where there is no path and leave a trail...
Here is a modified version of my own script.
It will spawn a random number of units within buildings according to the number of houses in your radius.
Set up a marker, state the radius size, and choose the type of units to spawn.