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

Is this possible? When stamina = 0 kill character.

zrweber

New Member
Joined
Mar 5, 2009
Messages
6
Reaction score
0
I need to make a script that makes the stamina constantly drop. Like 1 point every minute. When the stamina gets to 0 it should kill the player.

Is this possible? :)
 
v8.2

I also wanted a potion that restores soul points, if that's possible! If someone could point me in the right direction, I'd be really thankful! :)

This is the distro I'm using: cryingdamson 0.3.6 (8.60) V8.2
 
This might work, I dont know though. This will add 10 soul points
Code:
local config = {
soul = 10 --amount of soul to increase
potid = 9999 --the item id of the potion
removepot = true
}

function onUse()
   doPlayerAddSoul(cid, config.soul)
      if removepots = true then
         doRemoveItem(config.potid, 1)
      end
   return true
end
@Limos Hows my scripting?
 
It is script for potions. You have to replace your old script (data/actions/scripts/liquids/potions.lua) with this code
Code:
local config = {
    removeOnUse = "no",
    usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
    splashable = "no",
    realAnimation = "no", -- make text effect visible only for players in range 1x1
    healthMultiplier = 1.0,
    manaMultiplier = 1.0,
    soulMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
    [8704] = {empty = 7636, splash = 2, soul = {255, 255}, health = {50, 100}}, -- small health potion
    [7618] = {empty = 7636, splash = 2, soul = {255, 255}, health = {100, 200}}, -- health potion
    [7588] = {empty = 7634, splash = 2, soul = {255, 255}, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion
    [7591] = {empty = 7635, splash = 2, soul = {255, 255}, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
    [8473] = {empty = 7635, splash = 2, soul = {255, 255}, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion

    [7620] = {empty = 7636, splash = 7, soul = {255, 255}, mana = {70, 130}}, -- mana potion
    [7589] = {empty = 7634, splash = 7, soul = {255, 255}, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
    [7590] = {empty = 7635, splash = 7, soul = {255, 255}, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

    [8472] = {empty = 7635, splash = 3, soul = {255, 255}, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = POTIONS[item.itemid]
    if(not potion) then
        return false
    end

    if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
        if(not config.splashable) then
            return false
        end

        if(toPosition.x == CONTAINER_POSITION) then
            toPosition = getThingPos(item.uid)
        end

        doDecayItem(doCreateItem(2016, potion.splash, toPosition))
        doTransformItem(item.uid, potion.empty)
        return true
    end

    if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return true
    end

    if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
        not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
    then
        doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return true
    end

    local soul = potion.soul
    if soul and not doPlayerAddSoul(cid, math.ceil(math.random(soul[1], soul[2]) * config.soulMultiplier)) then
        return false
    end

    local health = potion.health
    if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
        return false
    end

    local mana = potion.mana
    if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
        return false
    end

    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    if(not realAnimation) then
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
    else
        for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
            if(isPlayer(tid)) then
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
            end
        end
    end

    doAddCondition(cid, exhaust)
    if(not potion.empty or config.removeOnUse) then
        doRemoveItem(item.uid)
        return true
    end

    doTransformItem(item.uid, potion.empty)
    return true
end
 
This might work, I dont know though. This will add 10 soul points
Code:
local config = {
soul = 10 --amount of soul to increase
potid = 9999 --the item id of the potion
removepot = true
}

function onUse()
   doPlayerAddSoul(cid, config.soul)
      if removepots = true then
         doRemoveItem(config.potid, 1)
      end
   return true
end
@Limos Hows my scripting?
Table is missing commas, onUse needs parameters (e.g function onUse(cid, item, fromPosition, itemEx, toPosition)), missing one equal sign (requires two, e.g removepots == true) and use item.uid when using doRemoveItem.

I would recommend that you check this guide and keep on practicing till you get the hang of it. :)
 
Table is missing commas, onUse needs parameters (e.g function onUse(cid, item, fromPosition, itemEx, toPosition)), missing one equal sign (requires two, e.g removepots == true) and use item.uid when using doRemoveItem.

I would recommend that you check this guide and keep on practicing till you get the hang of it. :)

How exactly do I use the 'doRemoveItem(config.potid, 1)' so that it removes the id specified in the config?
 
How exactly do I use the 'doRemoveItem(config.potid, 1)' so that it removes the id specified in the config?

item.id = the item you asign in the xml file, or within the if brackets.
And always use if(statment) don't use if statment and you don't need to use == true/false/1/0
Code:
if(isCreature(cid)) then
if(not isCreature(cid)) then
 
How exactly do I use the 'doRemoveItem(config.potid, 1)' so that it removes the id specified in the config?
The function doRemoveItem works with uid, to remove the item people click use on, use:
Code:
doRemoveItem(item.uid, 1)
Count is optional, but like this if the item is stackable it will just remove 1 of them instead of the whole stack.
To remove an item from a player, use:
Code:
doPlayerRemoveItem(cid, itemid, count)
Use this if the item you want to remove is not the item people click use on but just an item they have.
Here you first have to check if they have this item.
For example:
Code:
if doPlayerRemoveItem(cid, itemid, count) then
This will remove the items if they have it, and you can make a part with else that will happen if someone doesn't have the items.
 
Back
Top