How do you make ai stay idle
Moderator: Moderators
-
Vic Marrow
- Colour Sergeant
- Posts: 95
- Joined: Wed Aug 20, 2003 2:31 pm
How do you make ai stay idle
I have 2 enemys on patrol. They walk their path then stop, have a conversation. Then I send one enemy to a waypoint (not part of patrol path) by scripting: "$enemy walkto $path4" When he gets there he goes ito a crouched alert animation. When he gets there I want him to stay in the idle animation you know where he smokes an seems relaxed. So in the script I typed:" $enemy anim idle" So then, he would go into the idle animation but only for a few seconds. Then he would go back to the crouching alert animation. So then I changed it to: " $enemy animloop idle" (I thought the idle animation looped anyway even without loop command) But same thing would happen, he goes idle for a little while and then he goes back to the crouching alert animation. How can I get him to stay idle?
-
Vic Marrow
- Colour Sergeant
- Posts: 95
- Joined: Wed Aug 20, 2003 2:31 pm
Where would I put this line, and what is $guy? Here's my crummy script:
//SCRIPTING: Gener_AL
main:
level waittill prespawn
exec global/ai.scr
exec global/loadout.scr maps/test_room.scr
exec global/friendly.scr
exec global/anim.scr
local.master = spawn ScriptMaster
local.master aliascache den_m6l1_621b sound/dialogue/M6L1/G/den_m6l1_621b.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps auto loaded maps "sp"
local.master aliascache den_m6l1_622r sound/dialogue/M6L1/G/den_m6l1_622r.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps auto loaded maps "sp"
local.master aliascache den_m6l1_629b sound/dialogue/M6L1/G/den_m6l1_629b.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps auto loaded maps "sp"
local.master aliascache den_m6l1_616r sound/dialogue/M6L1/G/den_m6l1_616r.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps auto loaded maps "sp"
local.master aliascache den_m6l1_624r sound/dialogue/M6L1/G/den_m6l1_624r.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps auto loaded maps "sp"
exec global/ambient.scr test_room
level waittill spawn
$player takeall
$player item weapons/bar.tik
$player item weapons/M2Frag_Grenade_sp.tik
$player item weapons/colt45.tik
$player item weapons/shotgun.tik
$player item weapons/bazooka.tik
$player item weapons/steilhandgranate.tik
$player item weapons/silencedpistol.tik
$player ammo mg 128
$player ammo pistol 50
$player ammo agrenade 5
$player useweaponclass mg
$player stufftext "tmstart sound/music/mus_04f_suspense.mp3"
$para turnto $para2
$para2 lookat $para
end
ai_conversation:
$para idlesay den_m6l1_621b
$para waittill saydone
wait .1
$para2 idlesay den_m6l1_622r
$para2 waittill saydone
$para idlesay den_m6l1_629b
$para waittill saydone
wait .1
$para2 idlesay den_m6l1_616r
$para2 waittill saydone
wait 0
$para2 idlesay den_m6l1_624r
$para2 waittill saydone
wait 1.5
$para turnto NULL
$para walkto $path4
$para waittill movedone
$para anim idle
$para2 lookat NULL
end
level.script = "maps/test_room.scr"
end
//SCRIPTING: Gener_AL
main:
level waittill prespawn
exec global/ai.scr
exec global/loadout.scr maps/test_room.scr
exec global/friendly.scr
exec global/anim.scr
local.master = spawn ScriptMaster
local.master aliascache den_m6l1_621b sound/dialogue/M6L1/G/den_m6l1_621b.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps auto loaded maps "sp"
local.master aliascache den_m6l1_622r sound/dialogue/M6L1/G/den_m6l1_622r.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps auto loaded maps "sp"
local.master aliascache den_m6l1_629b sound/dialogue/M6L1/G/den_m6l1_629b.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps auto loaded maps "sp"
local.master aliascache den_m6l1_616r sound/dialogue/M6L1/G/den_m6l1_616r.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps auto loaded maps "sp"
local.master aliascache den_m6l1_624r sound/dialogue/M6L1/G/den_m6l1_624r.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps auto loaded maps "sp"
exec global/ambient.scr test_room
level waittill spawn
$player takeall
$player item weapons/bar.tik
$player item weapons/M2Frag_Grenade_sp.tik
$player item weapons/colt45.tik
$player item weapons/shotgun.tik
$player item weapons/bazooka.tik
$player item weapons/steilhandgranate.tik
$player item weapons/silencedpistol.tik
$player ammo mg 128
$player ammo pistol 50
$player ammo agrenade 5
$player useweaponclass mg
$player stufftext "tmstart sound/music/mus_04f_suspense.mp3"
$para turnto $para2
$para2 lookat $para
end
ai_conversation:
$para idlesay den_m6l1_621b
$para waittill saydone
wait .1
$para2 idlesay den_m6l1_622r
$para2 waittill saydone
$para idlesay den_m6l1_629b
$para waittill saydone
wait .1
$para2 idlesay den_m6l1_616r
$para2 waittill saydone
wait 0
$para2 idlesay den_m6l1_624r
$para2 waittill saydone
wait 1.5
$para turnto NULL
$para walkto $path4
$para waittill movedone
$para anim idle
$para2 lookat NULL
end
level.script = "maps/test_room.scr"
end
-
Vic Marrow
- Colour Sergeant
- Posts: 95
- Joined: Wed Aug 20, 2003 2:31 pm
I tried it jv_map but it still does the same thing.
This is driving me crazy. There' got to be an answer. It will go into the animation but it just won't loop. I tried putting in this animation "$para anim generic_stand_bored_a01" and I get this error in my console:
(entum 4, radnum 12) blocked, doing failsafe
(entum 4, radnum 12) failsafe finshed
if (self isloopinganim self.animname) (anim/anim.scr,1)
if (self^
^~^~^Script Error: anim 'generic_stand_bored_a01' not found, so can't tellif it is looping
self setmotionanim self.animname (anim/anim.scr,8)
^~^~^ Script Error: unknown animation 'generic_stand_bored_a01 'in models/human/german_luftwaffnew_generic_human.tike_falschimjager.tik
This animation is in my new_generic_human.tik which is in my
german_luftwaffe_falschirmjager.tik
Here is the animation in my new_generic_human.tik
/ /Basic idle animations - calm, not doing anything except possibly talking.
generic_stand_bored_a01 idle/generic_idle_a01(loop).skc weight 2
When I walk through the trigger both paras walk into the room walk to their waypoint face each other and stand idle (like I want. They will stand idle forever until I walk through the next trigger ) Then I walk through another trigger which starts the ai_conversation: at the end of the ai_conversation I have $para walkto $path4 When he gets to $path4 he goes idle but won't stay idle. I f they can stay idle forever before the conversation, there's got to be a way to make $para stay idle once he goes to $path4. I have the ai's sight and hearing set to 64, sound_awereness 1 noticescale 1 gen_awareness 10 So I don't know why the para would go into a crouching alert position. There nothing to alert him. It so frustrating everything I do is trial and error read & read & read some more . It must be nice to know what your doing.
This is driving me crazy. There' got to be an answer. It will go into the animation but it just won't loop. I tried putting in this animation "$para anim generic_stand_bored_a01" and I get this error in my console:
(entum 4, radnum 12) blocked, doing failsafe
(entum 4, radnum 12) failsafe finshed
if (self isloopinganim self.animname) (anim/anim.scr,1)
if (self^
^~^~^Script Error: anim 'generic_stand_bored_a01' not found, so can't tellif it is looping
self setmotionanim self.animname (anim/anim.scr,8)
^~^~^ Script Error: unknown animation 'generic_stand_bored_a01 'in models/human/german_luftwaffnew_generic_human.tike_falschimjager.tik
This animation is in my new_generic_human.tik which is in my
german_luftwaffe_falschirmjager.tik
Here is the animation in my new_generic_human.tik
/ /Basic idle animations - calm, not doing anything except possibly talking.
generic_stand_bored_a01 idle/generic_idle_a01(loop).skc weight 2
When I walk through the trigger both paras walk into the room walk to their waypoint face each other and stand idle (like I want. They will stand idle forever until I walk through the next trigger ) Then I walk through another trigger which starts the ai_conversation: at the end of the ai_conversation I have $para walkto $path4 When he gets to $path4 he goes idle but won't stay idle. I f they can stay idle forever before the conversation, there's got to be a way to make $para stay idle once he goes to $path4. I have the ai's sight and hearing set to 64, sound_awereness 1 noticescale 1 gen_awareness 10 So I don't know why the para would go into a crouching alert position. There nothing to alert him. It so frustrating everything I do is trial and error read & read & read some more . It must be nice to know what your doing.
Two things:
setmotionanim generic_stand_bored_a01
won't work, type this instead:
setmotionanim generic_stand_bored_a
The 01 is simply an index which is used for randomized animations.
Secondly, there is no need to pass motionanim commands at all at this level. I think merely this will do what you want:
$para walkto $path4
$para waittill movedone
$para.position = stand
$para exec global/stand.scr
setmotionanim generic_stand_bored_a01
won't work, type this instead:
setmotionanim generic_stand_bored_a
The 01 is simply an index which is used for randomized animations.
Secondly, there is no need to pass motionanim commands at all at this level. I think merely this will do what you want:
$para walkto $path4
$para waittill movedone
$para.position = stand
$para exec global/stand.scr
-
Vic Marrow
- Colour Sergeant
- Posts: 95
- Joined: Wed Aug 20, 2003 2:31 pm
-
Vic Marrow
- Colour Sergeant
- Posts: 95
- Joined: Wed Aug 20, 2003 2:31 pm
I been messing around and I found that if I add this:
$para walkto $path4
$para waittill movedone
$para.position = idle
The para will walk to the waypoint and stand completely still no movement at all with a blank stare like he's frozen. If I move toward him he will attack me. When I look at the console when he's standing still I get an error that keeps repeating line after line over and over again:
Idle Defalt case for idle position-fix idle.scr
So I opened up the idle.scr Here it is:
//------
// Idle
//------
// Just be idle, don't do anything you don't have to. Running or walking will
// stop, but crouching people will keep crouching, curious people (if we ever have
// them) will stay curious. This does not make people relax - we need a specific
// script to make people play a relaxing animation.
//======================================================================
//======================================================================
IdleMain:
//println "Entering idle.scr"
//println "Called Idle.scr with position " self.position " mood " self.mood
waitexec "anim/default_inithandler.scr"
self.blendtime = 0.5 // Slow blendtime to avoid popping during idles.
switch (self.position)
{
crouch:
crouchwalk:
crouchrun:
while (1)
waitexec anim/crouch.scr
stand:
walk:
run:
while (1)
waitexec anim/stand.scr
prone:
pronewalk:
while (1)
waitexec anim/prone.scr
dead:
println "^~^~^ Dead guy trying to idle."
break
knees:
crawl:
floor:
// Oh my goodness I'm in agony! Try to stand up, see if your legs will hold
// you. (My first aid instructor always said that you should stay down so
// you didn't lose bloodflow to the brain and faint or worse. These guys are
// more gung-ho than me I guess.)
waitexec anim/continue_pain.scr
goto IdleMain
default:
println ("^~^~^ Idle Default case for "+self.position+" position - fix idle.scr")
break
}
end
What does "mood" mean how would you use it in a script. Look at the last couple of lines. It has the same type error message as on my console.
At least the para is standing still now. Now I just got to get him animated.
$para walkto $path4
$para waittill movedone
$para.position = idle
The para will walk to the waypoint and stand completely still no movement at all with a blank stare like he's frozen. If I move toward him he will attack me. When I look at the console when he's standing still I get an error that keeps repeating line after line over and over again:
Idle Defalt case for idle position-fix idle.scr
So I opened up the idle.scr Here it is:
//------
// Idle
//------
// Just be idle, don't do anything you don't have to. Running or walking will
// stop, but crouching people will keep crouching, curious people (if we ever have
// them) will stay curious. This does not make people relax - we need a specific
// script to make people play a relaxing animation.
//======================================================================
//======================================================================
IdleMain:
//println "Entering idle.scr"
//println "Called Idle.scr with position " self.position " mood " self.mood
waitexec "anim/default_inithandler.scr"
self.blendtime = 0.5 // Slow blendtime to avoid popping during idles.
switch (self.position)
{
crouch:
crouchwalk:
crouchrun:
while (1)
waitexec anim/crouch.scr
stand:
walk:
run:
while (1)
waitexec anim/stand.scr
prone:
pronewalk:
while (1)
waitexec anim/prone.scr
dead:
println "^~^~^ Dead guy trying to idle."
break
knees:
crawl:
floor:
// Oh my goodness I'm in agony! Try to stand up, see if your legs will hold
// you. (My first aid instructor always said that you should stay down so
// you didn't lose bloodflow to the brain and faint or worse. These guys are
// more gung-ho than me I guess.)
waitexec anim/continue_pain.scr
goto IdleMain
default:
println ("^~^~^ Idle Default case for "+self.position+" position - fix idle.scr")
break
}
end
What does "mood" mean how would you use it in a script. Look at the last couple of lines. It has the same type error message as on my console.
At least the para is standing still now. Now I just got to get him animated.
-
Vic Marrow
- Colour Sergeant
- Posts: 95
- Joined: Wed Aug 20, 2003 2:31 pm
Tried this it didn't work. Still does same thing crouched alert position. The part that kills me is when the paras first start off in the map (before I hit any triggers. They are idle like how I want them smoking, relaxed, putting their stg 44's on their sholder then off again etc. They can walk their patrol route (3 different waypoints) and when they get to the last waypoint they go back into idle like haw I want, animated. So this must be able to be done. the game does it why can't I? The minute they have the conversation (setthread ai_conversation: command) and I script para to go to another waypoint. Thats when he goes crouched alert. If I don't make them have the conversation. And use the patrol route method to go from waypoint to waypoint, I can add as many waypoints as I want and always on the last waypoint the para will go idle like I want. Man jv_map your like the guru of mapping if you can't help me nobody can. 
-
Vic Marrow
- Colour Sergeant
- Posts: 95
- Joined: Wed Aug 20, 2003 2:31 pm
I got it to work!!!
Like this:
$para walkto $path4
$para waittill movedone
$para.position = stand
$para.mood = bored
exec global/idle.scr
wait 30
$para.position = stand
$para.mood = bored
exec global/idle.scr
I had to move a copy of the idle.scr to my global folder (don't know why) Orginaly its in the anim folder. First I put in this command:
$para.position = stand
$para.mood = bored
exec global/idle.scr
The para would do the relaxed idle animations for 40 sec. and then go back to the crouched alert position. So I put "wait 30" and copied the command. This seems to have started the relaxed idle animation to loop. And it just kept on looping. I sat there for like 30 min watching to see if he would come out of the idle and he didn't. Now I can get some sleep!
$para walkto $path4
$para waittill movedone
$para.position = stand
$para.mood = bored
exec global/idle.scr
wait 30
$para.position = stand
$para.mood = bored
exec global/idle.scr
I had to move a copy of the idle.scr to my global folder (don't know why) Orginaly its in the anim folder. First I put in this command:
$para.position = stand
$para.mood = bored
exec global/idle.scr
The para would do the relaxed idle animations for 40 sec. and then go back to the crouched alert position. So I put "wait 30" and copied the command. This seems to have started the relaxed idle animation to loop. And it just kept on looping. I sat there for like 30 min watching to see if he would come out of the idle and he didn't. Now I can get some sleep!
