Customized new potions for alchemy system.

oshrigames

Intermediate OT User
Joined
Nov 9, 2012
Messages
204
Best answers
0
Reaction score
37
Location
israel
hello :)
i'm using TFS 1.2 (protocol 10.98).

i tried to create new potions for my server along with alchemy system (which is finished).
but i failed to understand if it even can be done without edit the source.

just like the simple 3 potion in real tibia, Berserk Potion, Bullseye Potion and Mastermind Potion.
i thought there are quite a lot new potions that can be added to the game.
like health over time with skill buff while have speed debuff. (+15 hp per sec, +10 axe/club/sword -40 speed for 1 min)
like spesific skill buff with (+distance +ml -max health -hp regen for 1 min)

example for test speed potion.
(from what i understand speed in code is divided by two so this potion should have give 50 speed for 1 min)

ive put this in action/custom folder
Lua:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 60000) -- 1 minute
condition:setParameter(CONDITION_PARAM_SPEED, 100)

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(doAddCondition(cid, condition)) then
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
        doRemoveItem(item.uid)
    end

    return true
end
ive put this in action.xml
Lua:
 <action itemid="21426" script="custom/test_potion.lua"/>
sadly it didn't work, the potion do send the CONST_ME_POFF. i get no error and the potion (21426) disappeared after being used.
but i can't figure out where i went worng 😅

so i'd like to request either clearance so i know where i went worng or one example so i can adopte it
so i can do more potions on my own and share with the community once i finished :)

any help will be greatly appreciated.
for those who helped if you need map ,hunting ground feel free to ask me anything map related you might need. (im decent mapper)
 
Last edited:

M0ustafa

Î Àm ŁĕğẹňĎ
Support Team
Joined
Mar 4, 2017
Messages
1,034
Best answers
113
Reaction score
363
Location
Egypt
Try this one
Lua:
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_TICKS, 60000) -- 1 minute
condition:setParameter(CONDITION_PARAM_SPEED, 100)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
        player:addCondition(condition)
        if player:addCondition(condition) then
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        Item(item.uid):remove(1)
    end
    return true
end
 
OP
oshrigames

oshrigames

Intermediate OT User
Joined
Nov 9, 2012
Messages
204
Best answers
0
Reaction score
37
Location
israel
Try this one
Lua:
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_TICKS, 60000) -- 1 minute
condition:setParameter(CONDITION_PARAM_SPEED, 100)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
        player:addCondition(condition)
        if player:addCondition(condition) then
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        Item(item.uid):remove(1)
    end
    return true
end
same bug i get no haste buff and the potion disappeared after used and CONST_ME_POFF worked but no error to indicate whats worng 😅
 

ZowN

New Member
Joined
Mar 19, 2015
Messages
15
Best answers
1
Reaction score
5
replace CONDITION_ATTRIBUTES with CONDITION_HASTE and it'll work
 
OP
oshrigames

oshrigames

Intermediate OT User
Joined
Nov 9, 2012
Messages
204
Best answers
0
Reaction score
37
Location
israel
thanks for both of you guys. its work♥

one last question tho, anywhere i can find list of all the "CONDITION_" or "CONDITION_ATTRIBUTES"

i mean there are lots more such as
CONDITION_PARAM_SKILL_DISTANCE
CONDITION_PARAM_SKILL_SHIELD
CONDITION_PARAM_SKILL_SWORD
CONDITION_PARAM_TICKS
and apparently CONDITION_HASTE 😅
 
Last edited:

ZowN

New Member
Joined
Mar 19, 2015
Messages
15
Best answers
1
Reaction score
5
They are defined in enums.h

Here is the list

CONDITION_NONE,

CONDITION_POISON = 1 << 0,
CONDITION_FIRE = 1 << 1,
CONDITION_ENERGY = 1 << 2,
CONDITION_BLEEDING = 1 << 3,
CONDITION_HASTE = 1 << 4,
CONDITION_PARALYZE = 1 << 5,
CONDITION_OUTFIT = 1 << 6,
CONDITION_INVISIBLE = 1 << 7,
CONDITION_LIGHT = 1 << 8,
CONDITION_MANASHIELD = 1 << 9,
CONDITION_INFIGHT = 1 << 10,
CONDITION_DRUNK = 1 << 11,
CONDITION_EXHAUST_WEAPON = 1 << 12, // unused
CONDITION_REGENERATION = 1 << 13,
CONDITION_SOUL = 1 << 14,
CONDITION_DROWN = 1 << 15,
CONDITION_MUTED = 1 << 16,
CONDITION_CHANNELMUTEDTICKS = 1 << 17,
CONDITION_YELLTICKS = 1 << 18,
CONDITION_ATTRIBUTES = 1 << 19,
CONDITION_FREEZING = 1 << 20,
CONDITION_DAZZLED = 1 << 21,
CONDITION_CURSED = 1 << 22,
CONDITION_EXHAUST_COMBAT = 1 << 23, // unused
CONDITION_EXHAUST_HEAL = 1 << 24, // unused
CONDITION_PACIFIED = 1 << 25,
CONDITION_SPELLCOOLDOWN = 1 << 26,
CONDITION_SPELLGROUPCOOLDOWN = 1 << 27,
CONDITION_DAMAGE_IMMUNE = 1 << 28,
CONDITION_IMMUNE = 1 << 29,


CONDITION_PARAM_OWNER = 1,
CONDITION_PARAM_TICKS = 2,
//CONDITION_PARAM_OUTFIT = 3,
CONDITION_PARAM_HEALTHGAIN = 4,
CONDITION_PARAM_HEALTHTICKS = 5,
CONDITION_PARAM_MANAGAIN = 6,
CONDITION_PARAM_MANATICKS = 7,
CONDITION_PARAM_DELAYED = 8,
CONDITION_PARAM_SPEED = 9,
CONDITION_PARAM_LIGHT_LEVEL = 10,
CONDITION_PARAM_LIGHT_COLOR = 11,
CONDITION_PARAM_SOULGAIN = 12,
CONDITION_PARAM_SOULTICKS = 13,
CONDITION_PARAM_MINVALUE = 14,
CONDITION_PARAM_MAXVALUE = 15,
CONDITION_PARAM_STARTVALUE = 16,
CONDITION_PARAM_TICKINTERVAL = 17,
CONDITION_PARAM_FORCEUPDATE = 18,
CONDITION_PARAM_SKILL_MELEE = 19,
CONDITION_PARAM_SKILL_FIST = 20,
CONDITION_PARAM_SKILL_CLUB = 21,
CONDITION_PARAM_SKILL_SWORD = 22,
CONDITION_PARAM_SKILL_AXE = 23,
CONDITION_PARAM_SKILL_DISTANCE = 24,
CONDITION_PARAM_SKILL_SHIELD = 25,
CONDITION_PARAM_SKILL_FISHING = 26,
CONDITION_PARAM_STAT_MAXHITPOINTS = 27,
CONDITION_PARAM_STAT_MAXMANAPOINTS = 28,
// CONDITION_PARAM_STAT_SOULPOINTS = 29,
CONDITION_PARAM_STAT_MAGICPOINTS = 30,
CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT = 31,
CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT = 32,
// CONDITION_PARAM_STAT_SOULPOINTSPERCENT = 33,
CONDITION_PARAM_STAT_MAGICPOINTSPERCENT = 34,
CONDITION_PARAM_PERIODICDAMAGE = 35,
CONDITION_PARAM_SKILL_MELEEPERCENT = 36,
CONDITION_PARAM_SKILL_FISTPERCENT = 37,
CONDITION_PARAM_SKILL_CLUBPERCENT = 38,
CONDITION_PARAM_SKILL_SWORDPERCENT = 39,
CONDITION_PARAM_SKILL_AXEPERCENT = 40,
CONDITION_PARAM_SKILL_DISTANCEPERCENT = 41,
CONDITION_PARAM_SKILL_SHIELDPERCENT = 42,
CONDITION_PARAM_SKILL_FISHINGPERCENT = 43,
CONDITION_PARAM_BUFF_SPELL = 44,
CONDITION_PARAM_SUBID = 45,
CONDITION_PARAM_FIELD = 46,
CONDITION_PARAM_IMMUNE_PARALYZE = 47,
 
Top