Post your scripting questions / solutions here
Moderator: Moderators
small_sumo
Lieutenant General
Posts: 953 Joined: Mon Jul 01, 2002 4:17 pm
Contact:
Post
by small_sumo » Thu Jan 29, 2004 4:43 am
My ai keeps jumping from one exec to another. He like runs then dives run then dive all the way to where he has to go. But sometimes he seams to just do the prone like he should. This is the code.
Your thoughts please.
poor_buggers_7:
local.dude = spawn "human/sumo_allied_redarmy_infantry.tik" origin $whatever_7.origin targetname "mysoldier_7"
waitframe
local.dude.weapon = "none"
local.dude.enableEnemy = 0
local.dude exec global/crouchrunto.scr $fodder_node_3b
local.dude waittill movedone
local.dude exec global/pronewalkto.scr $fodder_node_3
while (IsAlive local.dude)
waitframe
goto poor_buggers_7
vonderbakluft
Corporal
Posts: 46 Joined: Fri Aug 01, 2003 11:15 am
Location: NL
Contact:
Post
by vonderbakluft » Thu Jan 29, 2004 2:36 pm
It looks like that the movedone event is fired inmediately.
Did you already tried to given them some movedoneradius to see what happens then? e.g.
local.dude.movedoneradius = 16
btw if you cannot get it working you can try this kinda dirty workaround:
local.dude = spawn "human/sumo_allied_redarmy_infantry.tik" origin $whatever_7.origin targetname "mysoldier_7"
waitframe
local.dude.weapon = "none"
local.dude.enableEnemy = 0
local.dude exec global/crouchrunto.scr $fodder_node_3b
while !(vector_within local.dude $fodder_node_3b 16)
waitframe
local.dude exec global/pronewalkto.scr $fodder_node_3
while !(vector_within local.dude $fodder_node_3 16)
waitframe
and so on....
Von
Real mappers map in wordpad
small_sumo
Lieutenant General
Posts: 953 Joined: Mon Jul 01, 2002 4:17 pm
Contact:
Post
by small_sumo » Fri Jan 30, 2004 1:24 am
Wow thanks man, looks good at a glance. Better go try it now.
jv_map
Site Admin
Posts: 6521 Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:
Post
by jv_map » Fri Jan 30, 2004 7:15 am
That's not a dirty work-around von, it is usually required
This would be even better:
Code: Select all
while(isAlive local.dude && !(vector_within local.dude $fodder_node_3b 16))
{
local.dude moveto anim/crouch_run.scr $fodder_node_3b
local.dude waittill movedone
}
if !(isAlive local.dude)
continue // use a while loop instead of goto
small_sumo
Lieutenant General
Posts: 953 Joined: Mon Jul 01, 2002 4:17 pm
Contact:
Post
by small_sumo » Fri Jan 30, 2004 9:02 am
Wow I didnt know continue was a command. Yer that goto is very naughty.
Thanks JV.