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

Help with Anni and Poi

Danxo

Taranox Pwns
Joined
Jun 14, 2007
Messages
512
Reaction score
0
Location
Sweden. small town called Ramnäs
I have 2 problem with my quests. Anni and POI

My poi dosent work and anni niether. help me. i have uniqeid im switch and on all chest

Poi.lua
Code:
function onUse(cid, item)
    config = { storage = 1, ch101010 = 2, ch202020 = 3, ch303030 }
    
    if isInArray({config.ch1,config.ch2,config.ch3}, item.actionid) == TRUE and getPlayerStorageValue(cid, config.storage) ~= 1 then
        doPlayerSendTextMessage(cid, 17, "The chest is empty.")
        return FALSE
    end
    if item.actionid == config.ch1 then
        doPlayerAddItem(cid, 6528, 1)
        doPlayerSendTextMessage(cid, 17, "You have found Avenger.")
        setPlayerStorageValue(cid, config.storage, 1)
    elseif item.actionid == config.ch2 then
        doPlayerAddItem(cid, 5803, 1)
        doPlayerSendTextMessage(cid, 17, "You have found Arbaleast.")
        setPlayerStorageValue(cid, config.storage, 1)
    elseif item.actionid == config.ch3 then
        doPlayerAddItem(cid, 2453, 1)
        doPlayerSendTextMessage(cid, 17, "You have found Arcane Staff.")
        setPlayerStorageValue(cid, config.storage, 1)
    end
end

Annihilator.lua
Code:
-- Credits to GrizZm0 for most of the script
-- Credits to Tworn for the cleanArea(), a bit modified by Ispiro
-- Credits to Ispiro for a more easier script to configurate and easier to read.
 
local starting= {x = 189, y = 116, z = 9} -- edit this to the top left sqm of ur annhilator room
local ending= {x = 197, y = 119, z = 9} -- edit this to the bottom right sqm of ur annhilator room
 
local playerPos = { -- oldPositions; positions of players before they get teleported.
	{x = 194, y = 118, z = 9},
	{x = 193, y = 118, z = 9},
	{x = 192, y = 118, z = 9},
	{x = 191, y = 118, z = 9}
}
 
local newPlayerPos = { -- Positions for where players should be teleported, make sure it's in the same order as oldPositions
	{x = 194, y = 118, z = 10},
	{x = 193, y = 118, z = 10},
	{x = 192, y = 118, z = 10},
	{x = 191, y = 118, z = 10}
}
 
local creaturePos = { -- Name and position of monsters to summon.
	{"Demon", {x = 191, y = 116, z = 10}},
	{"Demon", {x = 193, y = 116, z = 10}},
	{"Demon", {x = 192, y = 120, z = 10}},
	{"Demon", {x = 194, y = 120, z = 10}},
	{"Demon", {x = 195, y = 118, z = 10}},
	{"Demon", {x = 195, y = 118, z = 10}}
}
 
if(#playerPos ~= #newPlayerPos) then
	error("Annhilator has not been properly configured.")
end
--- Preferably, do not edit anything below this line unless you know exactly what you are doing.
local player = {}
 
function onUse(cid, item, frompos, item2, topos)
	if(item.uid == 50000) then --- change to different item.uid according to ur mapeditor
		if(item.itemid == 1945) then
			for i, pos in ipairs(playerPos) do -- add player id's to table
				player[i] = getTopCreature(pos)
			end
			local ret, players = checkPlayers(cid)
			if(ret) then
				local ret, player = checkLevel(100)
				if(ret) then
					local ret, player = checkStorage(100)
					if(ret) then
						summonCreatures(creaturePos)
						teleportPlayers(2, 10) -- 2 stands for the effect on old pos, 10 for the effect on new pos.
						doTransformItem(item.uid, 1946)
					else
						sendPlayersText(players, getPlayerName(player) .. " has already done this quest.")
					end
				else
					sendPlayersText(players, getPlayerName(player) .. " is too low.")
				end	
			else
				sendPlayersText(players, "You need " .. #playerPos .. " players to do this quest.")
			end	
		elseif(item.itemid == 1946) then -- preferably, to be the id of the lever added by mapeditor.
			if(cleanArea()) then
				doTransformItem(item.uid, 1945)
			else
				return FALSE
			end	
		end
		return TRUE
	--- Chests.
	elseif(item.uid == 50001) then -- demon armor
		return questChestPrize(cid, 2494, 100)
	elseif(item.uid == 50002) then -- magic sword
		return questChestPrize(cid, 2400, 100)
	elseif(item.uid == 50003) then -- stonecutter's axe
		return questChestPrize(cid, 2431, 100)
	elseif(item.uid == 50004) then -- present box
		return questChestPrize(cid, 1990, 100)				
	end
end
 
function sendPlayersText(players, text)
	for _, player in ipairs(players) do 
		doPlayerSendCancel(player, text)
	end
end
 
function questChestPrize(cid, itemid, storage)
	if(getPlayerStorageValue(cid, storage) < TRUE) then
		doPlayerAddItem(cid, itemid, 1)
		setPlayerStorageValue(cid, storage, TRUE)
		local item = getItemDescriptions(itemid)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. item.article .. " " .. item.name .. "")
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
	end
	return TRUE
end
 
function checkLevel(minLevel)
	for _, player in ipairs(player) do
		if(getPlayerLevel(player) < minLevel) then
			return false, player
		end
	end	
	return true
end
 
function checkStorage(storageValue)
	for _, player in ipairs(player) do
		if(getPlayerStorageValue(player, storageValue) ~= TRUE) then
			return false, player
		end
	end	
	return true
end
 
function cleanArea()
	local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253}
	local monster = {}
	while(checking.y <= ending.y) do
		local creature = getTopCreature(checking)
		if(isCreature(creature) == TRUE) then
			if(isPlayer(creature) == TRUE) then
				return false
			else
				table.insert(monster, creature)
			end
		end
		if(checking.x == ending.x) then
			checking.x = starting.x
			checking.y = checking.y + 1
		end
		checking.x = checking.x + 1
	end
	for i, c in ipairs(monster) do 
		doRemoveCreature(c)
	end	
	return true
end
 
function summonCreatures(parameters)
	for _, monster in ipairs(parameters) do
		doSummonCreature(monster[1], monster[2])
	end
end
 
function teleportPlayers(effect1, effect2)
	for currentPlayer = 1, table.getn(player) do
		doTeleportThing(player[currentPlayer], newPlayerPos[currentPlayer])
		doSendMagicEffect(playerPos[currentPlayer], effect1) -- send animation after teleport, players teleported won't see it anyways
		doSendMagicEffect(newPlayerPos[currentPlayer], effect2)
	end
end
 
function checkPlayers(cid)
	local ret = {}
	table.insert(ret, cid)
	for _, curPlayer in ipairs(player) do
		if(isPlayer(curPlayer) == TRUE) then
			if(curPlayer ~= cid) then 
				table.insert(ret, curPlayer)
			end
		else	
			return false, ret
		end
	end	
	return true, ret
end

And in actions.xml
Code:
  <action actionid="101010" script="poi.lua" />
    	<action actionid="202020" script="poi.lua" />
    	<action actionid="303030" script="poi.lua" />
	<action actionid="50000" script="quests/annihilator.lua"/>
	<action actionid="50001" script="quests/annihilator.lua"/>
	<action actionid="50002" script="quests/annihilator.lua"/>
	<action actionid="50003" script="quests/annihilator.lua"/>
	<action actionid="50004" script="quests/annihilator.lua"/>
 
Code:
function onUse(cid, item)
    config = { storage = 1, ch1 = 101010, ch2 = 202020, ch3 = 303030 }
    
    if isInArray({config.ch1,config.ch2,config.ch3}, item.actionid) == TRUE and getPlayerStorageValue(cid, config.storage) ~= 1 then
        doPlayerSendTextMessage(cid, 17, "The chest is empty.")
        return FALSE
    end
    if item.actionid == config.ch1 then
        doPlayerAddItem(cid, 6528, 1)
        doPlayerSendTextMessage(cid, 17, "You have found Avenger.")
        setPlayerStorageValue(cid, config.storage, 1)
    elseif item.actionid == config.ch2 then
        doPlayerAddItem(cid, 5803, 1)
        doPlayerSendTextMessage(cid, 17, "You have found Arbaleast.")
        setPlayerStorageValue(cid, config.storage, 1)
    elseif item.actionid == config.ch3 then
        doPlayerAddItem(cid, 2453, 1)
        doPlayerSendTextMessage(cid, 17, "You have found Arcane Staff.")
        setPlayerStorageValue(cid, config.storage, 1)
    end
end

try that

NOTE!! it's ActionID not UniqueID
 
Back
Top Bottom