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

Lua sceptre bug?

Glidarn

Member
Joined
May 9, 2009
Messages
970
Reaction score
16
Location
Åkersberga, Sweden
When collecting the sceptre parts from ghost of a priest npc's i'm finding it really annoying when it doesnt work... so ima explain the problem down here.


Lua:
	if(item.actionid == 130) then -- combine scepter
		if(getPlayerItemCount(cid, 12285) >= 1 and getPlayerItemCount(cid, 12286) >= 1 and getPlayerItemCount(cid, 12287) >= 1 and getPlayerStorageValue(cid, STORAGE_SCEPTRE) < 1) then
			doPlayerRemoveItem(cid, 12285, 1)
			doPlayerRemoveItem(cid, 12286, 1)
			doPlayerRemoveItem(cid, 12287, 1)
			doPlayerAddItem(cid, 12279, 1)
			doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT)
			setPlayerStorageValue(cid, STORAGE_SCEPTRE, 1)
		end
	end

npc:

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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if(msgcontains(msg, "mission")) then
		if(getPlayerStorageValue(cid, STORAGE_ZALAMON) == 5) then
			if(getPlayerStorageValue(cid, STORAGE_GHOST) < 1) then
				npcHandler:say("Although we are willing to hand this item to you, there is something you have to understand: There is no such thing as 'the' sceptre. ...", cid)
				npcHandler:say("Those sceptres are created for special purposes each time anew. Therefore you will have to create one on your own. It will be your mission to find us three keepers and to get the three parts of the holy sceptre. ...", cid, true)
				npcHandler:say("Then go to the holy altar and create a new one.", cid, true)
				setPlayerStorageValue(cid, STORAGE_GHOST, 1)
			elseif(getPlayerStorageValue(cid, STORAGE_GHOST) > 0) then
				npcHandler:say("Even though we are spirits, we can't create anything out of thin air. You will have to donate some precious metal which we can drain for energy and substance. ...", cid)
				npcHandler:say("The equivalent of 5000 gold will do. Are you willing to make such a donation?", cid, true)
				talkState[talkUser] = getPlayerPosition(cid).z
			end
		end
	elseif(msgcontains(msg, "yes")) then
		if(talkState[talkUser]) then
			if(getPlayerMoney(cid) >= 5000) then
				doPlayerAddItem(cid, 12287 - talkState[talkUser], 1)
				doPlayerRemoveMoney(cid, 5000)
				npcHandler:say("So be it! Here is my part of the sceptre. Combine it with the other parts on the altar of the Great Snake in the depths of this temple. ", cid)
			else
				npcHandler:say("If you bring me 5000 gold we can talk this out, if no then no.", cid)
			end
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, "no") and talkState[talkUser]) then
		npcHandler:say("No deal then.", cid)
		talkState[talkUser] = 0
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


but this is what happends when you say "mission, mission, yes"

ImageShack� - Online Photo and Video Hosting

???
 
The Item that you're looking are not atualized, but you may modify it by going on: Data > items > items.xml, so search for the ID and modify it as you wish.
In the lua code you does not set the value to STORAGE_SCEPTRE.
Try to put it in the begining of the code:
Lua:
local STORAGE_SCEPTRE = getPlayerStorageValue(cid, xxxxx)
Where xxxxx is the storage value.

And I think that the code of the NPC have the same problem. But I will sleep now and I can't read it all. Work tomorrow! See ya!
 
<item id="2977" name="remains of a ghost">
<attribute key="weight" value="1000" />
<attribute key="containerSize" value="10" />
<attribute key="decayTo" value="2978" />
<attribute key="duration" value="600" />
<attribute key="corpseType" value="undead" />

just change the names to /\ and find the "decayto" of the corpse you want to change. I will not make to you cause I use an older version.
 
Back
Top