View Single Post
  #1  
Old 08-29-2019, 12:34 AM
jsr
Hill Giant
 
Join Date: Aug 2008
Location: melbourne
Posts: 188
Default Adding a pause to scripts

I'm trying to add a pause to an NPC script between statements while preserving the if block. So ideally, without using event_timer.

I tried using the threadmanager's wait function, but it doesn't do anything. I've referenced the example in http://wiki.eqemulator.org/p?Lua_NPC_Examples

This is from the example
Code:
local ThreadManager = require("thread_manager");
local evt;
 
function ability_one()
    evt.self:Emote("begins to cast something electrical");
    ThreadManager:Wait(2.5);
    evt.self:Shout("Feel the thunder!");
end

This is my implementation
Code:
function event_say(e)

	local tm = require("thread_manager")
	
	if e.message:findi("hail") then
	
		e.self:Say("A message")
		tm:Wait(5)
		e.self:Say("B message")
		tm:Wait(5000)
		e.self:Say("C message")
	end
end
A, B, and C message all display at once, and no quest errors are generated. Does anyone know why this wouldn't work?
Reply With Quote