AI patrols

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
StarGeneral
Sergeant
Posts: 67
Joined: Wed Oct 17, 2007 5:21 am

AI patrols

Post by StarGeneral »

Ok, I want to know what the script is to make an AI patrol in a multiplayer map without all that objective crud in it, I just want the guy to walk to 4 pathnodes in a complete circle over and over again, please tell me what to take out of the script to do this.
"Si vis pacem, para bellum."
"If you want peace, prepare for war."
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Create 4 pathnodes and give the first one a targetname . For example

Key: targetname
Value: patrolpath1

Select the first pathnode and then the second one and press control K

The second node with then be the only node selected . Select the third node and use control K again . So on and so on with the last node targeting the first node to form a circle . Put lots of normal pathnodes in between them max distance about 300 units apart .

Create an ai and press i to open the ai panel . Set his type_idle to patrol and on the right side a box called patrolpath will appear set his patrolpath to patrolpath1

That is the simple version there is also a patrol script that is harder to set up but has options like having him stop and look at certain areas .
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

couldn't repeat your steps here :(
Even Ctrl+K didn't do anything here. I additionally gave the other info_pathnodes targetnames too, connected them manually, didn't help either.
Could you post a link to a map showing this?
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

It maybe because your ai animations are not enabled . You have to mod models/human/new_generic_human.tik . Here is a sample map with a moded new_generic_human.tik . It has an allied guy on one side of a wall and a german guy on the other . Both have sight and hearing set to 0 . The .map file is in the pk3

user_patrol.pk3

With selecting one thing and using control k to target another . Some of the time you have to press esc to deselect everything then try it . Select one entity then another press control k and entity 1 will target entity 2 . Also a variation on this is to set his type_idle to runner and instead of patroling he will run the path . Set it up the same way with type_idle set to runner and the patrolpath in the box provided . You can also use the bots from JVbots they are ai that use a moded new_generic_human.tik that JV has named multiplayer_generic_human.tik
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Many thanks for the pk3 :D
Didn't know about having to mod MOH to make it work, so probably I haven't done so.
I will examine everything once I'm back home 2night.

My procedure of connecting pathnodes seem to be like u described it. Will give it another try aswell.

tnx again
Wacko
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Your welcome I forgot about modding the new_generic_human.tik because that is something I did long ago to enable the ai animations . I like to use the bots in Jvbots because the animations are already enabled or I create custom ai and use the multiplayer_generic_human.tik it is missing only a couple of animations I found out lately that is does not have the cabinet animation for the global/cabinet.scr but thats easly fixed I just have this at the bottom of the tik for my ai .
$include models/human/multiplayer_generic_human.tik
$include models/human/animation/scripted/hiding_cabinet.tik
$include models/human/animation/dialogue/generic_dialogue_german.tik
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Okidoki, now it's working using your new_generic_human.tik

Then, I must confess that I dont know anything about tik manipulation (and never needed to), so I don't get much of what u're trying to explain :?
On the other hand, atm I'm fine with what I have now. So you don't have to teach me any further, althought it might be of interest to others.

My Radiant is still denying to react on Ctrl+K; it IS in the radiant.ini, so no idea why...

Thanks for your help mate!
User avatar
StarGeneral
Sergeant
Posts: 67
Joined: Wed Oct 17, 2007 5:21 am

Post by StarGeneral »

lol, Wacko pretty much pointed out all the probs I had thorughout the process. Thanks for the help 8-)
"Si vis pacem, para bellum."
"If you want peace, prepare for war."
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Are you guys sure you are holding down the control key when you press the k key ?
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

bdbodger wrote:Are you guys sure you are holding down the control key when you press the k key ?
I swear it DIDN'T work last time, no matter how I tried :cry:
Now... it does :oops: :P
User avatar
StarGeneral
Sergeant
Posts: 67
Joined: Wed Oct 17, 2007 5:21 am

Post by StarGeneral »

I believe you Wacko...I've been there...many a time.
"Si vis pacem, para bellum."
"If you want peace, prepare for war."
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post by erick »

I have always used Bd's way to make a patrol path but I have never had the Ctrl+K quit working... :wink:
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

erick wrote:I have always used Bd's way to make a patrol path but I have never had the Ctrl+K quit working... :wink:
When Ctrl+K isn't working, it isn't specific to Bd's pathnodes, I can't connect e.g. windows and their func_objects either, all I get is a Windows XP Error sound...
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

wacko wrote:
erick wrote:I have always used Bd's way to make a patrol path but I have never had the Ctrl+K quit working... :wink:
When Ctrl+K isn't working, it isn't specific to Bd's pathnodes, I can't connect e.g. windows and their func_objects either, all I get is a Windows XP Error sound...
If that happens deselect everything and start over I get that too .
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

bdbodger wrote:If that happens deselect everything and start over I get that too .
You're so right. Although nothing was visibly selected before I selected the nodes (script_objects, whatever), it didn't work. But, pressing ESC (deselect) first and then select the two does work. Thanks for your patience and help!
Post Reply