Scripts / Need help with a script

Author
Message
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 30th Jun 2016 20:05 Edited at: 30th Jun 2016 20:24
Hi guys,

I'm trying to make a script that is attached to an animated character, if you get within 1500 of the character it should play a sound, then if you get under 1000 then it will play an animation (it turns and walks away), then after one run of the animation it destroys the character.

Basically I want the character to make a noise when your under 1500 and then walk off and disappear when you get under 1000.

But it just doesn't do anything.

Anyone know what I need to do to get this working?


i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Jun 2016 20:24 Edited at: 1st Jul 2016 09:42
basically you just need to check he's not already animating or it will get stuck trying to start (same for the sound)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 30th Jun 2016 20:27
Excellent thanks Smallg, that mostly works, just one issue now, he doesn't destroy after one set of frames, he just loops the frames instead, any idea?

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Jun 2016 20:31
ok try the edit
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 30th Jun 2016 20:33
Unexpected symbol near and in line 21

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 30th Jun 2016 20:45
Just a thought, if checking the frames won't work, what about a 1.5 second timer between playing the anim and destroying the entity? How would I do that?

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 30th Jun 2016 21:17 Edited at: 30th Jun 2016 23:19
Ok, tried to put a timer in instead, it kind of works, the character destroys now, but almost instantly .. any ideas why it's not working?



getting a headache now lol

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 1st Jul 2016 09:43
Edited again, I just issued the first frame check.
For the timer you need to start the timer otherwise it will be at past 3000 when you check it.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 1st Jul 2016 10:46
Thanks Smallg, I'll check it again when I get home, much appreciated, as you can see I'm really good at messing up LUA, but at least I try loll.

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 1st Jul 2016 20:49
Right, I've just tested this out, and it works brilliantly!

Just one more last question, the sound keeps playing over and over, I only want it to play once, is there a way to do that?

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 1st Jul 2016 22:01 Edited at: 1st Jul 2016 22:04
Scrub that, it's not quite working right. Sometimes it will run the animation once and disappear, and sometimes it runs it twice then disappears, and other times it just loops the animation over and over again.

It looks like it's something to do with the sound part because if I remove the part that plays sound at 1500 then it works perfectly, and with it in the animation seems to loop over and over in sync with the sound until it goes out of sync and the animation ends in between the sound then disappears.

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.

Login to post a reply

Server time is: 2024-05-04 12:21:49
Your offset time is: 2024-05-04 12:21:49