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.
Friendly AI
Moderator: Moderators
Pathnodes
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).
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).
Last edited by tltrude on Tue Dec 17, 2002 1:25 am, edited 3 times in total.
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.
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.
-
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..
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..
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?
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?

In the above script, remove
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.
Code: Select all
exec global/loadout.scr maps/test_basestorm.scr
thread global/friendly.scr::friendlygen
Also don't have code above the main thread.
info_pathnodes don't need no targetname.

