Jump to content
Sign in to follow this  
tophe

Random House Patrol script v1.0

Recommended Posts

Yes

Yes

Yes, you might wanna start a thread for help on that!

Will they stay in the building even if I have them on Open fire, engage at will, or should I just leave them on Open Fire?

Share this post


Link to post
Share on other sites
Will they stay in the building even if I have them on Open fire, engage at will, or should I just leave them on Open Fire?

Just place a unit on/next to the building and execute script from it's init line and thats it, they'll stick to the house in combat!

Share this post


Link to post
Share on other sites

Is this the best script for getting a set of units to defend a building, or should I be using a different method? I like the idea here because you woudn't know where they would be, but am concerned about the fps hit when applying it to say 20 buildings and 40 individuals?

Share this post


Link to post
Share on other sites

Yeah, this script will work well for building defense.

It is usually easy on the cpu (sqf seems very welloptimized).

Share this post


Link to post
Share on other sites
Is this the best script for getting a set of units to defend a building, or should I be using a different method? I like the idea here because you woudn't know where they would be, but am concerned about the fps hit when applying it to say 20 buildings and 40 individuals?

Not that I'm trying to compete with Tophe, but if you want a more advanced script you could try my script. It offers more control and possibly more optimization, though requires quite a bit more work to use.

Which script to use depends on what exactly you want to do. If you want randomness and ease if use, go with Tophe's, if you want a pre-planned patrol/defense plan that's a little more complicated to set up, use the BD patrol script.

Share this post


Link to post
Share on other sites

AS posted here:

http://forums.bistudio.com/showthread.php?t=101971&page=2

Biggest issue I'm seeing with this at the moment in OA, is the rather frustrating tendency for the AI to eventually walk of the roof. By the time we get to the objective, often most if not all the occupants are dead bodies on the ground due to this....

I'm currently using a hacked version of it to simply place AI at random static locations throughout buildings to ensure the AI still present a challenge when we arrive.

Great script though!

Share this post


Link to post
Share on other sites

Hmmm.. I haven't actually had that many problems with it. Are you using my script or Wolffy's new cB version? I might develop this a bit further now that AO has so many buildings. I'll try to work around the falling off houses problem...

Share this post


Link to post
Share on other sites

Did some more testing after a similar question to yours Tophe, and this is what I've found:

"

Not actually sure if its the roof they are falling off now. I think a few (many?) buildings have internal holes in them. Building used for testing is in Nagagra, specifically 0306 0993 (takistan) immediately SW of main intersection. Fill this building with guys using either Wollffys or Tophe's script, speed it up, and watch, after awhile, you'll see bodies mounting either side of the central building component, the one that is essentially a ground flour archway (has a red banner above the arch on east side). Careful observation will show you the AI literally walking through the first floor walls (not roof!) and dying....

I have seen this on a number of other buildings (as corpses, not the actual wall walking)

hmmm BI?

---------- Post added at 11:31 AM ---------- Previous post was at 10:52 AM ----------

PMd you the mission Tophe

Share this post


Link to post
Share on other sites

I noticed something similar in Chernarus while making a mission. Placing soldiers in certain building positions would instantly kill them :confused:

Share this post


Link to post
Share on other sites

I was using this as a way to clear a certain house. The point is that as a player you are in that house and need to defend it. I noticed in OA that it works in the building itself but when a house is only enterable by stairs they just teleport into the house (wich kind of defeats the whole defending thing).

Share this post


Link to post
Share on other sites

Yes, this script will place the unit at a random starting position, since it is focused on

having a unit patrol inside the building. The unit will not start outside.

You could edit the script to have the unit walk from it's initial position if you want, it would

be rather easy to do. Just remove the lines that puts it at a random starting pos.

Share this post


Link to post
Share on other sites

Do I delete this whole piece:

// Find out the number of positions available in the building

// and put the unit at a random starting position

while { format ["%1", _house buildingPos _x] != "[0,0,0]" } do {_x = _x + 1};

_x = _x - 1;

_unit setPos (_house buildingPos (random _x));

if ((getPos _unit select 0 == 0) and (getPos _unit select 1 == 0)) then

{_unit setPos _position; _notbugged = false;

_unit globalChat format ["%1 can't patrol that building, due to game bug. Choose a different building",_name];

};

Or just parts of it?

Thx, Tophe

Share this post


Link to post
Share on other sites

Start by commenting out this line:

_unit setPos (_house buildingPos (random _x)); 

change it to

[color="DarkGreen"]//_unit setPos (_house buildingPos (random _x));[/color]

That should do it... You could comment out the if-thingy to, but it shouldn't be necessary since that is only a bug check for bad buildings.

Just make sure to check the building so that it is not bugged and is lacking building positions.

Some do, and that will have the unit running down to the left bottom corner of the map.

Share this post


Link to post
Share on other sites
Start by commenting out this line:

_unit setPos (_house buildingPos (random _x)); 

change it to

[color="DarkGreen"]//_unit setPos (_house buildingPos (random _x));[/color]

That should do it... You could comment out the if-thingy to, but it shouldn't be necessary since that is only a bug check for bad buildings.

Just make sure to check the building so that it is not bugged and is lacking building positions.

Some do, and that will have the unit running down to the left bottom corner of the map.

Tophe, feel free to merge my code into your next release, so there is only one version of the script floating around.

I didn't realise you released another version for A2 until Gnarly_Rider pointed it out to me. Maybe I should at least look next time! :)

The only additional features I did was for static objects, to place ammo crates in building positions, etc and also static position of units. Along with Gnarly's idea of combining Guard Post and this script, it would be an awesome utility.

Thanks for all your work Tophe! :yay:

Share this post


Link to post
Share on other sites
Tophe, feel free to merge my code into your next release, so there is only one version of the script floating around.

I didn't realise you released another version for A2 until Gnarly_Rider pointed it out to me. Maybe I should at least look next time! :)

The only additional features I did was for static objects, to place ammo crates in building positions, etc and also static position of units. Along with Gnarly's idea of combining Guard Post and this script, it would be an awesome utility.

Thanks for all your work Tophe! :yay:

Thanks brother. I'll have a look at your script and see what goodies you have in there. Sorry for the late response... I'm not getting the subscriptions from this forum anymore, don't know why!

Share this post


Link to post
Share on other sites

I was thinking as a method of preventing AI from killing themselves b4 you get to them is to start with the UPSMON "fortified" script so they are occupying the building when you get to the building and at that point trigger this script so they then start patrolling and then defending the building b4 they have actually killed themselves.

its a workaround - ill test it out in the near future.

Share this post


Link to post
Share on other sites
Is there a way I can make them stay and patrol 1 building ?

That's what this script does.

Share this post


Link to post
Share on other sites

i know there would be a way to do this but not sure how - the purpose being to prevent/reduce the chance of AI dying b4 you get to them.

instead of executing the script immediately on the units, you wait until BLUFOR is within a certain range of the buildings then execute the script on all enemy units within the zone.

so instead of walking 10 minutes to the buildings and the AI have been patrolling and possibly dying this entire period, you execute the script when BLUFOR is about 1 minute away from the units = 9 minutes less of patrolling and chance of dying.

thoughts?

Share this post


Link to post
Share on other sites

@lightspeed

My work around for what you are talking about is make the units, the ones patrolling, not able to take damage, "allowdamage false". Then I use a trigger to change the "allowdamage false" to true. The trigger can be anything from an event, time or when my guys get close to the area.

This set up has worked well for me. Sucks making a mission then get to a town and half the enemy are dead because they are too stupid not to walk off a roof.

Nomadd

Share this post


Link to post
Share on other sites

@ Nomadd

this was one of the options I was thinking - how do you loop the setdamage true over all the units though?

Share this post


Link to post
Share on other sites
@ Nomadd

this was one of the options I was thinking - how do you loop the setdamage true over all the units though?

Maybe if you put allowDamage False and allowDamage True in a switch trigger. Have it turned on when BLUFOR is within the trigger and turn it off when BLUFOR is out of it.

Share this post


Link to post
Share on other sites

@ Tophe - have you got a way to cancel your script at any point? say for example you wanted them to leave the house to engage or chase down known hostiles using upsmon for example.

Share this post


Link to post
Share on other sites

Would be nice to have this simple / yet effective House patrol Script ported to A3

Share this post


Link to post
Share on other sites
Would be nice to have this simple / yet effective House patrol Script ported to A3

Will happen ;-)

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  

×