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

bless price

Mauzim

Member
Joined
Jan 3, 2011
Messages
568
Reaction score
9
Code:
	local node1 = keywordHandler:addKeyword({'wisdom of solitude'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can provide you with the wisdom of solitude. But you will have to sacrifice [COLOR="red"]( HERE PRICE FROM BASE + LEVEL COST ) [/COLOR]gold to receive it. Are you still interested?'})
	node1:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 1, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
	node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Ok. As you wish.'})
How to make that where is red price BASE + LEVEL COST
 
http://otland.net/f132/henricus-blessings-120247/#post1180366
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local t = {}
 
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
	elseif msgcontains(msg, 'wisdom') then
		local v = getPlayerLevel(cid)
		if v < 31 then
			v = 2000
		elseif v > 119 then
			v = 20000
		else
			v = (v - 20) * 200
		end
		npcHandler:say('I can provide you with the wisdom of solitude. Would you like to receive my blessing for ' .. v .. ' gold?', cid)
		t[cid] = 1
	elseif t[cid] == 1 then
		if msgcontains(msg, 'yes') then
			if not getPlayerBlessing(cid, 1) then
				local v = getPlayerLevel(cid)
				if v < 31 then
					v = 2000
				elseif v > 119 then
					v = 20000
				else
					v = (v - 20) * 200
				end
				if doPlayerRemoveMoney(cid, v) then
					npcHandler:say('So receive the wisdom of solitude, pilgrim.', cid)
					doPlayerAddBlessing(cid, 1)
					doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
				else
					npcHandler:say('Oh. You do not have enough money..', cid)
				end
			else
				npcHandler:say('You already possess this blessing.', cid)
			end
		else
			npcHandler:say('Ok. As you wish.', cid)
		end
		t[cid] = nil
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top