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

The one thing Quest ;) needed

Kedor

New Member
Joined
Mar 3, 2008
Messages
263
Reaction score
0
Location
Poland, Gdynia
look.. you got 6 chests.. and i want make quest that you can take reward from 1 only.. like on annih :p and when you take form 1 then on other it says "its empty" :p
but dont know how to make it..

tell me what to write in acion.xml
where in script are uid or somethink.. i was reading about that on forum but that was old posts and all i looked didnt worked ;(

just got 6 rewards.. can take 1 :p
plz some ;D


thx in advance :p
 
Here's a quite simple script:

Code:
local chestopened = getPlayerStorageValue(cid, 5555)

function onUse(cid, item, frompos, topos)
    if item.actionid == 1111 and chestopened < 1 then
        doPlayeradditem(cid,[COLOR=Red]ITEMID[/COLOR],1)
        doSetPlayerStorageValue(cid, 5555, 1)
    elseif item.actionid == 1112 and chestopened < 1 then
        doPlayeradditem(cid,[COLOR=Red]ITEMID[/COLOR],1)
        doSetPlayerStorageValue(cid, 5555, 1)    
    elseif item.actionid == 1113 and chestopened < 1 then
        doPlayeradditem(cid,ITEMID,1)
        doSetPlayerStorageValue(cid, 5555, 1)    
    elseif item.actionid == 1114 and chestopened < 1 then
        doPlayeradditem(cid,[COLOR=Red]ITEMID[/COLOR],1)    
        doSetPlayerStorageValue(cid, 5555, 1)    
    elseif item.actionid == 1115 and chestopened < 1 then
        doPlayeradditem(cid,[COLOR=Red]ITEMID[/COLOR],1)    
        doSetPlayerStorageValue(cid, 5555, 1)    
    elseif item.actionid == 1115 and chestopened < 1 then
        doPlayeradditem(cid,[COLOR=Red]ITEMID[/COLOR],1)    
        doSetPlayerStorageValue(cid, 5555, 1)    
    else
        doPlayerSendCancel(cid,'This chest is Empty.')
    end
end
Change the ITEMID to the itemID of the item you want the player to recieve.

The StorageValue is where the script will store the information about the quest, if it's completed or not. You can change the 5555 there to a StorageValue if it doesn't fit you.
 
Even thought it works, you could try this (untested):
- global.lua
PHP:
function questMessage(cid, text)
	doPlayerSendTextMessage(cid, 22, text)
	return 1
end

function doMultiQuest(cid, uid, questVars)
	if (getPlayerStorageValue(cid, questVars.storageValue) == -1) then
		local receiveItem = questVars.questInfo[uid]
		if (receiveItem ~= nil) then
			doPlayerAddItem(cid, receiveItem.itemid, receiveItem.count)
			doSetPlayerStorageValue(cid, questVars.storageValue, 1)
			return receiveItem.itemid
		end
		return "warning"
	end
	return "completed"
end

And the script itself:
PHP:
local questVars = {
	storageValue = 5555,
	questInfo = {
		[1111] = {itemid=ITEMID, count=1},
		[1112] = {itemid=ITEMID, count=1},
		[1113] = {itemid=ITEMID, count=1},
		[1114] = {itemid=ITEMID, count=1},
		[1115] = {itemid=ITEMID, count=1},
		[1116] = {itemid=ITEMID, count=1}
	}
}

function onUse(cid, item, frompos, topos)
	local questItem = doMultiQuest(cid, item.uid, questVars)
	local messages = {
		success = "You found a " .. questItem .. "!",
		completed = "You have already done this quest!",
		warning = "Something went wrong, please contact a Gamemaster: Item not found."
	}
	questMessage(cid, messages[questItem] or messages.success)
end

You only need to change the variables ABOVE function onUse~ :p

Try it please! And tell me if it works, if not, tell me what errors you get!
 
Last edited:
How can I make a chest give several items at the same time? I want to make a "welcome" chest to players who reached level 8 containing these items: 2463, 2647, 2525, 5924, 2160


I have been lurking around but i simply cant figure it out :(
 
Lol, that's simple :)

First, set an uniqueid to the chest, let's say 5669, then write in actions.xml
"<item uniqueid="5669" script="mainquest.lua" />"
then in scripts folder, create "mainquest.lua":
PHP:
local itemList = {
     [2463] = 1,
     [2647] = 1,
     [2525] = 1,
     [5924] = 1,
     [2160] = 1
}

function onUse(cid, item, frompos, topos) 
    if getPlayerStorageValue(cid, 5669) ~= -1 then
        for itemid, count in pairs(itemList) do
            doPlayerAddItem(cid, itemid, count)
        end
        setPlayerStorageValue(cid, 5669, 1)
        doPlayerSendTextMessage(cid, 22, "Congratulations " .. getPlayerName(cid) .. ", you got your starter equipment!")
    else
        doPlayerSendTextMessage(cid, 22, "You have already got your starter equipment!")
    end
    return 1
end

Think it works :p

[2463] = 1, That is [ITEMID] = COUNT, so if you change 1 to 50, you'll get 50 of them :p Use that for crystal coin or so ^^
 
Last edited:
Haha, it was so simple, so I had to make it :rolleyes:

Edit: Made the script easier to edit :p
 
Last edited:
But hey, I only get the "you alredy got your starter equipment" ive tried wit hseveral differnet characters, something must be wronG? :S
 
Back
Top