• 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 [NPC] help in Fix NPC King Orc

Adi69

Active Member
Joined
Mar 14, 2008
Messages
161
Reaction score
35
Location
Poland
Qban found a orc king npc script but it's doesn't work :(
Someone can fix it? for tfs 3.6.0pl1

here is codes:

Code:
<?xml version="1.0"?>
<npc name="The Orc King" script="data/npc/scripts/orcking.lua" access="5" lookdir="2" >
<mana now="1" max="1" />
<health now="1" max="1" />
<look type="238"/>
</npc>
Code:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
  	if focus == cid then
          selfSay('Good bye then.') -- change this
          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)
  	msg = string.lower(msg)
	if msgcontains(msg, 'hi') then
		doSummonCreature("Orc Warlord,2", "Orc Leader,3", "Slime 3", getCreaturePosition(cid)) 
  		selfSay('My servants, come to me!!.') -- change this
		end
	elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
			selfSay('Good bye, ' .. getCreatureName(cid) .. '!') -- change this
			focus = 0
			talk_start = 0
	end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
  	if (os.clock() - talk_start) > 30 then
  		if focus > 0 then
  			selfSay('What do you want?') -- change this
  		end
  			focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 5 then
 			selfSay('Good bye!.') -- change this
 			focus = 0
 		end
 	end
end

Thanks! :)
REP++
 
Back
Top