soldiers wont follow

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
merlin
Corporal
Posts: 47
Joined: Tue Jan 13, 2004 11:22 am
Location: essex (uk)
Contact:

soldiers wont follow

Post by merlin »

Does anyone know why my soldiers wont follow me around?
heres what uve done so far..


main:
exec global/auto.scr
exec global/ai.scr
exec global/loadout.scr maps/test_neil.scr
exec global/ambient.scr test_neil
exec global/exploder.scr
//exec global/door_locked.scr::lock
exec global/friendly.scr
exec global/bomber.scr

//local.master = spawn ScriptMaster

//local.master aliascache snd_waterfall sound/amb/waterfall.mp3 soundparms 1.0 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"

level waittill prespawn

thread tank1

level waittill spawn

waitthread global/items.scr::add_item "binoculars" noprint
$player item weapons/thompsonsmg.tik
$player useweaponclass smg
$player ammo smg 1000

level.script = "maps/test_neil.scr"

level.friendly1.targetname = cappy
level.friendly2.targetname = private
level.friendly3.targetname = radio

waitthread global/objectives.scr::add_objectives 1 2 "Meet up with your friends." $obj1.origin
set_objective_pos $obj1
thread obj1
end

obj1:
$talk_trigger waittill trigger

// cappy talks to player
$cappy turnto $player
$cappy lookat $player
wait 0.2
$cappy anim 11b100_BritCaptGreet
$cappy waittill animdone

$cappy anim 12C105_dialogue
$cappy waittill animdone

$cappy turnto NULL
$cappy lookat NULL

// Tells the AI to move to the player
$cappy.destination = $player
$friend2.destination = $player
$friend3.destination = $player

// Sets the type of friendly soldier
$cappy.friendtype = 1
$friend2.friendtype = 1
$friend3.friendtype = 1

// stagger how far away they keep from their destinations
$cappy.distance = 175
$friend2.distance = 225
$friend3.distance = 250

// setup the friendlies to follow the player...
$cappy thread global/friendly.scr::friendlythink
$friend2 thread global/friendly.scr::friendlythink
$friend3 thread global/friendly.scr::friendlythink

waitthread global/objectives.scr::add_objectives 1 2 "Meet up with your friends." $obj1.origin


tank1:
$tank1_trigger waittill trigger
exec global/bomber.scr::bomb 1//sets of all #set 1
end
My candle burns at both ends it will not last the night,but oh my foes and oh my friends it gives a lovely light!
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

1) exec global/friendly.scr must be below level waittill prespawn
2) do not change the targetnames of the friendlies (just use level.friendly1 etc)
3) first you set the friendly targetnames to private and radio, later you're trying to use $friendly2 and $friendly3 :?

Fix these first then we'll talk further :)
Image
User avatar
merlin
Corporal
Posts: 47
Joined: Tue Jan 13, 2004 11:22 am
Location: essex (uk)
Contact:

Post by merlin »

ok heres what ive changed(is that better?,i hate scripting)

main:
exec global/auto.scr
exec global/ai.scr
exec global/loadout.scr maps/test_neil.scr
exec global/ambient.scr test_neil
exec global/exploder.scr
//exec global/door_locked.scr::lock

exec global/bomber.scr

//local.master = spawn ScriptMaster

//local.master aliascache snd_waterfall sound/amb/waterfall.mp3 soundparms 1.0 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"

level waittill prespawn

exec global/friendly.scr
thread tank1

level waittill spawn

waitthread global/items.scr::add_item "binoculars" noprint
$player item weapons/thompsonsmg.tik
$player useweaponclass smg
$player ammo smg 1000

level.script = "maps/test_neil.scr"

level.friendly1.targetname = friend1
level.friendly2.targetname = friend2
level.friendly3.targetname = friend3

waitthread global/objectives.scr::add_objectives 1 2 "Meet up with your friends." $obj1.origin
set_objective_pos $obj1
thread obj1
end

obj1:
$talk_trigger waittill trigger

// captain is friend one private is friend 2 radio man is friend 3
$friend1 turnto $player
$friend1 lookat $player
wait 0.2
$friend1 anim 11b100_BritCaptGreet
$friend1 waittill animdone

$friend1 anim 12C105_dialogue
$friend1 waittill animdone

$friend1 turnto NULL
$friend1 lookat NULL

// Tells the AI to move to the player
$friend1.destination = $player
$friend2.destination = $player
$friend3.destination = $player

// Sets the type of friendly soldier
$friend1.friendtype = 1
$friend2.friendtype = 1
$friend3.friendtype = 1

// stagger how far away they keep from their destinations
$friend1.distance = 175
$friend2.distance = 225
$friend3.distance = 250

// setup the friendlies to follow the player...
$friend1 thread global/friendly.scr::friendlythink
$friend2 thread global/friendly.scr::friendlythink
$friend3 thread global/friendly.scr::friendlythink

waitthread global/objectives.scr::add_objectives 1 2 "Meet up with your friends." $obj1.origin


tank1:
$tank1_trigger waittill trigger
exec global/bomber.scr::bomb 1//sets of all #set 1
end
My candle burns at both ends it will not last the night,but oh my foes and oh my friends it gives a lovely light!
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

lol i find most people hate things they dont understand. witch burnings for instance.

have you pathnoded you map where you'll be walking? howare your friendlkies behaving? are they jerkily running around? open the console and tell us the erorr(s) taht are in there.
User avatar
merlin
Corporal
Posts: 47
Joined: Tue Jan 13, 2004 11:22 am
Location: essex (uk)
Contact:

Post by merlin »

Hey witch burnings i can handle just tie em up and set fire to them simple!
But my soldiers are not doing anything the captain(friendly 1)just turns to face me wherever i walk but just stays routed to the spot but the other two friendlys just face forward and move if i come in the door but otherwise stand still!??
My candle burns at both ends it will not last the night,but oh my foes and oh my friends it gives a lovely light!
Post Reply