• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

"Mission NPC 1.0"

Lifer420

Advanced OT User
Joined
Jul 27, 2009
Messages
1,490
Reaction score
196
**TFS 0.4 dev 3884**

So i'm using this script for "Mission NPC 1.0" and I wanna know if it's possible to set certain keywords to be able to pick multiple missions. -*ALSO*- It says "for exp use true" and I have it true, but it doesn't give any EXP. It just gave the item reward(Crystal coin) with no exp. Then I kept it true and removed the item ID and item count, and it just said completed, but no exp. Something is wrong with the exp receiving code I guess.

Code:
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



--------------------------------
------- NPC MISION  2.0 --------
------ by Acubens - Otland.net -
--------------------------------


local first = {
-- Place true if you want to use the system of a gift for experience, false if you want to use items
useExpReward = true,
-- The experience that will get the player at the end of the mission
experience = 15000,
-- Id of the item that will be asking for the NPC to complete the mission
item = 10609,
-- Count of the item required
item_count = 10,
-- id of the gift that going to obtain the player at finish the mission
reward = 0,
-- count of the gift item
reward_count = 0,
-- storage
storage = 60307,
-- name of the quest
questname = "task"
}

local npc_message ={

-- Proceed - message
"Did you collect 10 samples of dirt?",
-- if you dont have items - message
"You need to bring me 10 lumps of dirt from beetles and bugs in the sewers, quickly!",
-- thanks - message
"Thanks! Now SCRAM!",
-- already done - message
"You have already done this mission.",
-- ready to go - message
"The {"..first.questname.."} is quite serious, really. There are some beetles and bugs down in the sewers. Slay them and bring me back 10 lumps of dirt so I can check the soil to make sure they're not laying eggs down there! Go quickly!",
-- congratulations - message
"Congratulations! You've helped Eldest and have been rewarded with experience!"

}


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

if(msgcontains(msg, first.questname)) then
    selfSay(npc_message[1], cid)
    talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
    if (getPlayerStorageValue(cid,first.storage) > 0) then
        selfSay(npc_message[4], cid)
    else
        if(doPlayerRemoveItem(cid,first.item,first.item_count)) then
            setPlayerStorageValue(cid,first.storage,1)
            if(useExpReward) then
                doPlayerAddExperience(cid,first.experience)
            else
                doPlayerAddItem(cid,first.reward,first.reward_count)
            end
            selfSay(npc_message[3], cid)
            doSendMagicEffect(getCreaturePosition(cid), 10)
            doCreatureSay(cid, npc_message[6], 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())

I've edited it to make it to my liking, but right now the chatlog goes : **KEY** (P=Player N=NPC)

P: Hi
N:The task is quite serious, really. There are some beetles and bugs down in the sewers. Slay them and bring me back 10 lumps of dirt so I can check the soil to make sure they're not laying eggs down there! Go quickly!

Then you go collect them from sewers. Come back.

P: Hi
N: Says the same thing, idk how to make it AFTER you already said mission once that it changes. So its
N:The task is quite serious, really. There are some beetles and bugs down in the sewers. Slay them and bring me back 10 lumps of dirt so I can check the soil to make sure they're not laying eggs down there! Go quickly!

P:Task
N: Did you collect 10 samples of dirt?
P: Yes

Then you complete it.



Is there anyway I can make it to "after player has Storage=60307, change message to "Hello |PLAYERNAME|, which task would you like to help me with? I can use some help on XXXXX, YYYYYY,ZZZZZZ, WWWWWWWW and QQQQQQQ"

PLEASE AND THANK YOU IN ADVANCE!
 
Back
Top