• 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!

[NPC] Someone can help me?

I'm not sure that it works but... try ;]
Let's start...
create file the orc king.xml
paste this:
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>

then create file "orcking.lua"
paste:
HTML:
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

Messages aren't similar to RL, You have to correct it manually :(
Regards.
 
no have :p
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local t = {
	'Slime', 'Slime', 'Slime',
	'Orc Warlord', 'Orc Warlord',
	'Orc Leader', 'Orc Leader', 'Orc Leader'
}

function onCreatureAppear(cid)            npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)        npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)  npcHandler:onCreatureSay(cid, type, msg)    end
function onThink()                        npcHandler:onThink()                        end

function greetCallback(cid)
	if getPlayerStorageValue(cid, 218) == -1 then
		npcHandler:say('Arrrrgh! A dirty paleskin! To me my children! Kill them my guards!', cid)
		setPlayerStorageValue(cid, 218, 1)
		local pos = getThingPos(getNpcCid())

		for i = 1, #t do
			doSummonCreature(t[i], pos)
		end

	else
		return true
	end
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setMessage(MESSAGE_GREET, 'Harrrrk! You think you are strong now? You shall never escape my wrath! I am immortal!')
npcHandler:setMessage(MESSAGE_FAREWELL, 'We will meet again.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Yes, flee this place, but you will never escape my revenge!')
npcHandler:addModule(FocusModule:new())
 
Edited Cykotitans post and added paralyze for 10 seconds.

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local t = {
	'Slime', 'Slime', 'Slime',
	'Orc Warlord', 'Orc Warlord',
	'Orc Leader', 'Orc Leader', 'Orc Leader'
}
local condition = createConditionObject(CONDITION_PARALYZE)
setConditionFormula(condition, -0.9, 0, -0.9, 0)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
 
function onCreatureAppear(cid)            npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)        npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)  npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                        npcHandler:onThink() end
 
function greetCallback(cid)
	if getPlayerStorageValue(cid, 218) == -1 then
		npcHandler:say('Arrrrgh! A dirty paleskin! To me my children! Kill them my guards!', cid)
		setPlayerStorageValue(cid, 218, 1)
		doAddCondition(cid, condition)
		local pos = getThingPos(getNpcCid())
 
		for i = 1, #t do
			doSummonCreature(t[i], pos)
		end
 
	else
		return true
	end
end
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setMessage(MESSAGE_GREET, 'Harrrrk! You think you are strong now? You shall never escape my wrath! I am immortal!')
npcHandler:setMessage(MESSAGE_FAREWELL, 'We will meet again.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Yes, flee this place, but you will never escape my revenge!')
npcHandler:addModule(FocusModule:new())
 
Last edited:
Back
Top