Jump to content
Sign in to follow this  
GodGeek

Soldiers in buildings one more time

Recommended Posts

Hi all, this is my first post so please be patient.

I am trying to get 4 soldiers to move from the ground outside a block of flats (Building ID 148281) on the Sahrani Map, to the open flat on the forth floor. I have searched these forums and found many good leads. I have settled for the code: myhouse1 = [0,0,0] nearestObject 148281; this move (myhouse1 buildingPos 6)  Note buildingPos 6 is the front room of the open flat on the forth floor.

Unfortunatly the soldiers will only move as far as the second floor. However if I change the MOVE to a SETPOS the soldier is placed in the correct position in the front room of the flat on the forth floor, if I change back the soldier will walk into the building and move up the stairs but go no futher than the second floor.

any ideas?

Regards,

Jeff

Share this post


Link to post
Share on other sites

If you are doing something like a hotel then you create a waypoint that says position ###. Worst part of that though is you have to find out the positions in the building, which is easy enough. Just go in with a squad and do a move command and it will show the position number. If i understand what you are asking correctly. Because if you do that you jsut keep giving them wayponts to move out,.

Share this post


Link to post
Share on other sites

I'll throw in a function which you can use to find the number of indexed positions in buildings.

It is handy if you want to create a script to make AI's enter buildings.

buildingPosCount.sqf, stored at http://www.ofpec.com/ Editors Depot and I also copy & paste it here:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

// ******************************************************************************************

// buildingPosCount.sqf

// Returns number of indexed positions in a building.

// These positions can be used with the buildingPos function.

// When using indexed positions from a script,

// take in notice that 1st position has index number 0,

// 2nd has index number 1 and so on. So if a building

// has 8 positions, you can use them as 0...7 from a script

// with the buildingPos function.

// USAGE:

// init: buildingPosCount = preprocessFile "buildingPosCount.sqf"

// calling: <building> call buildingPosCount

// returns: <integer>

// example: _posses = nearestBuilding player call buildingPosCount

// Baddo 2005

// You can contact me through www.ofpec.com

// ******************************************************************************************

private "_i";

_i = 0;

while { format ["%1", _this buildingPos _i] != "[0,0,0]" } do

{

_i = _i + 1;

};

_i

I've used it along with a script I made for OFP to make AI soldiers enter buildings into some indexed positions, or even into all of them. Looks nice when an AI group "storms" a building. Can get fun if they are your enemies and you are hiding upstairs with little ammo... I don't have that script at hand now, but if you would like to have something like that, then I assure you it isn't hard to write it.

For now you can just ignore this and return to it later if you wish, placing waypoints in the mission editor should be enough to get started.

Share this post


Link to post
Share on other sites

Thank you,

HavocDemon & Baddo for your prompt and helpful responce. I am looking into creating suitable waypoints to do the job, However I can't understand why the AI soldiers will not progress beyond the 2nd floor using the command :- myhouse1 = [0,0,0] nearestObject 148281; this move (myhouse1 buildingPos 6) buildingPos 6 being on the top floor.

Regards,

Jeff

Share this post


Link to post
Share on other sites

Check how many indexed positions there are in the building (buildingPosCount.sqf), then have that much AI soldiers, then make them go into each of the indexed positions at the same time. A script with a loop will do that nicely. This way you will see quickly if the soldiers have some problems going into the building. Maybe the soldier is actually in some indexed position, but it's the wrong position? This could be tested, as I said, by ordering a soldier into each of the indexed positions and see if they all get filled up.

In my tests in OFP I got apartment blocks filled up by doing that. But soldiers sometimes went through walls, went into non-existant basement, or did not find their way into the building at all if they were initially too close to the entrance of the building, this could be fixed by giving the soldier first a waypoint away from the house, then the order to go into the building. I don't know how much of these problems ArmA have inherited from OFP, but I think you should know these kinds of problems were in OFP and it wouldn't surprise me if they exists in ArmA too.

Share this post


Link to post
Share on other sites

Arma is better, but still not great. They don't tend to get stuck as much, but they *always* follow a fixed path and ignore all clipping along the route in my experience.

Basically, yeah, ARMA isn't designed with AI close quarters in mind.

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  

×