more ai questions

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

more ai questions

Post by small_sumo »

How do I get my ai to drop his hammer before he unholsters his gun? How do I add any of the four moods?

Thanks
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

i dont think he can / wants to drop his wrench, when i played the game i never saw him drop it. i think the command is like "level.myguy setmood curious" or something like that.
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Ok so far my script looks like this. Bare in mind there is a trigger in the level for wakeup jeff and for salute_me.


main:

//exec global/exploder.scr
//exec global/cardgame.scr

level waittill spawn


thread hammerguy1

$salute thread smoking


////////////////////////////////////////////////////////////


smoking:

self holster
self.enableEnemy = 0

while(isAlive self)
{
self anim smoking01
self waittill animdone
self anim smoking02
wait 10
self anim smoking04
self waittill animdone
wait 0.5
}
end

salute_me:
while(isAlive self)
{
self anim smoking05
self waittill animdone

self anim salute
self waittill animdone
}
goto smoking


end

////////////////////////////////////////////////////////////

hammerguy1:
$hammer thread sledgehammering

end

sledgehammering:
self holster
self.enableEnemy = 0
self anim sledgehammer_init
wait 5
while(isAlive self)
{
self anim sledge_hammer_action
wait (randomint(10))
self anim sledge_hammer_idle
self waittill animdone
}
end

wakeup_jeff:

while(isAlive self)
{
//self.isup = 0
self anim working_hammering_putaway
waitframe
waitframe
waitframe
}
waitframe
self unholster
self exec global/enable_ai.scr

end

These are some errors I'm getting.

cache models/emitters/breath_emitter.tik
self anim smoking05 (maps/test__ai.scr, 51)
self ^

^~^~^ Script Error: trying to play animation on (entnum: 1, targetname: '', classname: 'Trigger') which does not have a model

self waittill animdone (maps/test__ai.scr, 52)
self ^

^~^~^ Script Error: invalid waittill animdone for 'Trigger'

self anim salute (maps/test__ai.scr, 54)
self ^

^~^~^ Script Error: trying to play animation on (entnum: 1, targetname: '', classname: 'Trigger') which does not have a model

self waittill animdone (maps/test__ai.scr, 55)
self ^

^~^~^ Script Error: invalid waittill animdone for 'Trigger'

self holster (maps/test__ai.scr, 34)
self ^
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Don't use self in the salute_me thread. Self is always the trigger in setthread threads. Just replace self with the guy that has to salute, e.g. $salute.

I'm curious about the following:
  1. Why does the main: thread not have an end?
  2. Why is the salute thread a looped thread (always bad for setthread threads)? And why should the guy start smoking when he's dead :? ?
  3. Why is the wakeup_jeff thread looped as well (don't use self here either)?
Apart from that you'll have to make some modifications to stop the looped anim threads when the guy has to do a special animation like saluting or throwing away the hammer.

To set a mood, just type any of the following:
self.mood = bored
self.mood = curious
self.mood = nervous
self.mood = alert

The change takes effect when the guy restarts his idle animation (or force immediate change by typing self animscript anim/idle.scr).
Image
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

does mood in any way reflect their reaction to you/reaction time/anything? or does it just make their face different.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

It changes their idle animations mostly. For example, German AI defaults to bored, american to nervous. Therefore German soldiers are always playing with their gun and Americans are nicely swinging. 8)
Image
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Well now it works but isnt very smooth, got to iron out some gerky movments and they too slow to do theyre thing, well kinda. I get one qconsole error.

^~^~^ Script Error: Failed execution of command 'holster' for class 'Trigger' Targetname ''

self holster (maps/test__ai.scr, 21)
self ^


New code looks like this

main:

//exec global/exploder.scr
//exec global/cardgame.scr

level waittill spawn


thread hammerguy1

$salute thread smoking


////////////////////////////////////////////////////////////

end


smoking:

self holster
self.enableEnemy = 0

while(isAlive self)
{
self anim smoking01
self waittill animdone
self anim smoking02
wait 10
self anim smoking04
self waittill animdone
wait 0.5
}
end

salute_me:
$salute anim smoking04
$salute waittill animdone
$salute anim salute

goto smoking


end

////////////////////////////////////////////////////////////

hammerguy1:
$hammer thread sledgehammering

end

sledgehammering:
self holster
self.enableEnemy = 0
self anim sledgehammer_init
wait 5
while(isAlive self)
{
self anim sledge_hammer_action
wait (randomint(10))
self anim sledge_hammer_idle
self waittill animdone
}
end

wakeup_jeff:

$hammer anim working_hammering_putaway
$hammer waittill animdone
$hammer unholster
$hammer exec global/enable_ai.scr
end
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Can you give them a mood in radient?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Not sure, you can try.

Key / value: mood / alert (for example).
Image
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

What do you think my error is from?
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

jv_map wrote:Don't use self in the salute_me thread. Self is always the trigger in setthread threads. Just replace self with the guy that has to salute, e.g. $salute.
Image
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Alternatively I could go thread smoking just like the hammer person?

I'm getting there arn I ? It's very exiting.

:)
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yeah :wink:
Image
Post Reply