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

[Request]Custom Npc

Illusion

Legend
Joined
Dec 7, 2010
Messages
2,153
Reaction score
150
Location
The Netherlands
Heya. I need a npc. he suppose to give you a special item wich u need for addons.

Information:

Name: Farmer Frank.
Wants: 50 Eggs.
Gives: Special Item. (have to come up with something yet)

Talkaction:
Player: Hi.
Frank: Hello! Can U maybe help me getting some Eggs?
Player: Sure, how Much U need?
Frank: I need 50 eggs. Come back if u have them. Ill reward U!

After:
Player: Hi.
Frank: Hello, do you got the eggs I asked for?
Player: Yes, Here they are.
Frank: Thanks! Here is your reward!

[You rewarded ....]

I need it rl bad, so please help me. :$
Rep if u help me :p

Ciaoo.
 
First Step: go to data/npcs and create new XML file and rename it with "aveo.xml" or another name with you preference and put this into:

LUA:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Aveo" script="data/npc/scripts/aveo.lua" walkinterval="5000" floorchange="0">
    <health now="100" max="100"/>
    <look type="266" head="1" body="1" legs="1" feet="1" addons="3"/>
    <parameters>
        <parameter key="message_greet" value="Hello! |PLAYERNAME| Can you maybe help me getting some {Eggs}?" />
       
		
		
    </parameters>
</npc>
Now in data/npc/scripts copy any file and rename it with "aveo.lua"
and put this in the file:


LUA:
--------------------------------
------- NPC MISION  1.0 --------
------ by Aveo - Otland.net ----
--------------------------------

--------------
--- Config ---
--------------
-- item required to make the quest
local i_required = 2695
-- count of item required to make the quest
local i_required_count = 50

-- reward item id default (crystal coins)
local i_reward = 2160

-- count of reward id default (10)
local i_reward_count = 10

-- storage dont touch --
local storage = 60307

-- name of the new quest --
local questname = "aveo quest"

-- NPC Messages --
local npc_message ={

"I need some item to complete this mission, procced?",
"You dont have any items to this mission.", 
"Thank You for Help me, {take it.}",
"You have Already done this {mission}.",
"This Mission is, really serius, i need your help to complete it, if you help me i can give some items to you?"
}

-------------------
--- End Confing ---	
-------------------
									
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if(msgcontains(msg, 'eggs')) then
selfSay(npc_message[5], cid)
end

if(msgcontains(msg, questname)) then
selfSay(npc_message[1], cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if (getPlayerStorageValue(cid,storage) > 0) then
selfSay(npc_message[4], cid)
else

if(doPlayerRemoveItem(cid,i_required,i_required_count)) then
setPlayerStorageValue(cid,storage,1)
doPlayerAddItem(cid,i_reward,i_reward_count)
selfSay(npc_message[3], cid)
doSendMagicEffect(getCreaturePosition(cid), 10)
doCreatureSay(cid, "Quest Completed!", TALKTYPE_ORANGE_1)
else
selfSay(npc_message[2], cid)
end
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


ALL CREDITS GOES TO ACUBENS


:P so rep him and rep me its not perfect but it works :) just change the redward things
 
Back
Top