- Joined
- Nov 17, 2010
- Messages
- 6,818
- Solutions
- 586
- Reaction score
- 5,387
Code:
The Forgotten Server, version 0.3.7_SVN (Crying Damson)
Made this script, which access's a monster file, to change my looktype to 209.
Had trouble using '209' by itself to change my looktype. (if you know how to fix this, please tell!)
Code:
local time = 5 -- minutes
function onUse(cid, item, fromPosition, itemEx, toPosition)
doRemoveItem(item.uid, 1)
doSetMonsterOutfit(cid, "necromancer costume", time * 1000 * 60)
doPlayerSendTextMessage(cid, 20, "Five minutes until your disguise breaks!")
return true
end
I want it to only say that line if the player does not have the looktype of a necromancer.
The second part checks if the player has completed the quest already so that they will not have to have the 'disguise' to talk to the npc any longer.
Thanks in advance for any help! It's all very much appreciated!
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 function greetCallback(cid)
-- If player is not a necromancer If player has not finished the quest
if getCreatureOutfit(cid).lookType ~= 209 or (getPlayerStorageValue(cid,45023) ~= 2) then
selfSay("Only necromancers are permitted inside the sanctum!", cid)
return false
elseif (getPlayerStorageValue(cid,45023) == 2) then -- when quest is complete
npcHandler:setMessage(MESSAGE_GREET, "Welcome new master.", cid)
elseif getCreatureOutfit(cid).lookType == 209 then -- when you are a necromancer
npcHandler:setMessage(MESSAGE_GREET, "Welcome good master.", cid)
end
return true
end
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if msgcontains(msg, "reset") then
selfSay("reset complete.", cid)
setPlayerStorageValue(cid,45023,-1)
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())