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

Solved Trying to do quest where you choose 1/x items

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
922
Location
Chile
Hello guys, i have been trying to do a quest that you can choose between 5 chest, you can only choose one, you know, this type of quest, but i cant get it to work!!
this is what i have so far

plz guys help me here, i use otx 2.52

Code:
<action uniqueid="23450" script="Quests/rareprestigeweapons.lua" />
        <action uniqueid="23450" script="Quests/rareprestigeweapons.lua" />
        <action uniqueid="23450" script="Quests/rareprestigeweapons.lua" />
        <action uniqueid="23450" script="Quests/rareprestigeweapons.lua" />
        <action uniqueid="23450" script="Quests/rareprestigeweapons.lua" />




Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == 23450 then
queststatus = getPlayerStorageValue(cid,20970)
if queststatus == -1 then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Rare Prestige Sword.")
doPlayerAddItem(cid,20970,1)
setPlayerStorageValue(cid,6076,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
end
elseif item.uid == 23450 then
queststatus = getPlayerStorageValue(cid,20902)
if queststatus == -1 then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Rare Prestige Axe.")
doPlayerAddItem(cid,20902,1)
setPlayerStorageValue(cid,6076,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
end
elseif item.uid == 23450 then
queststatus = getPlayerStorageValue(cid,20915)
if queststatus == -1 then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Rare Prestige Hammer.")
doPlayerAddItem(cid,20915,1)
setPlayerStorageValue(cid,6076,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
end
elseif item.uid == 23450 then
queststatus = getPlayerStorageValue(cid,21035)
if queststatus == -1 then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Rare Prestige Spear.")
doPlayerAddItem(cid,21035,1)
setPlayerStorageValue(cid,6076,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
end
elseif item.uid == 23450 then
queststatus = getPlayerStorageValue(cid,21160)
if queststatus == -1 then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Rare Prestige Magic Staff.")
doPlayerAddItem(cid,21160,1)
setPlayerStorageValue(cid,6076,1)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
end

end
return 1
end


CONSOLE
Code:
[19/11/2016 20:32:56] [Warning - Actions::registerEvent] Duplicate registered item uid: 23450
[19/11/2016 20:32:56] [Warning - Actions::registerEvent] Duplicate registered item uid: 23450
[19/11/2016 20:32:56] [Warning - Actions::registerEvent] Duplicate registered item uid: 23450
[19/11/2016 20:32:56] [Warning - Actions::registerEvent] Duplicate registered item uid: 23450
 
try setting actionid (any actionid) to the chests. I think this prevents it from being actually opened.
as for the other 5 chests, just use a normal quest script for them, since this script is for limiting to one item per storage.
 
try setting actionid (any actionid) to the chests. I think this prevents it from being actually opened.
as for the other 5 chests, just use a normal quest script for them, since this script is for limiting to one item per storage.
im sorry i dont understand, the other 5 chests i have there were doing ok before this, they have scripts for their one, one by one

Just added action id for the 5 weapons chest and they still open
 
you sure you added the code for actions.xml that i posted and changed the chests to those action ids?
the script i posted has nothing wrong with it
i will try one more time, but im quite sure i did it right, i'll let u know
 
you sure you added the code for actions.xml that i posted and changed the chests to those action ids?
the script i posted has nothing wrong with it
nw4htge.png

is that well? the other chests are from 23451-23454

All chests (the 5 weapon chests) are only being opened, you can see the slots (no item inside ofc) and none of these chests give you anything, this is what i have

Code:
<action fromaid="23450" toaid="23454" event="script" value="Quests/rareprestigeweapons.lua"/>

Code:
local t = {
    [23450] = {string = 'Sword', item = 20970},
    [23451] = {string = 'Axe', item = 20902},
    [23452] = {string = 'Hammer', item = 20915},
    [23453] = {string = 'Spear', item = 21035},
    [23454] = {string = 'Staff', item = 21160}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local tmp = t[item.actionid]
    local queststatus = getPlayerStorageValue(cid, 20970)
    if tmp then
        if queststatus == -1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a Rare Prestige ' .. tmp.string)
            doPlayerAddItem(cid, tmp.item, 1)
            doPlayerSetStorageValue(cid, 20970, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
        end
    end
    return true
end

HGTRAT4.png
 
nw4htge.png

is that well? the other chests are from 23451-23454

All chests (the 5 weapon chests) are only being opened, you can see the slots (no item inside ofc) and none of these chests give you anything, this is what i have

Code:
<action fromaid="23450" toaid="23454" event="script" value="Quests/rareprestigeweapons.lua"/>

Code:
local t = {
    [23450] = {string = 'Sword', item = 20970},
    [23451] = {string = 'Axe', item = 20902},
    [23452] = {string = 'Hammer', item = 20915},
    [23453] = {string = 'Spear', item = 21035},
    [23454] = {string = 'Staff', item = 21160}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local tmp = t[item.actionid]
    local queststatus = getPlayerStorageValue(cid, 20970)
    if tmp then
        if queststatus == -1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a Rare Prestige ' .. tmp.string)
            doPlayerAddItem(cid, tmp.item, 1)
            doPlayerSetStorageValue(cid, 20970, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
        end
    end
    return true
end

HGTRAT4.png
action id
not unique id
 
Back
Top