Scripts / Help with AI animation

Author
Message
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 20th Aug 2015 13:39
Hi scripter,

I have some free time at the moment and I want to understand GG a little bit better, so I try to create some ai scripts at the moment. But now I have a problem. The standart Ai use commands like CharacterControlDucked(e), but they react sometimes completly crazy(like turn their upper body in a complete different direction and so on) and I also want to have full controll over the AI. So I thought I could use the animation commands, but:

I do not understand the animation commands:
SetAnimation(e): What animation is setted?
SetAnimationFrames(e,v) What number must be in here? The first or the second? example: csi_relaxed1 = 900,999
PlayAnimation(e) Which animation it plays?
LoopAnimation(e) same as above
SetAnimationSpeed(e,v) what number is v? And how fast is the the standart?
SetAnimationFrame(e,v) what number is v?

Are they even compatible with AI?
I hope someone can help me.

Have a nice day
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
Gtox
3D Media Maker
9
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 20th Aug 2015 16:27
SetAnimation takes information from the FPE file. SetAnimation(0) would set the animation as defined by anim0 in the FPE. So, if you have anim0 = 0,50 in the FPE, SetAnimation(0) will set the first frame at 0 and the last frame at 50.
SetAnimationFrames sets specific animation frames eg SetAnimationFrames(0,50) sets the animation as frame 0- 50.
PlayAnimation and LoopAnimation play the animation that you set using the commands above.
Not sure about the animation speed, I haven't used those commands.
perelect
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 20th Aug 2015 17:26
I use the zombies ai scripts for reference, they set the frames in the script, like.

SetAnimationFrames(2552,2603)
LoopAnimation(e)
ModulateSpeed(e,1.0)
SetAnimationSpeed(e,1.0)

1 is the usually speed for the above as you will see.
I haven't done much work with the animations lately.

My last effort was trying to play the animations in reverse.
To see if it can be done.
ie: say start at frame 2603 and play to 2552

I got it to work, but is was very slow and I couldn't find a way to speed it up.
If you or anyone, can work that out, let me know...
As it would be good to play the death animation in reserve to simulate a zombie re-spawning.

Cheers








I may be old, but at least my memory still ....hmmm

DT:Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528, AutoCAD, 3DsMax, Paint.Net, Solidworks.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Aug 2015 18:55
to play an animation in reverse i use something like this

if x == nil then
x = 500 --or whichever frame you want to start from
elseif x > 400 then --or whichever frame you want to play in reverse until
x = x - 1
SetAnimationFrame(e,x)
PlayAnimation(e)
end

it should play pretty fast so if you need to slow it down then add a timer for the x = x - 1 part like
if GetTimer(e) > 500 then --to change frame every 0.5s
x = x - 1
StartTimer(e)
end
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 20th Aug 2015 19:06
ok I used this code:

but they just stand there and do nothing not even shaking....

What I do wrong
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
perelect
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 20th Aug 2015 21:38 Edited at: 20th Aug 2015 21:42
Hey Corno_1,

I use it like this



and like this..



It mostly trial and error for me with animations.

@smallg, thanks ill give that another try.

Cheers
I may be old, but at least my memory still ....hmmm

DT:Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528, AutoCAD, 3DsMax, Paint.Net, Solidworks.
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 21st Aug 2015 09:41
Thanks, but if g_Entity[e]['animating'] == 0 then does not help me, cause an AI character use always an animation. Hmmm seems like I must figure it out with trial and error

Thanks a lot guys
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 21st Aug 2015 10:00
I call CharacterControlLimbo(e) first
Then call the animation stuff straight after
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 21st Aug 2015 15:40
Thanks for this tip but I find the bug:
It is this command:
GetAnimationFrame(e) it is always true in my code, I donĀ“t know why.
I also find another bug. FireWeapon just work if the player is in sight

I do not know why they hardcode so much stuff, even when it is not nessessary.
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM

Login to post a reply

Server time is: 2024-05-06 18:12:30
Your offset time is: 2024-05-06 18:12:30