• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Vial of Holy water in the cauldron

Shackal

Alien Project
Joined
Feb 7, 2009
Messages
211
Reaction score
17
Location
Brazil
Hello guys!

I wonder what I am wrong in this script, TFS 0.4_3884 use.

Thank you in advance !!

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == 18898 then
        if getPlayerStorageValue(cid, 1889) == 19 then
            if fromPosition.x == CONTAINER_POSITION then
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_EXPLOSIONHIT)
                doPlayerRemoveItem(cid, 7488, 1)
                setPlayerStorageValue(cid, 1889, 20)
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need hold the item on you.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You arent a inquisition member")
        end
    end
    return TRUE
end
 
position of the click, does not need it?
I tried to put the code but still has something wrong ..
Like this:


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == 18898 then
        if getPlayerStorageValue(cid, 1996) == 1 then
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_EXPLOSIONHIT)
                doPlayerRemoveItem(cid, 7488, 1)
                setPlayerStorageValue(cid, 1996, 2)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You arent a inquisition member")
        end
    end
    return TRUE
end

and actions.xml

Code:
    <action itemid="7488" event="script" value="quests/inq_holywater.lua" />
 
Try this
Code:
local c = {
    actionId = 18898,
    storage = 1889,
    storageValueToCheckFor = 19,
    ["itemToRemove"] = {id = 7488, amount = 1}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == c.actionId then
        if getPlayerStorageValue(cid, c.storage) == c.storageValueToCheckFor then
            if getPlayerItemCount(cid, c["itemToRemove"].id) == c["itemToRemove"].amount then
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_EXPLOSIONHIT)
                doPlayerRemoveItem(cid, c["itemToRemove"].id, c["itemToRemove"].amount)
                setPlayerStorageValue(cid, c.storage, c.storageValueToCheckFor + 1)
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need hold the item on you.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You arent a inquisition member")
        end
    end
    return true
end
 
Try this
Code:
local c = {
    actionId = 18898,
    storage = 1889,
    storageValueToCheckFor = 19,
    ["itemToRemove"] = {id = 7488, amount = 1}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == c.actionId then
        if getPlayerStorageValue(cid, c.storage) == c.storageValueToCheckFor then
            if getPlayerItemCount(cid, c["itemToRemove"].id) == c["itemToRemove"].amount then
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_EXPLOSIONHIT)
                doPlayerRemoveItem(cid, c["itemToRemove"].id, c["itemToRemove"].amount)
                setPlayerStorageValue(cid, c.storage, c.storageValueToCheckFor + 1)
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need hold the item on you.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You arent a inquisition member")
        end
    end
    return true
end

Also did not work !!
I'm finding strange, the logic is correct

what are you trying to do?
and what is not working for you?



Hello Whitevo !!
I am temptation to make a part of the quest inquisition:

• Use the vial of holy water that he gives you on the big cauldron (some kind of an explosion will appear on the cauldron) and open the chest to your left, then bring the witches' grimoire to Henricus.

latest


1 - Click with right in the vial id = 7488;
2 - Click with the left button in the cauldron that has actionId = 18898;
3 - The code check if it is in storage (cid, 1996 1).
4 - If so, step 5, but step 6
5 - The potion will be removed and a magical effect appears
6 - appear message "You are not a member Inquisition"
 
btw i have no idea what is inquisition quest.
let me ask you again.. what is detail matter.. what is not working.
Do you get errors on console? if yes then: What error you get when you use item?
Can you use your item on cauldron?
Does the item send magic effect?
What storage value you have before you use cauldron
What storage value you have after you use cauldron
Do you get correct reward from chest?
(or if something else seems wrong with chest, show script)

Im only can script few things for TFS 1.0, but perhaps i can somehow help me when you say whats wrong (because i know how can it be done in tfs 1.x)
 
(cid, item, fromPosition, itemEx, toPosition)
Item refers to an item you use, itemEx refers to an item you use the item on, like the rope is an item and rope spot is itemEx.

Using the rope & rope spot analogy the fromPosition can be your position where you use the rope and the toPosition is the position you use the rope on.

Hope that was a little helpful :)
 
Thank Jotran and whitevo I got with the following script:

Code:
local c = {
    actionId = 18898,
    storage = 1889,
    storageValueToCheckFor = 19
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   -- if item.actionid == c.actionId then
   if(isInArray(3695, itemEx.itemid)) then
        if getPlayerStorageValue(cid, c.storage) == c.storageValueToCheckFor then
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_EXPLOSIONHIT)
                setPlayerStorageValue(cid, c.storage, c.storageValueToCheckFor + 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You arent a inquisition member")
        end
    end
    return true
end

but now, in any cauldron I use the holy water
 
Last edited:
Hello guys!

I wonder what I am wrong in this script, TFS 0.4_3884 use.

Thank you in advance !!

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == 18898 then
        if getPlayerStorageValue(cid, 1889) == 19 then
            if fromPosition.x == CONTAINER_POSITION then
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_EXPLOSIONHIT)
                doPlayerRemoveItem(cid, 7488, 1)
                setPlayerStorageValue(cid, 1889, 20)
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need hold the item on you.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You arent a inquisition member")
        end
    end
    return TRUE
end
You should explain what is wrong here, what is it supposed to do? What is it doing or not doing? What should be different?
Atm the item you click use on needs to have actionid 18898, if any of the other things aren't true, you will get a cancel message.

This btw checks if the item is in a container (like a backpack), CONTAINER_POSITION is defined in data/lib/000-constant.lua.
Code:
if fromPosition.x == CONTAINER_POSITION then
So if it's supposed to only work in containers, you can just keep that.
 
You should explain what is wrong here, what is it supposed to do? What is it doing or not doing? What should be different?
Atm the item you click use on needs to have actionid 18898, if any of the other things aren't true, you will get a cancel message.

This btw checks if the item is in a container (like a backpack), CONTAINER_POSITION is defined in data/lib/000-constant.lua.
Code:
if fromPosition.x == CONTAINER_POSITION then
So if it's supposed to only work in containers, you can just keep that.

Thank you very much!!

instead of:
itemEx.itemid
use:
itemEx.actionid
or
itemEx.uid

Thank you very much!!

I managed to solve my doubt using the following script:

Code:
local c = {
    actionId = 18898,
    storage = 1889,
    item = {3695, 3696, 3694, 3693},
    storageValueToCheckFor = 31
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if(isInArray(c.actionId, itemEx.actionid)) then
        if getPlayerStorageValue(cid, c.storage) == c.storageValueToCheckFor then
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_EXPLOSIONHIT)
                setPlayerStorageValue(cid, c.storage, c.storageValueToCheckFor + 1)
                doPlayerRemoveItem(cid, 7488, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You arent a inquisition member")
        end
    end
    return true
end

I hope someday to return the help!!!

can close the topic!!
 
(cid, item, fromPosition, itemEx, toPosition)
Item refers to an item you use, itemEx refers to an item you use the item on, like the rope is an item and rope spot is itemEx.

Using the rope & rope spot analogy the fromPosition can be your position where you use the rope and the toPosition is the position you use the rope on.

Hope that was a little helpful :)
Thá Very much Jotran!!
 
Back
Top