• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Cut Scene in OT - Need someone to look over my code

Gaddhuve

Member
Joined
May 6, 2011
Messages
76
Solutions
1
Reaction score
19
Hi guys.

I am trying to make something like a cutscene in my TFS server and need someone experienced to look over my code.


What is it meant to do?
*When you walk on Ferumbras throne you get teleported back 3 tiles.
*One second later Ferumbras will appear on the same throne and begin his speach.
*Later an NPC called Cho'Gall will appear after Ferumbras call.
*The NPC Cho'Gall will be gone and a monster with the same name will appear and start the boss fight.
*An monster called Fiend will appear to aid Cho'Gall


Code
Lua:
local telepos = {x=531, y=285, z=12} 
local t = {
 
	text = 'Guests? Not expected, oh well.',
	text1 = 'As the kind host I am I will give you a warm welcome. Cho'Gall! Deal hear your masters call!',
 
	text2 = 'M..master.',
	text5 = 'Cho'gall. These pesents walk on your ground.',	
	text6 = 'Deal with them. Make them suffer!',	
	text8 = 'MAY THE TWILIGHT CONSUME YOU!!',	
	
	
	text3 = 'What will you have me do, Master?',	
	text4 = 'Concider it done.',	
	text7 = 'Prepare to run!',	
	

	npc = 'Ferumbras', 
	pos = {x=531, y=281, z=12},

	npc1 = 'Cho'gall',
	pos1 = {x=530, y=283, z=12},
	
	m1 = 'Cho'gall',
	m2 = 'Fiend',
	pos3 = {x=539, y=291, z=12}

}
 
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if isPlayer(cid) then
	    doTeleportThing(cid, telepos)
		
		
	local v = addEvent(doCreateNpc, 1000, t.npc, t.pos)
	
		addEvent(doCreatureSay, 1000, v, t.text, TALKTYPE_SAY)
		addEvent(doCreatureSay, 6000, v, t.text1, TALKTYPE_SAY)	
		addEvent(doCreatureSay, 1300, v, t.text5, TALKTYPE_SAY)
		addEvent(doCreatureSay, 1700, v, t.text6, TALKTYPE_SAY)
		addEvent(doCreatureSay, 45000, v, t.text8, TALKTYPE_SAY)
		
		
		
	
 
	local f = addEvent(doCreateNpc, 6000, t.npc1, t.pos1)
		addEvent(doCreatureSay, 11000, f, t.text2, TALKTYPE_SAY)
		addEvent(doCreatureSay, 14900, f, t.text3, TALKTYPE_SAY)
		addEvent(doCreatureSay, 19999, f, t.text3, TALKTYPE_SAY)
		addEvent(doCreatureSay, 23000, f, t.text3, TALKTYPE_SAY)
	
			addEvent(doRemoveCreature, 24500, f)
			
	local g = addEvent(doSummonCreature, 24501, t.m1, pos1)
 
	local m = addEvent(doSummonCreature, 45000, t.m2, pos3)
		
		return TRUE		
	end
end

What are the issues?
*Both NPCs is created without any delay.
*No TALKTYPE_SAY appears from the NPCs
*The monsters does not appear
*The Cho'gall NPC does not disappear

Any help would be geartley appreciated!

Kind regards,
Gaddhuve
 
addEvent returns event id, not return value of function since this would be impossible when it's delayed, so better group doCreatureSay with addEvents that are spawning the npcs
 
Back
Top