ive got normal allies working, but the medics just stay in one place, crouching. i got this ages ago, i never wrote it but it might help:
AI Friendly target names set up as follows -
level.friendly1 -
KEY/VALUE
$targetname - friendly
#fnum - 1
level.friendly2 -
KEY/VALUE
$targetname - friendly
#fnum - 2
level.friendly3 -
KEY/VALUE
$targetname - friendly
#fnum - 3
level.friendly4 (level.medic) -
KEY/VALUE
$targetname - friendly
#fnum - 4
and heres the scrpt:
// AI FRIENDLY TEST 1 - BEHAVIOUR 1 + MEDIC
// by Mirek - also know as Chris Freeman
// A test of the cardgame included - global/cardgame.src - to be found in the house at the start of level.
// Mirek
// email -
mirek@eventideimaging.com
// The website is comming soon... send an email if you wish to know when that happens.
main:
exec global/ai.scr
exec global/loadout.scr maps/test_F1.scr // I found u must have this otherwise u get no us granades
exec global/cardgame.scr // initialize the card game
// ----------------------------
level waittill prespawn
// ----------------------------
fadeout .1 0 0 0 1
// INITIALISE FRIENDLY SCRIPT
exec global/friendly.scr
//--- SET MUSIC FOR LEVEL
exec global/ambient.scr test_astbridge
// ear candy.
// --------------------------------
//--- SET FRIENDLY SCRIPT
thread global/friendly.scr::friendlygen
// I belive this part takes the 'Friendly ' 'Targetname' and 'Fn#' and turns it into level.friendly#
// -------------------------------
//-- SET FRIENDLY 10 TO BE KNOW AS LEVEL.MEDIC TO PLAY AROUND WITH LEVEL NAME ASSIGNMENT
level.medic = level.friendly4
// From now on ' level.friendly4 ' will be know throughout the script as ' level.medic '.
// From memory - I think all original game scripts give their level.friendly# a name to use in the script.
// I've only changed the level.friendly4 for this example
// This certainly makes sence especially for enteties used often thourghout the script
// as one can change the target name of an entety in the map and update the enitre script with a single line
// otherwise a scriptwise edit would be needed and on a large script.... oooyyyyyyy yo yo yoy
//--- SETUP THE FARPLANE - FOG/MIST
level.farplane = 6200
$world farplane 6200
$world farplane_color (.62 .62 .61)
// Eye candy
// ----------------------------
level waittill spawn
// ----------------------------
//-- PLAYER WEAPON SETUP - NO ROCKET OR SHOTGUN PLEASE
//give weapon
$player item weapons/colt45.tik
$player item weapons/thompsonsmg.tik
$player item weapons/m1_garand.tik
//give ammo
$player ammo smg 200
$player ammo agrenade 5 // American type granade
$player ammo pistol 200
$player ammo rifle 200
//Player starts with the following weapon in hand
$player useweaponclass smg
level.script = "maps/test_F1.scr"
thread fader
thread ai_setup
end
// --- FADE IN
fader:
wait 0.5
fadein 2.5 0 0 0 1
end
//--- SETUP AND RUN THE FRIENDLIES
ai_setup: // setup the AI friendly behviour - AI Friendly following the player
//discription of use -
// FRIENDTYPE
//sets friendly behaviour type --- In this case 1 to follow player
//usage - level.friendly#.type=# / set type to -1 to stop following player
// FRIENDLY THINK
// Activates the friendly AI behaviour and begins the process of tracking nodes for that purpose.
//usage - level.friendly# thread global/friendly.scr::friendlythink
// DESTINATION
// sets the AI's target - this is what the AI will follow
// In this case it's $player but can be set so an AI will follow another AI as prefrence or perhaps a vehicle but I have not tried that
// I belive this set to $player will make the target as a first prefrence and if it's taken attach itself to a friendly.
//
// usage - level.friendly#.destination = $player
// DISTANCE ??
// still working on on this one. Changing it doesn't seem to do much for me
// There are some other commands that I will include later such as avoidplayer
level.friendly1.friendtype = 1
level.friendly1 thread global/friendly.scr::friendlythink
level.friendly1.destination = $player
level.friendly1.distance = 150
level.friendly2.friendtype = 1
level.friendly2 thread global/friendly.scr::friendlythink
level.friendly2.destination = $player
level.friendly2.distance = 175
level.friendly3.friendtype = 1
level.friendly3 thread global/friendly.scr::friendlythink
level.friendly3.destination = $player
level.friendly3.distance = 225
level.medic.friendtype = 5 // set medic behviour ---- 5 = medic
level.medic thread global/friendly.scr::friendlythink
level.medic.destination = $player
level.medic.distance = 250
// set threads to check for deaths
level.friendly1 thread friendly1_death
level.friendly2 thread friendly2_death
level.friendly3 thread friendly3_death
level.medic thread medic_death
// -------------- AI BEHAVIOUR - NORMAL - ( APPLYS TO ALL AI NOT JUST ALLIES)
// --- The following section is to play around with standard AI behviour and alter the initial MohRadiant settings.
// I haven't quiet finished this section yet
// more info on these can also be found in the DOCS/AI tips.doc file that come with MoHHA Tools
// A note about midist & maxdist usage :
// By the use of both of these settings together you can control how the ai will react to it's enemy.
// whether he runs away or towards it,
// In this example script I have set both MINDIST & MAXDIST lower - this forces the Ai to run close to it's attack target.
// MINDIST
// How close the enemy/target gets to the AI before he starts retreating.
// set this higher if you wish for the AI to always stay far away from the enemy it's targetting
// MAXDIST
// Once the AI's enemy/target is outside this distance he will move towards it.
// -------
level.friendly1.accuracy = 80
level.friendly1.mindist = 128
level.friendly1.maxdist = 512
level.friendly1.leash = 1200
level.friendly1 tether $player
level.friendly1.sight = 4000
level.friendly1.noticescale = 1
level.friendly1.waittime = 0.1
level.friendly1.distance = 256
level.friendly1.interval = 256
level.friendly2.accuracy = 80
level.friendly2.mindist = 128
level.friendly2.maxdist = 512
level.friendly2.leash = 1200
level.friendly2 tether $player
level.friendly2.sight = 4000
level.friendly2.noticescale = 1
level.friendly2.waittime = 0.1
level.friendly2.distance = 256
level.friendly2.interval = 256
level.friendly3.accuracy = 80
level.friendly3.mindist = 128
level.friendly3.maxdist = 512
level.friendly3.leash = 1200
level.friendly3 tether $player
level.friendly3.sight = 4000
level.friendly3.noticescale = 1
level.friendly3.waittime = 0.1
level.friendly3.distance = 256
level.friendly3.interval = 256
level.medic.mindist = 384
level.medic.maxdist = 640
level.medic.leash = 800
level.medic tether $player
level.medic.sight = 4000
level.medic.noticescale = 1
level.medic.waittime = 0.1
level.medic.distance = 256
level.medic.interval = 256
end
/// --- THREADS TO MONITOR FOR DEATH AND PRINT THE EVENT
//============================================================//
friendly1_death:
self waittill death // Waits until the thread target - in this case level.friendly1 - dies before moving on
iprintlnbold "Friendly1 has been killed in action."
end
//============================================================//
friendly2_death:
self waittill death
iprintlnbold " Friendly2 has been killed in action."
end
//============================================================//
friendly3_death:
self waittill death
iprintlnbold "Friendly3 has been killed in action."
end
//============================================================//
medic_death:
self waittill death
iprintlnbold "Medic has been killed in action."
end
//============================================================//