I wish to make this script, but adding a form that the NPC will check level, and if its under allowed level, NPC will send normla msg, if player is under level, then NPC will say "I'm only recruiting players from level 10 to 15 to this task, come back after..."
and if player is above allowed level, then NPC should display a message like this:
"You are above level 15 maybe you got more importants things to do"
Or similar. This part is important. and I really need it,
And in a secondary form I would like that when player receive experience, appear in red letters in screen or in default channel, (is the same), "You received 100 experience points."
The secondary part only if its possible, but about levels I really need it...
Here follow the scripts:
PD: The storage values are set in a form the quest can be done so many times as player want, so it is not a mistake it were done intentionally.
Really hope some help, rep++ for sure!!
and if player is above allowed level, then NPC should display a message like this:
"You are above level 15 maybe you got more importants things to do"
Or similar. This part is important. and I really need it,
And in a secondary form I would like that when player receive experience, appear in red letters in screen or in default channel, (is the same), "You received 100 experience points."
The secondary part only if its possible, but about levels I really need it...
Here follow the scripts:
PD: The storage values are set in a form the quest can be done so many times as player want, so it is not a mistake it were done intentionally.
Lua:
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 tokenid = 2676
local storage = 5819
local getstorage = getPlayerStorageValue(cid, storage)
local sorrymessage = "Sorry, you don't have enough to share..."
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'task') then
if getstorage == 3 then
npcHandler:say("Im not hungry anymore.", cid)
elseif getstorage < 3 then
npcHandler:say("Make days I don't eat nothing, could you bring me like five bananas? I will return you 100 experience points.", cid)
talkState[talkUser] = 1
end
elseif msgcontains(msg, 'yes') then
if talkState[talkUser] == 1 then
setPlayerStorageValue(cid, storage, 1)
if getstorage == 1 then
if doPlayerRemoveItem(cid, tokenid, 5) == TRUE then
setPlayerStorageValue(cid, storage, 2)
doPlayerAddExp(cid, 100)
npcHandler:say("Here you have, 100 experience points. Thank you.", cid)
setPlayerStorageValue(cid, storage, 1)
talkState[talkUser] = 0
elseif doPlayerRemoveItem(cid, tokenid, 5) == FALSE then
npcHandler:say(sorrymessage, cid)
talkState[talkUser] = 0
end
end
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
npcHandler:say("Ok than.", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Really hope some help, rep++ for sure!!