• 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 so what's wrong?

Maxwel1

Legend Of Everything
Joined
Feb 3, 2009
Messages
196
Reaction score
1
Location
In The Jungle
Simply this script was workin good on Naxedot 3.5 but when i put it in forgotten (Styller Yourots 8.50 V6) it it gave me this error. and ingame when i say hi to the npc it don answer back so any ideas?




Error:

[03/08/2009 14:09:49] Lua Script Error: [Npc interface]
[03/08/2009 14:09:49] data/npc/scripts/Godrick.lua:eek:nCreatureSay

[03/08/2009 14:09:49] data/npc/scripts/Godrick.lua:40: attempt to

compare nil with number
[03/08/2009 14:09:49] stack traceback:
[03/08/2009 14:09:49] data/npc/scripts/Godrick.lua:40: in function <data/npc/scripts/Godrick.lua:37>



Script:

Code:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
local talk_state = 0

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
  	if focus == cid then
          selfSay('Dare to see you here again.')
          focus = 0
          talk_start = 0
  	end
end


function onCreatureTurn(creature)

end


function msgcontains(txt, str)
  	return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
 cname = getCreatureName(cid)

  	if (msgcontains(msg, 'hi') ) and getDistanceToCreature(cid) < 4 then
  		selfSay('Get out of my way, ' .. cname .. '. Orshabaal must die!')
  		talk_state = 0
  		focus = cid
  		talk_start = os.clock()

  	end
end


function onCreatureChangeOutfit(creature)

end


function onThink()


 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 5 then
 			selfSay('Dare to see you here again.')
 			focus = 0
 		end
 	end
end
 
Back
Top Bottom