• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action tfs 1.2 Hp+Mana Potion without target.

Svira

Active Member
Joined
Jan 27, 2008
Messages
269
Solutions
11
Reaction score
37
Some time ago I was looking for a potiona or mana regenerating run of hp and MP. Search results are a waste of time because nothing worked on the TFS 1.2 mentioned in the topic
I wrote my own and deprived myself of my goal.

actions/scripts/others create unstablepot.lua
Code:
-- realmap.pl
local healthPot = 12328

local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 200))
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    

    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end
    local itemId = item:getId()
    player:addCondition(exhaust)
    player:say("uhhh...", TALKTYPE_MONSTER_SAY)
    if itemId == healthPot then
        if not doTargetCombatMana(0, player, 75, 525, CONST_ME_MAGIC_BLUE) then
        
        if not doTargetCombatHealth(0, player, COMBAT_HEALING, 125, 575, CONST_ME_MAGIC_BLUE) then
            return false
        end

        
    return true
end
end
end


in actions.xml
Code:
    <action itemid="12328" script="other/unstablepot.lua" />

Have fun.
 
v2 with random exhaust and timer
Code:
local healthPot = 12328
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local exhaust = Condition(CONDITION_EXHAUST_HEAL)
    -- exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 200))
    local exhaustTime = math.random(1000, 6200);
    exhaust:setParameter(CONDITION_PARAM_TICKS, exhaustTime)

    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end
    local itemId = item:getId()
    player:addCondition(exhaust)
    player:say("Unstable... Time:".. (exhaustTime/1000), TALKTYPE_MONSTER_SAY)
    -- player:say(exhaustTime, TALKTYPE_MONSTER_SAY)
    if itemId == healthPot then
        doTargetCombatMana(0, player, 75, 525, CONST_ME_MAGIC_BLUE)
        doTargetCombatHealth(0, player, COMBAT_HEALING, 125, 575, CONST_ME_MAGIC_BLUE)
        -- if not doTargetCombatMana(0, player, 75, 525, CONST_ME_MAGIC_BLUE) then           
            -- if not doTargetCombatHealth(0, player, COMBAT_HEALING, 125, 575, CONST_ME_MAGIC_BLUE) then
                -- return false
            -- end   
            -- return true
        -- end
    end   
end
better for rpg
 
Back
Top