Scripts / Script - Play Sound on entity death.

Author
Message
EpicMinecartz
8
Years of Service
User Offline
Joined: 10th Aug 2015
Location:
Posted: 10th Aug 2015 18:42
This is pretty much my first time looking into .lua scripting for GameGuru and I wanted to try to make it so that when a character/entity specifically the ai_fantasycharacter as that is what I have been try to get to work. Basically, I have said I wanted to try to add some sort of sound effect to the death of that entity. I was focusing on the
"function ai_fantasycharacter_exit(e)" part of the ai_fantasycharacter.lua.

This is the function :



I have tried the PlaySound(DeathSound[e]) and the PlaySound(e,DeathSound[e]) but neither work and they both show errors when attempting to run the lua. I tried using DeathSound[e] = sound1 then applying Sound1 to be the location of the sound file.

I have seen PlaySound used before and I also looked at Prompt(textinzone_name[e]) Which used the Name box in the properties of a trigger zone as the text to display on screen. I tried to use these two things to construct the attempt I made at trying to make a death sound, but I haven't any more ideas on how to get it to work.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Aug 2015 19:31
you just use the slot number - so if it's in sound slot 1 you just use
PlaySound(e,1)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Login to post a reply

Server time is: 2024-05-07 03:58:35
Your offset time is: 2024-05-07 03:58:35