View Single Post
  #1  
Old 06-08-2022, 12:39 AM
Steinwald's Avatar
Steinwald
Fire Beetle
 
Join Date: May 2022
Location: South Dakota
Posts: 1
Default Getting an NPC to play a custom MP3 file in LUA.

Hello,

I'm new here to EQemulator and are in the process of building a unique server called The Hungry Vulture. The problem that I am having is getting an NPC to play the custom voice mp3 that I created for it. I appreciate any help somebody could offer.


Edited & Solved: After a little troubleshooting and experimenting, I figured out you need to do it with a quick Set_Timer while also finding the client with the npc. I'll leave this working example here.


Code:
function event_say(e)

    if(e.message:findi("hail")) then
	client_to_check=eq.get_entity_list():GetClientByID(e.other:GetID());
	eq.set_timer("greeting", 100); -- 0.1 seconds
	e.self:Say("Test");
    end

end


function event_timer(e)

    if (e.timer == ("greeting")) then
	   e.self:Say("Timer Works");
	   client_to_check:PlayMP3("Corpsepicker_Greeting.mp3");
	   eq.stop_timer("greeting");
    end

end
Reply With Quote