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

TalkAction Achievements LIB/Talkaction

Backpack Tourist Achievement (NPC Sam):

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
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 OldBackpack(cid, message, keywords, parameters, node)
 
    if(not npcHandler:isFocused(cid)) then
        return false
    end
 
    if getPlayerItemCount(cid, 3960) >= 1 and getPlayerStorageValue(cid, 21002) < 0 then
                npcHandler:say("Thank you very much! This brings back good old memories! Please, as a reward, travel to Kazordoon and ask my old friend {Kroox} to provide you a special dwarven armor.", cid)
		npcHandler:say("I will mail him about you immediately. Just tell him, his old buddy sam is sending you.", cid)
                doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Backpack Tourist\".")
   	        setPlayerStorageValue(cid,21002,1)
                doPlayerRemoveItem(cid, 3960, 1)
        else
            npcHandler:say("Thank you for your concern, but I don't think this is my backpack, since you gave it to me already", cid)
    end
end
 
 
node1 = keywordHandler:addKeyword({'old backpack'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "What? Did you find my old backpack, I've lost it in Uldrak's Rock..."})
node1:addChildKeyword({'yes'}, OldBackpack, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ahh, for one moment I tought you have find my old backpack...', reset = true})
 
 
npcHandler:addModule(FocusModule:new())
 
Last edited:
Party Animal achievement:

music.lua

Lua:
local HORN = 2079
local BIRD_CAGE = 2095
local WOODEN_WHISTLE = 5786
local DIDGERIDOO = 3952
local CORNUCOPIA = 2369
local PARTY_TRUMPET = 6572
local USED_PARTY_TRUMPET = 6573

local achievement = 13 --achievement No. 13 - Party Animal

local GREEN_NOTES = {2070, 2071, 2073, 2075, 2076, 2078, 2367, 2374}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local random = math.random(1, 5)
	if(item.itemid == BIRD_CAGE) then
		doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
	elseif(item.itemid == DIDGERIDOO) then
		if(random == 1) then
			doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
			return true
		end
	elseif(item.itemid == PARTY_TRUMPET) then
		if getPlayerStorageValue(cid,20013) == 200 then --storage to get uses of party things
        	doPlayerSendTextMessage(cid,22, "Congratulations, you earned the achievement " .. getAchievementInfo(tonumber(achievement)).name .. ".")
   			doPlayerAddAchievement(cid, achievement)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			setPlayerStorageValue(cid,76213,1)
        end
		doTransformItem(item.uid, USED_PARTY_TRUMPET)
		doCreatureSay(cid, "TOOOOOOT!", TALKTYPE_ORANGE_1)
		setPlayerStorageValue(cid, 20013, getCreatureStorage(cid, 20013) + 1)
		doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
		doDecayItem(item.uid)
	elseif(item.itemid == CORNUCOPIA) then
		for i = 1, 11 do
			doPlayerAddItem(cid, 2681)
		end

		doRemoveItem(item.uid, 1)
		doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
	elseif(item.itemid == WOODEN_WHISTLE) then
		if(random == 2) then
			doSendMagicEffect(fromPosition, CONST_ME_SOUND_RED)
			doRemoveItem(item.uid, 1)
			return true
		end

		local position = getPlayerPosition(cid)
		position.x = position.x + 1

		doSendMagicEffect(fromPosition, CONST_ME_SOUND_PURPLE)
		doSummonCreature("Wolf", pos)
	else
		local effect = CONST_ME_SOUND_BLUE
		if(item.itemid == HORN) then
			effect = CONST_ME_SOUND_PURPLE
		elseif(isInArray(GREEN_NOTES, item.itemid)) then
			effect = CONST_ME_SOUND_GREEN
		end

		doSendMagicEffect(fromPosition, effect)
	end

	return true
end

partyhat.lua:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_HEAD).uid) then
		return false
	end
	if getPlayerStorageValue(cid,20013) == 200 then --storage to get uses of party things
        	doPlayerSendTextMessage(cid,22, "Congratulations, you earned the achievement " .. getAchievementInfo(tonumber(achievement)).name .. ".")
   			doPlayerAddAchievement(cid, achievement)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			setPlayerStorageValue(cid,76213,1)
    end
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
	setPlayerStorageValue(cid, 20013, getCreatureStorage(cid, 20013) + 1)
	return true
end

Cyk, thanks for the tip, now on I'll do this way
 
don't do this, make doPlayerAddAchievement send the message instead

I didn't added the message on the function to make it more configurable.. maybe a message like "Congratulations, you earned the achievement Blabla, you're pro."
 
I didn't added the message on the function to make it more configurable.. maybe a message like "Congratulations, you earned the achievement Blabla, you're pro."
Then you can add a parameter to turn off the automatic message & allow manual override?
 
I don't understand WHY talkactions.
Is MUCH better if add 'achievements' in scripts/quests like me and Dankoo.

Interior Decorator
Lua:
CONSTRUCTIONS = {
	[3901] = 1650, [3902] = 1658, [3903] = 1666, [3904] = 1670, [3905] = 3813, [3906] = 3817, [3907] = 2093, [3908] = 2603, [3909] = 1614, [3910] = 1615,
	[3911] = 1616, [3912] = 1619, [3913] = 3805, [3914] = 3807, [3915] = 1740, [3916] = 1774, [3917] = 2084, [3918] = 2095, [3919] = 3809, [3920] = 3832,
	[3921] = 1714, [3922] = 2107, [3923] = 2104, [3924] = 7670, [3925] = 1740, [3926] = 2080, [3927] = 2098, [3928] = 1676, [3929] = 2101, [3930] = 1739,
	[3931] = 2105, [3932] = 1724, [3933] = 1728, [3934] = 1732, [3935] = 1775, [3936] = 3812, [3937] = 2064, [3938] = 6371, [5086] = 1738, [5087] = 1741, [5088] = 1770,
	[6114] = 6109, [6115] = 6111, [6372] = 3811, [6373] = 1736, [7503] = 1750, [7700] = 5928, [7960] = 3821, [7961] = 1877, [7962] = 2582, [8692] = 8688
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

        if getPlayerStorageValue(cid,21063) == 1000 then
        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Interior Decorator\".")
   	doPlayerAddAchievement(cid, 63)
        end

	if fromPosition.x == CONTAINER_POSITION then
		doPlayerSendCancel(cid, "Put the construction kit on the floor first.")
		doSendMagicEffect(fromPosition, CONST_ME_BLOCKHIT)
	elseif getTileHouseInfo(fromPosition) == FALSE then
		doPlayerSendCancel(cid,"You may only construct this inside a house.")
		doSendMagicEffect(fromPosition, CONST_ME_BLOCKHIT)
	elseif CONSTRUCTIONS[item.itemid] ~= nil then
		doTransformItem(item.uid, CONSTRUCTIONS[item.itemid])
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
                setPlayerStorageValue(cid, 21063, getCreatureStorage(cid, 21063) + 1)
	else
		return FALSE
	end
	return TRUE
end
 
Last edited:
Polisher, rusty remover:
Lua:
local breakChance = 60
local rustyItems = {
[9808] = {2464, 2465, 2483, 2463, 2476}, --common rusty armor
[9809] = {2464, 2465, 2483, 2463, 2476, 8891, 2487}, --semi-rare rusty armor
[9810] = {2464, 2465, 2483, 2463, 2476, 8891, 2487, 2466, 2472}, --rare rusty armor
[9811] = {2468, 2648, 2478, 2647, 2477}, --common rusty legs
[9812] = {2468, 2648, 2478, 2647, 2477, 2488}, --semi-rare rusty legs
[9813] = {2468, 2648, 2478, 2647, 2477, 2488, 2470}, --rare rusty legs
[9814] = {2511, 2510, 2530, 2509, 2513, 2515}, --common rusty shield
[9815] = {2511, 2510, 2530, 2509, 2513, 2515, 2516, 2519}, --semi-rare rusty shield
[9816] = {2511, 2510, 2530, 2509, 2513, 2515, 2516, 2519, 2520, 2514}, --rare rusty shield
[9817] = {2643, 3982, 5462, 7457}, --common rusty boots
[9818] = {2643, 3982, 5462, 7457, 2195}, --semi-rare rusty boots
[9819] = {2643, 3982, 5462, 7457, 2195, 2645}, --rare rusty boots
[9820] = {2458, 2460, 2480, 2481, 2457, 2491}, --common rusty helmet
[9821] = {2458, 2460, 2480, 2481, 2457, 2491, 2497}, --semi rare rusty helmet
[9822] = {2458, 2460, 2480, 2481, 2457, 2491, 2497, 2475, 2498} --rare rusty helmet
}
function onUse(cid, item, fromPosition, itemEx, toPosition)

        if getPlayerStorageValue(cid,21065) == 1000 then
        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Polisher\".")
   	doPlayerAddAchievement(cid, 65)
        end

if rustyItems[itemEx.itemid] ~= nil then
if math.random(100) <= breakChance then
doRemoveItem(itemEx.uid,1)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You broke it.")
else
local newId = rustyItems[itemEx.itemid][math.random(#rustyItems[itemEx.itemid])]
doTransformItem(itemEx.uid,newId)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You removed the rust, revealing a "..getItemNameById(newId))
setPlayerStorageValue(cid, 21065, getCreatureStorage(cid, 21065) + 1)
end
doRemoveItem(item.uid,1)
return TRUE
end
return FALSE
end
 
Lua:
local t = {
	[3901] = 1650, [3902] = 1658, [3903] = 1666, [3904] = 1670, [3905] = 3813, [3906] = 3817, [3907] = 2093, [3908] = 2603, [3909] = 1614, [3910] = 1615,
	[3911] = 1616, [3912] = 1619, [3913] = 3805, [3914] = 3807, [3915] = 1740, [3916] = 1774, [3917] = 2084, [3918] = 2095, [3919] = 3809, [3920] = 3832,
	[3921] = 1714, [3922] = 2107, [3923] = 2104, [3924] = 7670, [3925] = 1740, [3926] = 2080, [3927] = 2098, [3928] = 1676, [3929] = 2101, [3930] = 1739,
	[3931] = 2105, [3932] = 1724, [3933] = 1728, [3934] = 1732, [3935] = 1775, [3936] = 3812, [3937] = 2064, [3938] = 6371, [5086] = 1738, [5087] = 1741, [5088] = 1770,
	[6114] = 6109, [6115] = 6111, [6372] = 3811, [6373] = 1736, [7503] = 1750, [7700] = 5928, [7960] = 3821, [7961] = 1877, [7962] = 2582, [8692] = 8688
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if fromPosition.x == CONTAINER_POSITION then
		doPlayerSendCancel(cid, 'Put the construction kit on the floor first.')
		doSendMagicEffect(fromPosition, CONST_ME_BLOCKHIT)
	elseif not getHouseFromPos(fromPosition) then
		doPlayerSendCancel(cid, 'You may only construct this inside a house.')
		doSendMagicEffect(fromPosition, CONST_ME_BLOCKHIT)
	else
		doTransformItem(item.uid, t[item.itemid])
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
		local n = math.max(0, getCreatureStorage(cid, 21063)) + 1
		if n <= 1000 then
			doCreatureSetStorage(cid, 21063, n)
			if n == 1000 then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Congratulations! You earned the achievement "Interior Decorator".')
				doPlayerAddAchievement(cid, 63)
			end
		end
	end
	return true
end
Lua:
local t = {
	[9808] = {2464, 2465, 2483, 2463, 2476}, --common rusty armor
	[9809] = {2464, 2465, 2483, 2463, 2476, 8891, 2487}, --semi-rare rusty armor
	[9810] = {2464, 2465, 2483, 2463, 2476, 8891, 2487, 2466, 2472}, --rare rusty armor
	[9811] = {2468, 2648, 2478, 2647, 2477}, --common rusty legs
	[9812] = {2468, 2648, 2478, 2647, 2477, 2488}, --semi-rare rusty legs
	[9813] = {2468, 2648, 2478, 2647, 2477, 2488, 2470}, --rare rusty legs
	[9814] = {2511, 2510, 2530, 2509, 2513, 2515}, --common rusty shield
	[9815] = {2511, 2510, 2530, 2509, 2513, 2515, 2516, 2519}, --semi-rare rusty shield
	[9816] = {2511, 2510, 2530, 2509, 2513, 2515, 2516, 2519, 2520, 2514}, --rare rusty shield
	[9817] = {2643, 3982, 5462, 7457}, --common rusty boots
	[9818] = {2643, 3982, 5462, 7457, 2195}, --semi-rare rusty boots
	[9819] = {2643, 3982, 5462, 7457, 2195, 2645}, --rare rusty boots
	[9820] = {2458, 2460, 2480, 2481, 2457, 2491}, --common rusty helmet
	[9821] = {2458, 2460, 2480, 2481, 2457, 2491, 2497}, --semi rare rusty helmet
	[9822] = {2458, 2460, 2480, 2481, 2457, 2491, 2497, 2475, 2498} --rare rusty helmet
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local k = t[itemEx.itemid]
	if k then
		if math.random(10) <= 6 then
			doRemoveItem(itemEx.uid)
			doCreatureSay(cid, "You broke it.", TALKTYPE_ORANGE_1)
		else
			local v = k[math.random(#k)]
			doTransformItem(itemEx.uid, v)
			doCreatureSay(cid, 'You removed the rust, revealing a '.. getItemInfo(v).name .. '.', TALKTYPE_ORANGE_1)
			local n = math.max(0, getCreatureStorage(cid, 21065)) + 1
			if n <= 1000 then
				doCreatureSetStorage(cid, 21065, n)
				if n == 1000 then
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Congratulations! You earned the achievement "Polisher".')
					doPlayerAddAchievement(cid, 65)
				end
			end
		end
		return doChangeTypeItem(item.uid, item.type - 1)
	end
end
 
Last edited:
Cyko, your script of 'interior decorator' don't work. Players can't open that.


Achievement "Masquerader":
Costume Bags
Lua:
local common = {"orc warrior", "pirate cutthroat", "dworc voodoomaster", "dwarf guard", "minotaur mage"}
local uncommon = {"quara hydromancer", "diabolical imp", "banshee", "frost giant", "lich"}
local deluxe = {"serpent spawn", "demon", "juggernaut", "behemoth", "rahemos"}
local duration = 18000 --the time the outfit will last
function onUse(cid, item, fromPosition, itemEx, toPosition)

        if getPlayerStorageValue(cid,21029) == 100 then
        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Masquerader\".")
   	doPlayerAddAchievement(cid, 29)
        end


	if item.itemid == 7737 then
		doSetMonsterOutfit(cid,common[math.random(#common)],duration*1000)
	elseif item.itemid == 7738 then
		doSetMonsterOutfit(cid,uncommon[math.random(#uncommon)],duration*1000)
	elseif item.itemid == 7739 then
		doSetMonsterOutfit(cid,deluxe[math.random(#deluxe)],duration*1000)
	end
	doRemoveItem(item.uid,1)
   	setPlayerStorageValue(cid, 21029, getCreatureStorage(cid, 21029) + 1)
	doSendMagicEffect(fromPosition,CONST_ME_MAGIC_BLUE)
	return TRUE
end
 
I don't understand WHY talkactions.
Is MUCH better if add 'achievements' in scripts/quests like me and Dankoo.

The talkactions are only to explain how the functions work, plus for a staff member.
 
Ah, ok
----------------------------------


Allowance Collector
Lua:
local coin = {2148}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)

        if getPlayerStorageValue(cid,21018) == 50 then
        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Allowance Collector\".")
   	doPlayerAddAchievement(cid, 18)
        end

	local count = 1
	if item.itemid == 2114 then
		local randomChance = math.random(1)
		if randomChance == 1 then
			count = math.random(1,2)
		elseif randomChance == 2 then
			count = 3
		end
		doPlayerAddItem(cid, coin[randomChance], count)
	end
	doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
	doTransformItem(item.uid, 2115)
	setPlayerStorageValue(cid, 21018, getCreatureStorage(cid, 21018) + 1)
	return TRUE
end

Fireworks in the Sky
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

        if getPlayerStorageValue(cid,21024) == 250 then
        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Fireworks in the Sky\".")
   	doPlayerAddAchievement(cid, 24)
        end

	if fromPosition.x ~= CONTAINER_POSITION then
		fireworksEffect = math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)
		doSendMagicEffect(fromPosition, fireworksEffect)
	else
		doSendMagicEffect(fromPosition, CONST_ME_HITBYFIRE)
		doSendMagicEffect(fromPosition, CONST_ME_EXPLOSIONAREA)
		doCreatureSay(cid, "Ouch! Rather place it on the ground next time.", TALKTYPE_ORANGE_1)
		doCreatureAddHealth(cid, -10)
	end
	doRemoveItem(cid, item.uid, 1)
   	setPlayerStorageValue(cid, 21024, getCreatureStorage(cid, 21024) + 1)
	return TRUE
end

Jinx
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

        if getPlayerStorageValue(cid,21026) == 500 then
        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Jinx\".")
        doPlayerAddAchievement(cid, 26)
        end


local rand = math.random(0, 10)
local lotteryid = 5957

  if item.itemid == lotteryid then
    if rand < 1 then
  		doCreatureSay(cid, "You have a winning lottery ticket!", TALKTYPE_ORANGE_1)
      doTransformItem(item.uid, item.itemid + 1)
   	setPlayerStorageValue(cid, 21026, getCreatureStorage(cid, 21026) + 1)
doSendMagicEffect(fromPosition,12)
    elseif rand > 2 then
      doCreatureSay(cid, "Sorry, This is not a winning lottery ticket.", TALKTYPE_ORANGE_1)
      doTransformItem(item.uid, item.itemid - 1)
   	setPlayerStorageValue(cid, 21026, getCreatureStorage(cid, 21026) + 1)
    end
  end
return TRUE
end


Enjoy, I made all.
 
Last edited:
Ruthless:

Thrones.lua

Lua:
local config = {usesStorage = 34050}

function onStepIn(cid, item, pos)
local nie = {x=32824, y=32231, z=12}
    if item.uid == 10001 then
        if getPlayerStorageValue(cid,10001) == -1 then
            setPlayerStorageValue(cid,10001,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Verminor´s throne and absorbed some of his spirit.')
			doSendMagicEffect(getCreaturePosition(cid),20)
			doPlayerSetStorageValue(cid, config.usesStorage, getPlayerStorageValue(cid, config.usesStorage) + 1)
			if getPlayerStorageValue(cid,34050) == 8 then
		        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Ruthless\".")
				doPlayerAddAchievement(cid, 67)
			end
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Veminor´s spirit.')
			local wal2 = {x=32840, y=32327, z=15}
			doTeleportThing(cid, wal2)
			doSendMagicEffect(wal2,17)
        end
    elseif item.uid == 10002 then
        if getPlayerStorageValue(cid,10002) == -1 then
            setPlayerStorageValue(cid,10002,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Infernatil´s throne and absorbed some of his spirit.')
			doSendMagicEffect(getCreaturePosition(cid),15)
			doPlayerSetStorageValue(cid, config.usesStorage, getPlayerStorageValue(cid, config.usesStorage) + 1)
			if getPlayerStorageValue(cid,34050) == 8 then
		        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Ruthless\".")
				doPlayerAddAchievement(cid, 67)
			end
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Infernatil´s spirit.')
			local wal7 = {x=32909, y=32211, z=15}
			doTeleportThing(cid, wal7)
			doSendMagicEffect(wal7,17)
			end
    elseif item.uid == 10003 then
        if getPlayerStorageValue(cid,10003) == -1 then
            setPlayerStorageValue(cid,10003,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Tafariel´s throne and absorbed some of his spirit.')
			doSendMagicEffect(getCreaturePosition(cid),2)
			doPlayerSetStorageValue(cid, config.usesStorage, getPlayerStorageValue(cid, config.usesStorage) + 1)
			if getPlayerStorageValue(cid,34050) == 8 then
		        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Ruthless\".")
				doPlayerAddAchievement(cid, 67)
			end
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Tafariel´s spirit.')
			local wal3 = {x=32761, y=32243, z=15}
			doTeleportThing(cid, wal3)
			doSendMagicEffect(wal3,17)
		end
    elseif item.uid == 10004 then
        if getPlayerStorageValue(cid,10004) == -1 then
            setPlayerStorageValue(cid,10004,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Apocalypse´s throne and absorbed some of his spirit.')
			doSendMagicEffect(getCreaturePosition(cid),4)
			doPlayerSetStorageValue(cid, config.usesStorage, getPlayerStorageValue(cid, config.usesStorage) + 1)
			if getPlayerStorageValue(cid,34050) == 8 then
		        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Ruthless\".")
				doPlayerAddAchievement(cid, 67)
			end
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Apocalypse´s spirit.')
			local wal4 = {x=32875, y=32267, z=15}
			doTeleportThing(cid, wal4)
			doSendMagicEffect(wal4,17)
			end
    elseif item.uid == 10005 then
        if getPlayerStorageValue(cid,10005) == -1 then
            setPlayerStorageValue(cid,10005,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Pumin´s throne and absorbed some of his spirit.')
			doSendMagicEffect(getCreaturePosition(cid),7)
			doPlayerSetStorageValue(cid, config.usesStorage, getPlayerStorageValue(cid, config.usesStorage) + 1)
		if getPlayerStorageValue(cid,34050) == 8 then
		        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Ruthless\".")
				doPlayerAddAchievement(cid, 67)
			end
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Pumin´s spirit.')
			local wal = {x=32785, y=32279, z=15}
			doTeleportThing(cid, wal)
			doSendMagicEffect(wal,17)
		end
    elseif item.uid == 10007 then
        if getPlayerStorageValue(cid,10007) == -1 then
            setPlayerStorageValue(cid,10007,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Ashfalor´s throne and absorbed some of his spirit.')
			doSendMagicEffect(getCreaturePosition(cid),17)
			doPlayerSetStorageValue(cid, config.usesStorage, getPlayerStorageValue(cid, config.usesStorage) + 1)
		if getPlayerStorageValue(cid,34050) == 8 then
		        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Ruthless\".")
				doPlayerAddAchievement(cid, 67)
			end
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Ashfalor´s spirit.')
			local wal1 = {x=32839, y=32310, z=15}
			doTeleportThing(cid, wal1)
			doSendMagicEffect(wal1,17)
		end
		elseif item.uid == 10008 then
        if getPlayerStorageValue(cid,10008) == -1 then
            setPlayerStorageValue(cid,10008,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Bazir´s throne and absorbed some of his spirit.')
			doSendMagicEffect(getCreaturePosition(cid),11)
			doPlayerSetStorageValue(cid, config.usesStorage, getPlayerStorageValue(cid, config.usesStorage) + 1)
		if getPlayerStorageValue(cid,34050) == 8 then
		        doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Ruthless\".")
				doPlayerAddAchievement(cid, 67)
			end
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Bazir´s spirit.')
			local wal5 = {x=32745, y=32385, z=15}
			doTeleportThing(cid, wal5)
			doSendMagicEffect(wal5,17)
		end
    elseif item.uid == 14334 then
        if getPlayerStorageValue(cid,10001) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
			doTeleportThing(cid, nie)
			doSendMagicEffect(getCreaturePosition(cid),51)
        else 
		end
		 elseif item.uid == 14333 then
        if getPlayerStorageValue(cid,10002) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
			doTeleportThing(cid, nie)
			doSendMagicEffect(getCreaturePosition(cid),51)
			else
			end
			 elseif item.uid == 14332 then
        if getPlayerStorageValue(cid,10003) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
			doTeleportThing(cid, nie)
			doSendMagicEffect(getCreaturePosition(cid),51)
			else
			end
			 elseif item.uid == 14339 then
        if getPlayerStorageValue(cid,10004) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
			doTeleportThing(cid, nie)
			doSendMagicEffect(getCreaturePosition(cid),51)
			else
			end
			 elseif item.uid == 14330 then
        if getPlayerStorageValue(cid,10005) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
			doTeleportThing(cid, nie)
			doSendMagicEffect(getCreaturePosition(cid),51)
			else
			end
			 elseif item.uid == 14329 then
        if getPlayerStorageValue(cid,10007) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
			doTeleportThing(cid, nie)
			doSendMagicEffect(getCreaturePosition(cid),51)
			else
			end
			 elseif item.uid == 14328 then
        if getPlayerStorageValue(cid,10008) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
			doTeleportThing(cid, nie)
			doSendMagicEffect(getCreaturePosition(cid),51)
			else
			end	
        end
    end
    return 1

Greenhorn

Lua:
function onKill(cid, target, lastHit)
	if lastHit and isMonster(target) and getCreatureName(target):lower() == 'orcus the cruel' and getPlayerStorageValue(cid,76225) == -1 then
	 doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Greenhorn\".")
		doPlayerAddAchievement(cid, 25)
		doCreatureSetStorage(cid, 76225, 1)
	end
	return true
end

(Register creaturescript at login and craeturescripts.xml)
Lua:
<event type="kill" name="orcus_the_cruel" script="orcus_the_cruel.lua"/>
 
Dankoo, your 'Greenhorn' is not working correctly.
The message must appears when you stepin in last teleport of arena.

This is my script but I don't know how to do that.
Lua:
function onStepIn(cid, item, position, fromPosition)

local leave = {x=32312, y=31134, z=6}

	if getPlayerStorageValue(cid, item.actionid+getPlayerStorageValue(cid, 42355)*10-1) == 1 then
		doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'You did arena at level '.. getPlayerStorageValue(cid, 42355)+1 ..'! Now you can take your reward.')
		setPlayerStorageValue(cid, 42355, getPlayerStorageValue(cid, 42355)+1) --did arena level X
		setPlayerStorageValue(cid, item.actionid+getPlayerStorageValue(cid, 42355)*10, 1) --did arena level X
		setGlobalStorageValue(item.actionid-1, 0) -- room free
		setPlayerStorageValue(cid, 42350, os.time()+5) -- time to kick 0
		setPlayerStorageValue(cid, 42352, 0) -- is not in arena
		doTeleportThing(cid, leave, TRUE)
	else
		doTeleportThing(cid, fromPosition, TRUE)
		doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,'First kill monster!')
	end
	return TRUE
end
 
Back
Top