Jump to content
Sign in to follow this  
shammy2010

Having AI Clear A Building

Recommended Posts

Hey guys

So I'm making a mission where I got 2 marine teams trying to clear a hotel (opx mod) but all I really want is just 1 team to move to buildingpos 114 and another one to move to buildingpos 109. Problem is that the ai just kinda stops at the door when I tell them: unit domove (position guy1) and I put guy1 in position 114 through: this setPos ((nearestBuilding this) buildingPos 114); anyways they just move to the door so I decided to try a different building, I tried putting in a "Villa" which is a building from operation arrowhead. Still the same thing... how can I get them to actually go into the building and actually go upstairs and what not?

Share this post


Link to post
Share on other sites

Hi mate... I remembered I had this example on Medifire that might help you. If you can pick your way through the code it might be of some use.

There might be some hints in there that maybe don't apply... but it runs fine.

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

Hi there.

First off, I should warn you that I’m a noob, so what you know about editing probably exceeds my own limited knowledge. Anyways, just to get the ball rolling ...

The way I understand it is that you have some sort of ‘target’ unit inside the building you wish to clear. What you want to have happen is for another unit to enter the building and move toward the target unit in the process of ‘clearing’ the said structure. That is usually how I get AI units to ‘clear’ buildings, too.

I use a trigger and a bit of code for that. I put this in the On Act field of the trigger:

s1 domove(getPos x1); s1 setspeedmode “limitedâ€;

S1 here being the name of the unit clearing the building while x1 is the name of the 'target' unit inside the building. (FYI, the target unit can be an AI or a weapons cache or any old object you want: s1 will move toward the subject regardless. You can define AI speed and behaviour any which way you like, of course.)

Note that only the AI you've named in the trigger will enter the building here. You will have to define the routes and destinations of the other members of the team (using the same code configuration), as well, if you want the entire team to enter the building and 'spread out'. Note, also, that if you are to use

the above code, you will need to place objects or AIs inside the building first to act as 'targets' or 'destinations' for the team clearing the structure.

I've had this work on single-storey buildings, with multiple units moving simultaneously toward multiple 'targets' in different sections of the house. (I simply repeat the code using different unit names and target destinations -- often all in a single trigger.)

The same bit of code will work when placed in the On Act field of a waypoint, too. (What will happen in this case is that the selected unit will 'break off' from the group to enter the building once the waypoint is activated).

Hope I've somehow contributed to a solution.

Edited by Tom_Pynchon

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  

×