Home   Help Search Login Register  

Author Topic: waypoint question: AI patrolling on different levels of a building?  (Read 1087 times)

0 Members and 1 Guest are viewing this topic.

scorpi0x

  • Guest
hi guys
i would like to have enemy AI patroling on different levels of this building but don't know how to go abt doing it.
does anyone have an idea of how it can be done?
or anyone know where i can get a reference for this function?

All help will be much appreciated. Thank you  :)

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
m'kay, two ways spring to mind, one easy, one more tricksy, and neither guaranteed to work ;)

the easier way would be to set the height of your patrolling loons, give them patrol waypoints as usual, and hope that they don't try walking through the floor. the only downside would be that all your patrols would have to have one floor each, no swapping, unless you want to set the loon's height in the 'on activation' field of the waypoint, which i suspect would be very messy indeed.

the tricksier way (my preciousss) would be to control the patrols with script, and this would enable you to have a loon patrol more than one floor. be aware though that this would involve very detailed planning out of the routes the loon will take, so that for example he'll start walking up/downstairs when he is actually AT the stairs.

the method would involve putting empty markers at key points (at the top of a stair, at the bottom of a stair, in a doorway) so that straight lines can be made between them. then it would be a case of

Code: [Select]
loon_name domove getmarkerpos "marker_name"
now that's all well and good, but doesn't change the height of the loon, so if he's at the foot of the stairs and you tell him to move to the top-of-stair marker, he'll maybe (this is not tested) try to walk straight through them. depending on how good the collision detection is - which anyone here will tell you can be temperamental at times - it may work. it may not though. a more thorough method would be to specify the height of the marker thus

Code: [Select]
loon_name domove [getmarkerpos "marker_name" select 0, getmarkerpos "marker_name" select 1, floor_height]

again, that hasn't been tested. hopefully it'll give you some ideas anyways. i've often wondered about how they got that guy to walk around the lipany townhouse in the flashpoint menuscreen. he goes upstairs and round corners and everything, so it must be doable somehow.

good luck, and let us know how you get on :)
« Last Edit: 23 Feb 2005, 08:54:01 by bedges »

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
My bet is it's a job for the BuildingPos command again.  The problem with GetPos/SetPos is that whatever floor you're on, it registers as a height of 0.

You'd need to sequentially DoMove the unit to each BuildingPos; you coiuld do that longhand or store them in an array or whatever.

Don't have too high hopes though - allow plenty of time between moves!

scorpi0x

  • Guest
Great thanks to bedges and ACF.
ACF's buildingpos works great!
but somehow in the 3 storey building i had, all the posiitions in the buildingpos array are only in level 1 and 2, not 3.

shall stick with this method 1st and carry out research later.
i'll update if there's any new finding, bedges :)

Thank You All :)

DBR_ONIX

  • Guest
Code: [Select]
HINT ["%1",getpos player]Use that, activated by a trigger (Repeatedly), in the on Actiavated field.
Move to to a point on the building you want the AI guy to start, and activate the radio for that script (Well, line of script.. :P)
Then write down (Maybe screenshoting it with FRAPs or DXDLL for looking at later if your writings as bad as mine.. ;))
And use setpos on the guy..
Then do the same thing (Move to next "waypoint" of the AI guy), pressing the radio trigger again, write down the coordinates, do that for the complete loop of "waypoints"..
Now, in a script.. Syntax will proboly be wrong, but I don't have my OFP stuff on this PC..
Code: [Select]
_unit = _this select 0

#start
_unit domove [123123,321321,5]
~3
_unit domove [234234,432432,5]
~5
GOTO "start"

In the [numbers,numbers,numbers] bit, you change "numbers" to that long number your wrote down. The ~number is how long it takes the AI to get there (Make it a tiny bit longer, this will need a fair ammount of tweaking to get it right)
You can copy those two lines (_unit domove and ~5) as much as needed.
If that's the right command (domove) it should work..

It's a lot more accurate that waypointing etc, as it's exactly where you were.. But the AI will still find a way to fall out the window I'm sure..
Remeber, the bigger/more open the building is, the better, or safer the AI will be! :)
- Ben