Scripts / NPC attack animation

Author
Message
grinseengel
8
Years of Service
User Offline
Joined: 27th Jul 2015
Location:
Posted: 22nd Feb 2016 08:11
Hello, I have a problem with the animation of my Models . I have a troll for my project . The following animation phases I have already assigned to the troll .

1 ) walk
2 ) 6x attack
3 ) idle
4 ) 2x dying

The animation phases run all quite good . One problem I have but . If the attacking troll , then the attack animation only 2x is played. Then the player freezes .

Do you have any idea why this may be ?

Here the script :

smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Feb 2016 08:42
It looks like you just need to set the state back after applying the damage.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
grinseengel
8
Years of Service
User Offline
Joined: 27th Jul 2015
Location:
Posted: 22nd Feb 2016 15:00
Hmm .... ok , but state it is to attack . The status does not change but after the animation .
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Feb 2016 15:09
yes but your code to determine which attack animation to play requires the state to not be "attack"
i believe your code is getting to this point
Quote: " if ai_soldier_state[e] == "attack" then
RotateToPlayer(e)
if GetAnimationFrame(e)>damageframestart[e] and GetAnimationFrame(e)<damageframeend[e] then
if GetPlayerDistance(e)<120 and lastswipe[e]==0 then
PlaySound(e,1)
HurtPlayer(e,g_Entity[e]['health']/4)
lastswipe[e]=1
end
end
if GetAnimationFrame(e)<damageframestart[e] then
lastswipe[e]=0
end
end"

and then there's nothing to "reset" it unless you move away?

if i'm right then this should fix it

life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 22nd Feb 2016 19:49
This could explain a problem I'm having with a script of my own as well. As im using pretty much the same lines of code there and its not going back unless the player steps back.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GT 740
grinseengel
8
Years of Service
User Offline
Joined: 27th Jul 2015
Location:
Posted: 23rd Feb 2016 11:59
Ok , many thanks . Now it is error free .

I have a few questions for animation script .

1 ) which states ( patrol , attack , idle , batch ... ) , are the hardcodet ? In all scripten uniform are these designations . Responds the engine then this states ?

2 ) My troll should first patrol and when he sees the player make a droit animation . Then he should go to the run mode .

I have now tried the droit animation to put into the script . All thing freezes the animation when the troll the player sees .



If the player nächer than 600 units , then recognizes the troll the player and reacts with the animation state patrol .

Now I have installed before the attack animation a droit animation, to be played only once . I have to wait for state use . However, the animation freezes . Is this due to the state designation or the wrong code ?

Login to post a reply

Server time is: 2024-05-03 12:43:06
Your offset time is: 2024-05-03 12:43:06