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

[NPC] A npc gives player a storage to enter a door

3alola1

I don't have time
Joined
Sep 2, 2010
Messages
927
Solutions
8
Reaction score
527
Location
Darashia
I need a script that when player say {Something} the npc gives him a Storageid to make him enter a door
 
Can you post a npc / action script so i can edit them for you. Haven't used 0.3.6 in a while so i don't have any on my comp.
Regards Alw

the npc xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Pentas" script="data/npc/scripts/Pentas.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="79" body="10" legs="127" feet="127" addons="1"/>
<voices>
<voice text="Petros is here for help." interval2="100" margin="1" yell="no"/>
</voices>
<parameters>
<parameter key="message_farewell" value="Good bye. Recommend us if you were satisfied with our service." />
<parameter key="message_walkaway" value="Good bye. Recommend us if you were satisfied with our service." />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="name;darashia;job;" />
<parameter key="keyword_reply1" value="My name is Petros from the Royal Tibia Line." />
<parameter key="keyword_reply2" value="Ohh. i don't work as a ship captain any more now I work as one from the quest helpers like helping you or something" />
<parameter key="keyword_reply2" value="I left my old work as a ship captain in darashia due to a rich company bought all the boats in {Tibia} but now i got a nice job helping people to give them advices about the famous quest {Inquisition} and give them rewards for helping thiere town of the attacks of the monsters in Teuana" />
<parameter key="message_greet" value="Welcome on board, |PLAYERNAME|. What should I help you with?"/>
</parameters>
</npc>
 
Use this function to set the storage:

Code:
doPlayerSetStorageValue(uid, key, newValue)

and this to check the storage in door:

Code:
getPlayerStorageValue(uid, key)
 
Can you post a npc / action script so i can edit them for you. Haven't used 0.3.6 in a while so i don't have any on my comp.
Regards Alw
I just stripped down the npc rune script :)
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



local playerMsg = 'something'
local playerStorage = 30000
local valueToSet = 1

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, playerMsg) and getPlayerStorageValue(cid, playerStorage) <= 0 then
        selfSay('Here ya go!', cid)
        doPlayerSetStorageValue(cid, playerStorage, valueToSet)
    else
        selfSay('Storage value already set :(!', cid)
        talkState[talkUser] = 0
    end

    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Here is the npchandler.lua if you want to alter the initial greeting etc, so you can add it in the script not change the handler file.
http://pastebin.com/wBre6ycE
 
Last edited:
Back
Top