more ai questions
Moderator: Moderators
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
more ai questions
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
Thanks
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
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 ^
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 ^
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:
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).
I'm curious about the following:
- Why does the main: thread not have an end?
- Why is the salute thread a looped thread (always bad for setthread threads)? And why should the guy start smoking when he's dead
? - Why is the wakeup_jeff thread looped as well (don't use self here either)?
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).
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
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
^~^~^ 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
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:

