Page 1 of 1
Friendly AI
Posted: Tue Dec 17, 2002 1:08 am
by Sputnik
Hey, you probably haven't heard from me for a while, but I've got more questions for you guys about friendly AI.
I understand the concept of the type of friendly AI (0 = lead/follow, 1 = lead, 5 = medic, etc) but I can't seem to get a medic or even a simple allied soldier to follow me around in a singleplayer level.
I have the following typed into the entity of my AI allied ranger:
$targetname friendly
#fnum 1
and in the script I have:
level.friendly1 thread global/friendly.scr::friendlythink
level.friendly1.friendtype = 0
level.friendly1.distance = 128
level.friendly1.destination = $player
I don't want to worry about the medic until I can properly use this kind of AI. Thanks guys, I'm sure its something simple I'm missing.
Pathnodes
Posted: Tue Dec 17, 2002 1:18 am
by tltrude
The friendly guys won't follow you unless they have a place to stop near you. So you need to add a bunch of friendly pathnodes to your map.
Map m4L0 in the docs folder has friendies, so you might wana look that over and copy the nodes (gold ones I think). And, the nodes have properties that you can set to make the friendies do things or follow a path by targeting another node.
Enemy guys need nodes too (pink ones).
Posted: Tue Dec 17, 2002 1:20 am
by Guest
hmm... Ok, I'll try some stuff out, and tell you what works.
Posted: Tue Dec 17, 2002 7:30 am
by jv_map
Friendly AI and German AI use the same path nodes. Their default color is pink, but it will switch to green when the node has a targetname. Also, you may define a custom color by using the '_color' key.
I think the reason why your friendlies don't work is because you don't seem to have the 'exec global/friendly.scr' in your script file. Put that line between level waittill prespawn and level waittill spawn.
Posted: Thu Dec 19, 2002 1:22 am
by Guest
exec global/ai.scr
exec global/friendly.scr
exec global/loadout.scr maps/test_basestorm.scr
thread global/friendly.scr::friendlygen
main:
level waittill prespawn
// Initialization of spawning triggers (Enemies)
thread global/ai.scr::spawngroup #1
level.medic = level.friendly2
level waittill spawn
$player item weapons/colt45.tik
$player item weapons/thompsonsmg.tik
$player item weapons/springfield.tik
$player ammo smg 1000
$player ammo pistol 1000
$player ammo rifle 1000
// thread objectivesetup
thread friendly_setup
end
Thats my script, I have friendly.scr in it, and i know it should work, because enemy AI works, and its in the same spot..
Posted: Thu Dec 19, 2002 1:23 am
by Sputnik
The above was mine.. I forgot to log in
the script above doesnt include this:
//---------------------------------------
// Friendly AI (Medic, Lieutenant) setup:
//---------------------------------------
friendly_setup:
level.friendly1 thread global/friendly.scr::friendlythink
level.friendly1.friendtype = 0
level.friendly1.distance = 128
level.friendly1.destination = $player
level.medic.friendtype = 5
level.medic thread global/friendly.scr::friendlythink
level.medic.distance = 200
level.medic.destination = $player
level.medic.mindist = 10
level.medic.maxdist = 30
level.medic.leash = 300
level.medic.sight = 2500
level.medic.waittime = 0.1
level.medic.distance = 20
level.medic.interval = 250
level.medic.noticescale = 1
level.medic tether $player
// -Checking threads:
level.friendly1 thread friendly1_death
level.medic thread medic_death
Also: Do my pathnodes have to have a certain targetname or anything, or can they just be there?
Posted: Thu Dec 19, 2002 2:43 pm
by jv_map
In the above script, remove
Code: Select all
exec global/loadout.scr maps/test_basestorm.scr
thread global/friendly.scr::friendlygen
and place the 'exec global/friendly.scr' below 'level waittill prespawn'.
Also don't have code above the main thread.
info_pathnodes don't need no targetname.
Posted: Fri Dec 20, 2002 4:50 am
by mohaa_rox
Then how do you get someone to lead the way, use pathnodes?
Posted: Fri Dec 20, 2002 8:00 am
by jv_map
Yeah, see the description in friendly.scr. However, it's way more complicated than have an AI follow you and I honestly don't know if it works very well on a map that's a bit more complicated than the first mission.
Posted: Mon Dec 30, 2002 10:05 pm
by Sputnik
Thanks...