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

ActionID in quest reward

nips

Da.Nb
Joined
Oct 15, 2009
Messages
152
Reaction score
0
Location
Germany
Code:
 local chests =
{
    [1002] = {prize = 2087}
}

local status = 12346 -- Storage for quest
local questLevel = 30 -- Level to open chest

function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getItemNameById(chests[item.uid].prize)
local questStatus = getPlayerStorageValue(cid, status)
local playerPos = getCreaturePosition(cid)
    if questStatus == 1 then
        doPlayerSendTextMessage(cid,22, "You have already chosen your reward.")
    return TRUE
    end
    if getPlayerLevel(cid) >= questLevel then
        doPlayerAddItem(cid, chests[item.uid].prize, 1)
        setPlayerStorageValue(cid, status, 1)
        doSendMagicEffect(playerPos, CONST_ME_GIFT_WRAPS)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have found a ".. name ..".")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be atleast level ".. questLevel .." to open this chest.")
    end
    return TRUE
end

This iy my questscript now and could anyone rescript it so that the wooden key which I receive has the action ID 2000?

And does anyone know what the "[1002]" in the begin of the script means?

Thank you for the reading
 
Code:
function onUse(cid, item, frompos, item2, topos)
local itemID = XXXX -- Reward itemid
local storage = XXXX -- storagevalue
local chestUid = XXXX -- chest uniqueid, same as in actions.xml
local rewardAid = XXXX -- Actionid on the reward

	local ex = doCreateItemEx(itemID)
	if item.uid == chestUid then
 	queststatus = getPlayerStorageValue(cid,storage)
 	if queststatus == -1 then
 	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found "  ..getItemDescriptionsById(itemID).article .." "..getItemDescriptionsById(itemID).name.. ".")
	doItemSetAttribute(ex, "aid", "rewardAid")
	doPlayerAddItemEx(cid,ex,1)
 	setPlayerStorageValue(cid,storage,1)
 	else
 	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"It is empty.")
	end
	else
	return 0
	end
	
	return 1
	end
 
It doesn't work
It says key does not match when I try to open the door with it
Also the key doesn't have any actionID when I get the quest

EDIT------

It doesn't matter if the questbox is a chest or a dead tree, right?
 
No it doesn't matter if it's a tree or chest ;p

test this
Code:
local cfg = {
    itemID = XXXX, -- Reward itemid
    storage = XXXX, -- storagevalue
    chestUid = XXXX, -- chest uniqueid, same as in actions.xml
    rewardAid = XXXX, -- Actionid on the reward
    }

function onUse(cid, item, frompos, item2, topos)

    if item.uid == cfg.chestUid then
        item = doPlayerAddItem(cid, cfg.itemID)
        if getPlayerStorageValue(cid, cfg.storage) ~= 1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found "  ..getItemDescriptionsById(cfg.itemID).article .." "..getItemDescriptionsById(cfg.itemID).name.. ".")
            doItemSetAttribute(item, "aid", cfg.rewardAid)
            setPlayerStorageValue(cid, cfg.storage, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
        end
    end
return true
end
 
Hmm... I'm not really sure if I made the aid part right, since I only had a number written directly, without any locals. So what you can do is to write aid directly in the field.
Code:
doItemSetAttribute(ex, "aid", "2000")
and remove the local rewardAid line.
 
woops, here
Code:
local cfg = {
    itemID = XXXX, -- Reward itemid
    storage = XXXX, -- storagevalue
    chestUid = XXXX, -- chest uniqueid, same as in actions.xml
    rewardAid = XXXX, -- Actionid on the reward
    }

function onUse(cid, item, frompos, item2, topos)

    if item.uid == cfg.chestUid then
        if getPlayerStorageValue(cid, cfg.storage) ~= 1 then
            item = doPlayerAddItem(cid, cfg.itemID)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found "  ..getItemDescriptionsById(cfg.itemID).article .." "..getItemDescriptionsById(cfg.itemID).name.. ".")
            doItemSetAttribute(item, "aid", cfg.rewardAid)
            setPlayerStorageValue(cid, cfg.storage, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
        end
    end
return true
end
 
It still doesn't work but maybe this helps you

The first key I get from the quest has the action ID

19:28 You see a wooden key (Key:2100).
It weighs 1.00 oz.
ItemID: [2087], ActionID: [2100].

The rest just doesn't
19:29 You see a wooden key (Key:0).
It weighs 1.00 oz.
ItemID: [2087].

Maybe this helps you to fix my problem?:/
 
Code:
now it should just give you 1 time

local cfg = {
    itemID = XXXX, -- Reward itemid
    storage = XXXX, -- storagevalue
    chestUid = XXXX, -- chest uniqueid, same as in actions.xml
    rewardAid = XXXX, -- Actionid on the reward
    }

function onUse(cid, item, frompos, item2, topos)

local item = doPlayerAddItem(cid, cfg.itemID)

    if item.uid == cfg.chestUid then
        if getPlayerStorageValue(cid, cfg.storage) ~= 1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found "  ..getItemDescriptionsById(cfg.itemID).article .." "..getItemDescriptionsById(cfg.itemID).name.. ".")
            doItemSetAttribute(item, "aid", cfg.rewardAid)
            setPlayerStorageValue(cid, cfg.storage, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
        end
    end
return true
end
 
Still doesn't.. it's more buggy than before because it doesn't even give me the "You recieved this reward" or "It is empty." anymore

anyway here it is what I'm doing..
I use this script in actions/quests and got this script

Code:
local cfg = {
    itemID = 2087, -- Reward itemid
    storage = 11100, -- storagevalue
    chestUid = 1017, -- chest uniqueid, same as in actions.xml
    rewardAid = 2100, -- Actionid on the reward
    }

function onUse(cid, item, frompos, item2, topos)

local item = doPlayerAddItem(cid, cfg.itemID)

    if item.uid == cfg.chestUid then
        if getPlayerStorageValue(cid, cfg.storage) ~= 1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found "  ..getItemDescriptionsById(cfg.itemID).article .." "..getItemDescriptionsById(cfg.itemID).name.. ".")
            doItemSetAttribute(item, "aid", cfg.rewardAid)
            setPlayerStorageValue(cid, cfg.storage, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
        end
    end
return true
end

this is my action xml line
Code:
<action uniqueid="1017" script="quests/warlockkey.lua"/>

and the tree in my mapeditor got UID 2017
 
Still doesn't.. it's more buggy than before because it doesn't even give me the "You recieved this reward" or "It is empty." anymore

anyway here it is what I'm doing..
I use this script in actions/quests and got this script

Code:
local cfg = {
    itemID = 2087, -- Reward itemid
    storage = 11100, -- storagevalue
    chestUid = 1017, -- chest uniqueid, same as in actions.xml
    rewardAid = 2100, -- Actionid on the reward
    }

function onUse(cid, item, frompos, item2, topos)

local item = doPlayerAddItem(cid, cfg.itemID)

    if item.uid == cfg.chestUid then
        if getPlayerStorageValue(cid, cfg.storage) ~= 1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found "  ..getItemDescriptionsById(cfg.itemID).article .." "..getItemDescriptionsById(cfg.itemID).name.. ".")
            doItemSetAttribute(item, "aid", cfg.rewardAid)
            setPlayerStorageValue(cid, cfg.storage, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
        end
    end
return true
end

this is my action xml line
Code:
<action uniqueid="1017" script="quests/warlockkey.lua"/>

and the tree in my mapeditor got UID 2017

Hmm then I don't know ;s

Maybe because he's overriding "item" variable and then checking uid? heh?

Lua:
local cfg = {
    itemID = 2087, -- Reward itemid
    storage = 11100, -- storagevalue
    rewardAid = 2100, -- Actionid on the reward
    }

function onUse(cid, item, frompos, item2, topos)

	if getPlayerStorageValue(cid, cfg.storage) < 1 then
		local key = doPlayerAddItem(cid, cfg.itemID)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found "  ..getItemDescriptionsById(cfg.itemID).article .." "..getItemDescriptionsById(cfg.itemID).name.. ".")
		doItemSetAttribute(key, "aid", cfg.rewardAid)
		setPlayerStorageValue(cid, cfg.storage, 1)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
	end
return true
end
 
Yes, thank you!
It's working :)

Ofcourse rep for you!

Slaktaren I wanted to rep you too, for you investigate your time but I can't spread it to you again it says :/
Sorry..
 
Maybe because he's overriding "item" variable and then checking uid? heh?

Lua:
local cfg = {
    itemID = 2087, -- Reward itemid
    storage = 11100, -- storagevalue
    rewardAid = 2100, <-- shouldn't the comma be removed there? O_O
    }

function onUse(cid, item, frompos, item2, topos)

	if getPlayerStorageValue(cid, cfg.storage) < 1 then
		local key = doPlayerAddItem(cid, cfg.itemID)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found "  ..getItemDescriptionsById(cfg.itemID).article .." "..getItemDescriptionsById(cfg.itemID).name.. ".")
		doItemSetAttribute(key, "aid", cfg.rewardAid)
		setPlayerStorageValue(cid, cfg.storage, 1)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
	end
return true
end

rewardAid = 2100, <-- shouldn't the comma be removed there? O_O
 
Back
Top