Scripts / A curious issue with animation script

Author
Message
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 24th Jul 2016 19:34
Hi guys
The script indicates that the animation should happen when the player is close to the item (trap floor),
however the animation only occurs when the player is away from the item.
It's something I can not explain, the script is executed, the sound is heard, the prompt appears, but the animation is not executed until the player away from the item, (>100).



Note: I've tried all the commented lines, and it does not make the difference.
Using "GetAnimationFrame(e) == 0", because the idea is start hurting player, when frame count reaches >=58.
I've all the complete script, anyway I decide to short it, just for isolate the issue.

any ideas?

Thanks in advance.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Isagabe
9
Years of Service
User Offline
Joined: 12th Sep 2014
Location:
Posted: 25th Jul 2016 06:11
@3com good question. I have similar issues with all my animated characters - when you approach the sound plays and only when you step away from character does the animation play - as opposed to sound and animation simultaneously. I thought it was just me (I struggle with scripts) but was happy to let it ride for now as I am far from publishing. Will be looking at this closely.

I thought that it could have been because i use an animation call in the init stage and then in the main, when player dist = whatever, change animation to what ever and play audio. I understand that yours is not a character but it would appear that our issue is similar.

smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 25th Jul 2016 10:02 Edited at: 25th Jul 2016 10:03
PlayAnimation and PlaySound both constantly call so you need to set a toggle.
if g_Entity[e]['animating'] == 0 then
Would be the usual choice as it automatically resets back to 0 when its finished playing (you need to set it to 1 or whatever you like during the play though)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Isagabe
9
Years of Service
User Offline
Joined: 12th Sep 2014
Location:
Posted: 25th Jul 2016 10:07
Thanks smallg.
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 25th Jul 2016 18:38
Thanks a lot smallg!
Now it works.
Often forguet that in a game, the code are constantly looping.

trap_floor.lua



3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM

Login to post a reply

Server time is: 2024-05-03 21:38:55
Your offset time is: 2024-05-03 21:38:55