Home   Help Search Login Register  

Author Topic: move ai to 2nd floor positions in a bulding  (Read 1457 times)

0 Members and 1 Guest are viewing this topic.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
move ai to 2nd floor positions in a bulding
« on: 20 Aug 2006, 03:07:30 »
I'm trying to script ai to 2nd floor spots in a building.  I'm giving them exact postions such as:

_man domove [9538.97, 10450.9, 0.00100994]

But the AI ignores the Y coordinate, and always sends the man to ground level.

I know about predefined bulidng positions, but these buildings only have 2 on first floor.

What is funny, as player leader, I can point to spot on 2nd floor and command ai to move there, and they will move to 2nd floor spot as desired.  This leads me to believe there is another version of the domove or commandmove command that takes into account the Y coordinate when commanding AI to move somewhere in a building.

Any ideas????

Thanks
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re: move ai to 2nd floor positions in a bulding
« Reply #1 on: 20 Aug 2006, 10:04:11 »
You are basically right.    There are two ways to do it.   One is with coordinates as you have tried, except that the last coordinate should be about 3:  units are metres.    Do a bit more experimenting.    doMove won't work though, you'll need to use setPos.    Depending on whether the player is likely to be able to see, you could perhaps use domove to get the loon close to the right building and then setpos him into position.

The other way is to place a waypoint over the desired building:  make sure that the waypoint is "attached" to the building.   In the waypoint screen you can select the building position.   

Remember that one of the flaws in OFP is in the building graphics:  sometimes the AI can see and shoot through walls.   This may make the mission impossible for the player - lots of  playtesting required.

The OFP mission editor/scripting language is not comprehensive:  just because you can order a loon to do something as a player doesn't necessarily mean that you can script it.
Plenty of reviewed ArmA missions for you to play

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re: move ai to 2nd floor positions in a bulding
« Reply #2 on: 20 Aug 2006, 13:26:24 »
An alternative for the wayPoint macguba is describing could be to use the following sequence in a script (this is good for randomized entry into the positions):

1) Use buildingPosCount function to find out how many indexed positions there are in a specific building. This way, you don't need to know in advance if and how many indexed positions a building has.
2) Get a random position using 0...(n-1) as boundaries, where n is the number of indexed positions in the building from step 1.
3) Then use the buildingPos function to order an AI soldier into the position index from step 2: form unit move (building buildingPos 1) works.

AI soldiers will go through walls. Also there is a problem with the AI finding the entrance to the building: if the AI is too close to the door (or to the wall in the door side of the building), then it is possible that the AI doesn't obey your order to go into the building at all. This can be cured by first sending the AI some distance away (say, 20 meters) from the building and then giving the order to enter the building. This has something to do with the pathway LOD and how the AI's find the entrance point into it.
« Last Edit: 20 Aug 2006, 13:28:15 by Baddo »

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: move ai to 2nd floor positions in a bulding
« Reply #3 on: 20 Aug 2006, 17:13:28 »
Mac:

Quote
except that the last coordinate should be about 3:

Thanks man, last coord was problem.  I should have spotted it.  I collected these coordinates by walking the map, and executing a show player coordinates script...I wonder why it showed me y coordinates so low for player position?  No matter.  Adjusting y coord fixed my problem beautifully! 

Baddo:

Thanks for your tips also.  Will need to keep in mind to have first waypoint far enough away from building so AI can find entrance.  Plus may want to employ the random building position technique in the future.

Thanks gents, I will close this thread.  Another satisfied Customer! :)
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...