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

Different NPC Task.

Zarabustor

Human Being
Joined
Sep 10, 2009
Messages
186
Reaction score
0
Location
Cancun, Mexico
Hi, all we know that there some NPCS tasks, but i thought in one that is about to get XXX items and kill XXX monsters so you get a reward, the reward is a custom oufit.

EXAMPLE: You must get 2 Gemstones and kill 300 parrots to get the reward (CUSTOM OUTFIT), first you go to the npc and say: hi, missions, NPC says: Here are the missions parrot,rotworm,chicken,cocodrile etc.. (WILL BE ABOUT 15 missions abable, now you choose the mission that you want.... parrot mission , then NPC says You started PARROT TASK. Also There will be a command to check the missions: !missioncheck
You have killed 23/300 parrots. NOTE: You can have more than 1 mission at the same time, if you execute the command will appears the missions that you have. Then when you killed the 300 parrots will appears a messege sayin: Done! You have killed 300 parrots, now you may go to the npc and complete your mission. REMEMBER you must have your 2 gemstones to complete it.
If you killed 300 parrots and go to the NPC and you say: Hi, parrot mission, NPC says: If you got 2 gemstones and killed 300 parrots say REWARD otherwise NPC says: return when your done. :D

One thing more: if you killed and got the stuff. Npc will add the PARROT OUTFIT ID: 217,
Code:
		doPlayerAddOutfit(cid, 212, 0)
		doPlayerAddOutfit(cid, 212, 0)
		setPlayerStorageValue(cid, 4767, 1)

Thats moreless what i want, illt will add the outfit ids at the outfit.xml file, so player will be able to change it as normal oufit. Thanks :D If you help me, ILL REP++
 
NPC.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Outfit NPC" script="SCRIPT_NAME.lua" walkinterval="3000" floorchange="0">
	<health now="100" max="100"/>
	<look type="128" head="57" body="115" legs="58" feet="114" addons="3"/>
	<parameters>
      <parameter key="message_greet" value="I got some {mission}s for you." />
    </parameters>
</npc>

NPC script.

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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

local storages = {
	parrot = {100,101},
	wolf = {102,103}
	}
	
local itemid = {
	gemstone = {id=ITEM_ID,removecount=2}
	}
	
local outfits = {
	parrot = 217,
	wolf = 27
	}

local Topic = {}
function creatureSayCallback(cid, type, msg)
	if msgcontains(msg,'mission') then
		npcHandler:say('I have quests for {parrot} outfit and {wolf} outfit.',cid)
		Topic[cid] = 1
	elseif Topic[cid] == 1 then
		if msgcontains(msg,'parrot') then
			if getPlayerStorageValue(cid,storages.parrot[1]) < 1 then
				npcHandler:say('Hmm, parrot outfit quest, eh? I can give you this in exchange for {2} gemstones and if you kill {300} parrots, ok?',cid)
				Topic[cid] = 2
			elseif getPlayerStorageValue(cid,storages.parrot[1]) == 1 then
				npcHandler:say('Have you collected the {2} gemstones and killed {300} parrots yet?',cid)
				Topic[cid] = 3
			elseif getPlayerStorageValue(cid,storages.parrot[1]) == 2 then
				npcHandler:say('You have already done this quest.',cid)
				Topic[cid] = 0
			end
		elseif msgcontains(msg,'wolf') then
			if getPlayerStorageValue(cid,storages.wolf[1]) < 1 then
				npcHandler:say('Hmm, wolf outfit quest, eh? I can give you this in exchange for {2} gemstones and if you kill {300} wolves, ok?',cid)
				Topic[cid] = 4
			elseif getPlayerStorageValue(cid,storages.wolf[1]) == 1 then
				npcHandler:say('Have you collected the {2} gemstones and killed {300} wolves yet?',cid)
				Topic[cid] = 5
			elseif getPlayerStorageValue(cid,storages.wolf[1]) == 2 then
				npcHandler:say('You have already done this quest.',cid)
				Topic[cid] = 0
			end				
	elseif Topic[cid] == 2 then
		if msgcontains(msg,'yes') then
			npcHandler:say('That\'t good! you can type {!mstatus parrot} to see how many parrots you have killed.',cid)
			setPlayerStorageValue(cid,storages.parrot[1],1)
			Topic[cid] = 0
		else
			npcHandler:say('Than not.',cid)
			npcHandler:releaseFocus(cid)
			Topic[cid] = 0
		end
	elseif Topic[cid] == 3 then	
		if msgcontains(msg,'yes') then
			if getPlayerStorageValue(cid,storages.parrot[2]) >= 300 then
				if doPlayerRemoveItem(cid,itemid.gemstone.id,itemid.gemstone.removecount) then
					doPlayerAddOutfit(cid,outfits.parrot,0)
					setPlayerStorageValue(cid,storages.parrot[1],2)
					npcHandler:say('Thank you very much! here is your parrot outfit.',cid)
					doPlayerSendTextMessage(cid,20,'You have gained a parrot outfit.')
					Topic[cid] = 0
				else
					npcHandler:say('You don\'t have enough gemstones.',cid)
					npcHandler:releaseFocus(cid)
					Topic[cid] = 0
				end
			else
				npcHandler:say('You haven\'t killed 300 wolves yet!',cid)
				npcHandler:releaseFocus(cid)
				Topic[cid] = 0
			end
		else
			npcHandler:say('Than not..',cid)
			npcHandler:releaseFocus(cid)
			Topic[cid] = 0
		end
	elseif Topic[cid] == 4 then
		if msgcontains(msg,'yes') then
			npcHandler:say('That\'t good! you can type {!mstatus wolf} to see how many wolves you have killed.',cid)
			setPlayerStorageValue(cid,storages.wolf[1],1)
			Topic[cid] = 0
		else
			npcHandler:say('Than not.',cid)
			npcHandler:releaseFocus(cid)
			Topic[cid] = 0
		end
	elseif Topic[cid] == 5 then
		if msgcontains(msg,'yes') then
			if getPlayerStorageValue(cid,storages.wolf[2]) >= 300 then
				if doPlayerRemoveItem(cid,itemid.gemstone.id,itemid.gemstone.removecount) then
					doPlayerAddOutfit(cid,outfits.wolf,0)
					setPlayerStorageValue(cid,storages.wolf[1],2)
					npcHandler:say('Thank you very much! here is your wolf outfit.',cid)
					doPlayerSendTextMessage(cid,20,'You have gained a wolf outfit.')
					Topic[cid] = 0
				else
					npcHandler:say('You don\'t have enough gemstones.',cid)
					npcHandler:releaseFocus(cid)
					Topic[cid] = 0
				end
			else
				npcHandler:say('You haven\'t killed 300 wolves yet!',cid)
				npcHandler:releaseFocus(cid)
				Topic[cid] = 0
			end
		else
			npcHandler:say('Than not..',cid)
			npcHandler:releaseFocus(cid)
			Topic[cid] = 0
		end
	end
	return true
end
npcHandler:setMessage(MESSAGE_WALKAWAY, "Goodbye, |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Goodbye..")
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Creatureevent (register it in login.lua).

Lua:
local storages = {
	parrot = {101},
	wolf = {103}
	}

local monsters = {
	{'parrot'},
	{'wolf'}
	}

function onKill(cid, target, lastHit)
	if isCreature(target) then
		for i = 1, #monsters do
			if getCreatureName(target):lower() == monsters[i]:lower() then
				setPlayerStorageValue(cid,storages.getCreatureName(target):lower,getPlayerStorageValue(cid,storages.getCreatureName(target):lower())+1)
			end
		end
	end
	return true
end

Talkaction (not sure if it works, but try).

Lua:
local monsters = {
	parrot = {101},
	wolf = {102}
	}

function onSay(cid,words,param)
	if getPlayerStorageValue(cid,monsters.parrot) == 1 then
		for mparam,storage in ipairs(monsters) do
			if param == mparam then
				doPlayerSendTextMessage(cid,19,'You have killed '..getPlayerStorageValue(storage)..'/300 '..param..'.')
			else
				doPlayerSendTextMessage(cid,19,'You haven\'t started this quest yet.')
		end
	else
		doPlayerSendTextMessage(cid,19,'You haven\'t started this quest yet.')
	end
	return true
end
 
Back
Top