• 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 VooDoo, Demon Oak Monk.

WibbenZ

Global Moderator
Staff member
Global Moderator
Joined
Oct 16, 2008
Messages
6,374
Solutions
229
Reaction score
1,503
Location
Sweden
Hey guys and Girls :p.

Lua:
local outfits = {5, 6, 7, 8, 9, 15, 18, 23, 24, 25, 29, 33, 37, 40, 48, 50, 53, 54, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 76, 78, 93, 96, 97, 98, 100, 126, 127, 193,194, 195, 196, 203, 214, 215, 216, 229, 232, 235, 237, 246, 249, 253, 254, 255, 259, 260, 264, 281, 282, 287, 296, 297, 298, 300, 301}
local outfit =
	{
		lookType = 2,
		lookHead = 0,
		lookBody = 0,
		lookLegs = 0,
		lookFeet = 0,
		lookAddons = 0
	}
local outfit0 =
	{
		lookType = 2,
		lookHead = 0,
		lookBody = 0,
		lookLegs = 0,
		lookFeet = 0,
		lookAddons = 0
	}
function onUse(cid, item, frompos, item2, topos)
if getPlayerStorageValue(cid,1921) == -1 or getPlayerStorageValue(cid,1921) == #outfits then
setPlayerStorageValue(cid,1921,1)
doSetCreatureOutfit(cid, outfit0, -1)
else
for i=1,#outfits do
if getPlayerStorageValue(cid,1921) == i then
outfit.lookType = outfits[i]
doCreatureSay(cid, "!Change", TALKTYPE_ORANGE_1)
doSetCreatureOutfit(cid, outfit, -1)
setPlayerStorageValue(cid,1921,i+1)
break
end

rep++ for fixx!!

console bug:
Code:
[28/04/2010 07:25:38] Warning: [Event::checkScript] Can not load script. /scripts/tools/voodoo.lua
[28/04/2010 07:25:38] data/actions/scripts/tools/voodoo.lua:32: 'end' expected (to close 'for' at line 25) near '<eof>'

{///////////////////////////////////////////////////////////////}

Demon Oak.
script:
Lua:
-- WAS NOT Made by Coltain13 // Coltain, I only made it work for TFS --


local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
	-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
	if(npcHandler.focus ~= cid) then
		return false
	end

		player_gold = getPlayerItemCount(cid,2148)
		player_plat = getPlayerItemCount(cid,2152)*100
		player_crys = getPlayerItemCount(cid,2160)*10000
		player_money = player_gold + player_plat + player_crys
		playerCap = getPlayerFreeCap(cid)
		item = 8293 --Hallowed Axe
		itemweight = getItemWeight(item, 1)
		
		if msgcontains(msg, 'hallowed axe') then
			if isPremium(cid) == TRUE then
				if getPlayerItemCount(cid,2386) >= 1 player_money >= 3500000 then
					selfSay('Do you want to buy a Hallowed Axe from me?')
					talk_state = 1
				else
					selfSay('You have to bring me an axe and 1000 gp first.')
					talk_state = 0
				end
			else
				selfSay('You need premium to buy this axe from me.')
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 1 then
			talk_state = 0
			if getPlayerItemCount(cid,2386) >= then and player_money >= 3500000 then
					if doPlayerTakeItem(cid,2386,1) == 1 and pay(cid,3500000) and playerCap >= itemweight then
						selfSay('Here you are. You can now defeat the demon oak with this axe.')
						doPlayerAddItem(cid,item,1)
						talk_state = 0
					else
						selfSay('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.')
						talk_state = 0
					end
			else
				selfSay('Please bring with you an axe and enough with money.')
				talk_state = 0
			end
		elseif msgcontains(msg, 'demon oak') then
			if getPlayerItemCount(cid,2386) >= then and player_money >= 3500000 then
				selfSay('Did you defeat the demon oak?')
				talk_state = 2
			else
				selfSay('Go defeat the demon oak.')
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 2 then
			talk_state = 0
			if getPlayerStorageValue(cid,21545) == 1 then
				selfSay('Good job!')
				setPlayerStorageValue(cid,21545,2)
			end
------------------------------------------------ confirm no ------------------------------------------------
		elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
			selfSay('Ok thanks.')
			talk_state = 0
		end
	-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
exe bug:
Code:
[28/04/2010 07:25:44] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/demon oak monk.lua
[28/04/2010 07:25:44] data/npc/scripts/demon oak monk.lua:31: 'then' expected near 'player_money'
 
Code:
local outfits = {5, 6, 7, 8, 9, 15, 18, 23, 24, 25, 29, 33, 37, 40, 48, 50, 53, 54, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 76, 78, 93, 96, 97, 98, 100, 126, 127, 193,194, 195, 196, 203, 214, 215, 216, 229, 232, 235, 237, 246, 249, 253, 254, 255, 259, 260, 264, 281, 282, 287, 296, 297, 298, 300, 301}
local outfit = {lookType = 2, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}
local outfit0 = {lookType = 2, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 1921) < 1 or getPlayerStorageValue(cid, 1921) == #outfits then
		setPlayerStorageValue(cid, 1921, 1)
		doSetCreatureOutfit(cid, outfit0, -1)
	else
		for i=1,#outfits do
			if getPlayerStorageValue(cid,1921) == i then
				outfit.lookType = outfits[i]
				doCreatureSay(cid, "!Change", TALKTYPE_ORANGE_1)
				doSetCreatureOutfit(cid, outfit, -1)
				setPlayerStorageValue(cid, 1921, i + 1)
				break
			end
		end
	end
	return true
end

in the second script change 31 line to:
Code:
if getPlayerItemCount(cid, 2386) >= 1 and getPlayerMoney(cid) >= 3500000 then
 
Thanks, Voodoo workes now.
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
	-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
	if(npcHandler.focus ~= cid) then
		return false
	end

		player_gold = getPlayerItemCount(cid,2148)
		player_plat = getPlayerItemCount(cid,2152)*100
		player_crys = getPlayerItemCount(cid,2160)*10000
		player_money = player_gold + player_plat + player_crys
		playerCap = getPlayerFreeCap(cid)
		item = 8293 --Hallowed Axe
		itemweight = getItemWeight(item, 1)
		
		if msgcontains(msg, 'hallowed axe') then
			if isPremium(cid) == TRUE then
if getPlayerItemCount(cid, 2386) >= 1 and getPlayerMoney(cid) >= 3500000 then
					selfSay('Do you want to buy a Hallowed Axe from me?')
					talk_state = 1
				else
					selfSay('You have to bring me an axe and 1000 gp first.')
					talk_state = 0
				end
			else
				selfSay('You need premium to buy this axe from me.')
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 1 then
			talk_state = 0
			if getPlayerItemCount(cid,2386) >= then and player_money >= 3500000 then
					if doPlayerTakeItem(cid,2386,1) == 1 and pay(cid,3500000) and playerCap >= itemweight then
						selfSay('Here you are. You can now defeat the demon oak with this axe.')
						doPlayerAddItem(cid,item,1)
						talk_state = 0
					else
						selfSay('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.')
						talk_state = 0
					end
			else
				selfSay('Please bring with you an axe and enough with money.')
				talk_state = 0
			end
		elseif msgcontains(msg, 'demon oak') then
			if getPlayerItemCount(cid,2386) >= then and player_money >= 3500000 then
				selfSay('Did you defeat the demon oak?')
				talk_state = 2
			else
				selfSay('Go defeat the demon oak.')
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 2 then
			talk_state = 0
			if getPlayerStorageValue(cid,21545) == 1 then
				selfSay('Good job!')
				setPlayerStorageValue(cid,21545,2)
			end
------------------------------------------------ confirm no ------------------------------------------------
		elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
			selfSay('Ok thanks.')
			talk_state = 0
		end
	-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
	return true
end

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

Code:
[28/04/2010 15:10:17] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/demon oak monk.lua
[28/04/2010 15:10:17] data/npc/scripts/demon oak monk.lua:44: unexpected symbol near 'then'
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local Topic = {}

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, 'hallowed') and msgcontains(msg, 'axe') then
		if isPremium(cid) then
			if getPlayerItemCount(cid, 2386) >= 1 and getPlayerMoney(cid) >= 1000 then
				selfSay('Do you want to buy a Hallowed Axe from me?', cid)
				Topic[cid] = 1
			else
				selfSay('You have to bring me an axe and 1000 gp first.', cid)
				Topic[cid] = 0
			end
		else
			selfSay('You need premium to buy this axe from me.', cid)
			Topic[cid] = 0
		end
	elseif msgcontains(msg, 'yes') and Topic[cid] == 1 then
		if getPlayerItemCount(cid, 2386) >= 1 and getPlayerMoney(cid) >= 1000 then
			if getPlayerFreeCap(cid) >= getItemWeightById(8293) and doPlayerRemoveItem(cid, 2386, 1) and doPlayerRemoveMoney(cid, 1000) then
				selfSay('Here you are. You can now defeat the demon oak with this axe.', cid)
				doPlayerAddItem(cid, 8293, 1)
			else
				selfSay('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.', cid)
			end
		else
			selfSay('Please bring with you an axe and enough with money.', cid)
		end
		Topic[cid] = 0
	elseif msgcontains(msg, 'demon') and msgcontains(msg, 'oak') then
		if getPlayerStorageValue(cid, 21545) == 1 then
			selfSay('Did you defeat the demon oak?', cid)
			Topic[cid] = 2
		elseif getPlayerStorageValue(cid, 21545) < 1 then
			selfSay('Go defeat the demon oak.', cid)
			Topic[cid] = 0
		end
	elseif msgcontains(msg, 'yes') and Topic[cid] == 2 then
		selfSay('Good job!', cid)
		setPlayerStorageValue(cid,21545,2)
		Topic[cid] = 0
	elseif msgcontains(msg, 'no') and Topic[cid] >= 1 and Topic[cid] <= 2 then
		selfSay('Ok thanks.', cid)
		Topic[cid] = 0
	end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
[28/04/2010 22:00:09] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/demon oak monk.lua
[28/04/2010 22:00:09] data/npc/scripts/demon oak monk.lua:1: '=' expected near 'keywordHandler'

;S
 
sux npc have you
xD!

here 1º
data/npc
create npc.xml
name: Oldrak.xml
Lua:
  <npc name="Oldrak" script="data/npc/scripts/oldrak.lua" walkinterval="2000" floorchange="0" access="3" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="57" head="115" body="113" legs="31" feet="38" addons="3" corpse="2212"/>
    <parameters>
        <parameter key="message_greet" value="Hello, |PLAYERNAME|!" />
        <parameter key="message_needmoremoney" value="Try again when you have more money."/>
        <parameter key="message_decline" value="Why would you tease me like that?"/>
    </parameters>
</npc>

now
data/npc/scripts
create script.lua
name: Oldrak.lua
Lua:
  local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if (not npcHandler:isFocused(cid)) then
        return false
    end

        if msgcontains(msg, 'hallowed axe') then
                npcHandler:say('Do you want to buy a Hallowed Axe from me?', cid)
                talk_state = 1
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
                local price = 1000
            if getPlayerItemCount(cid, 2386) >= 1 and getPlayerMoney(cid) >= price then
                if doPlayerRemoveMoney(cid, price) == true then
                    npcHandler:say('Here you are. You can now defeat the demon oak with this axe.', cid)
                    doPlayerRemoveItem(cid, 2386, 1)
                    doPlayerAddItem(cid, 8293, 1)
                    talk_state = 0
                end
            else
                npcHandler:say('I need an axe and ' .. price .. ' gold coins to make you a {hallowed axe}.', cid)
                talk_state = 0
            end
        elseif msgcontains(msg, 'demon oak') then
                npcHandler:say('Did you defeat the demon oak?', cid)
                talk_state = 2
        elseif msgcontains(msg, 'yes') and talk_state == 2 then
            if getPlayerStorageValue(cid, 35700) == 1 then
                npcHandler:say('Good job!', cid)
                doPlayerSetStorageValue(cid, 35700, 2)
                talk_state = 0
            else
                npcHandler:say('Go defeat the demon oak first.', cid)
                talk_state = 0
            end
------------------------------------------------ confirm no ------------------------------------------------
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
            npcHandler:say('Ok thanks.', cid)
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

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

:D?
rep+
;P
 
[28/04/2010 22:00:09] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/demon oak monk.lua
[28/04/2010 22:00:09] data/npc/scripts/demon oak monk.lua:1: '=' expected near 'keywordHandler'

;S
you copied it wrong , and it won't work on 0.2
 
Last edited:
I got 0.2..;s
sux npc have you
xD!

here 1º
data/npc
create npc.xml
name: Oldrak.xml
Lua:
  <npc name="Oldrak" script="data/npc/scripts/oldrak.lua" walkinterval="2000" floorchange="0" access="3" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="57" head="115" body="113" legs="31" feet="38" addons="3" corpse="2212"/>
    <parameters>
        <parameter key="message_greet" value="Hello, |PLAYERNAME|!" />
        <parameter key="message_needmoremoney" value="Try again when you have more money."/>
        <parameter key="message_decline" value="Why would you tease me like that?"/>
    </parameters>
</npc>

now
data/npc/scripts
create script.lua
name: Oldrak.lua
Lua:
  local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if (not npcHandler:isFocused(cid)) then
        return false
    end

        if msgcontains(msg, 'hallowed axe') then
                npcHandler:say('Do you want to buy a Hallowed Axe from me?', cid)
                talk_state = 1
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
                local price = 1000
            if getPlayerItemCount(cid, 2386) >= 1 and getPlayerMoney(cid) >= price then
                if doPlayerRemoveMoney(cid, price) == true then
                    npcHandler:say('Here you are. You can now defeat the demon oak with this axe.', cid)
                    doPlayerRemoveItem(cid, 2386, 1)
                    doPlayerAddItem(cid, 8293, 1)
                    talk_state = 0
                end
            else
                npcHandler:say('I need an axe and ' .. price .. ' gold coins to make you a {hallowed axe}.', cid)
                talk_state = 0
            end
        elseif msgcontains(msg, 'demon oak') then
                npcHandler:say('Did you defeat the demon oak?', cid)
                talk_state = 2
        elseif msgcontains(msg, 'yes') and talk_state == 2 then
            if getPlayerStorageValue(cid, 35700) == 1 then
                npcHandler:say('Good job!', cid)
                doPlayerSetStorageValue(cid, 35700, 2)
                talk_state = 0
            else
                npcHandler:say('Go defeat the demon oak first.', cid)
                talk_state = 0
            end
------------------------------------------------ confirm no ------------------------------------------------
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
            npcHandler:say('Ok thanks.', cid)
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

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

:D?
rep+
;P

why I rep u? U just copied the wrong script I wanna my script xD.
 
Back
Top