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

Action [TFS 1.1] - Slot system

Status
Not open for further replies.
Gotta love ya, you're Always there to solve it...

/Eldin
 
Last edited:
@zbizu
@Ninja

Another Error:

Code:
Eldin has logged in.

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/slot.lua:onLogin
LuaScriptInterface::luaDoAddCondition(). Condition not found
stack traceback:
  [C]: in function 'doAddCondition'
  data/creaturescripts/scripts/slot.lua:130: in function 'equip'
  data/creaturescripts/scripts/slot.lua:163: in function <data/creat
urescripts/scripts/SocketSlot.lua:162>

----------

That lines are:

130
doAddCondition(cid,conditionMP[tonumber(n)])

And

162 - 163
function onLogin(cid)
equip(cid,nil,slot)

-----------

Kind Regards,
Eldin.
 
I used the same scripts from your databack EvoRPG and they are working, the ones in this thread did not. Wierd.

Kind Regards,
Eldin.
 
This causes everything on the server that adds health on use, to not work anymore here is my potion script:


Code:
local ultimateHealthPot = 8473
local greatHealthPot = 7591
local greatManaPot = 7590
local greatSpiritPot = 8472
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local smallHealthPot = 8704
local antidotePot = 8474
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636

local antidote = createCombatObject()
setCombatParam(antidote, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(antidote, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(antidote, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(antidote, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(antidote, COMBAT_PARAM_DISPEL, CONDITION_POISON)

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
        return true
    end

    if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return TRUE
    end

    if(item.itemid == antidotePot) then
        if(doCombat(cid, antidote, numberToVariant(cid)) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
    elseif(item.itemid == smallHealthPot) then
        if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 75, 125, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
    elseif(item.itemid == healthPot) then
        if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 130, 180, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
        doPlayerAddItem(cid, emptyPot, 1)
    elseif(item.itemid == manaPot) then
        if(doTargetCombatMana(0, itemEx.uid, 70, 130, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
    elseif(item.itemid == strongHealthPot) then
        if(not(isKnight(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by paladins and knights of level 50 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end

        if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 270, 320, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
    elseif(item.itemid == strongManaPot) then
        if(not(isSorcerer(cid) or isDruid(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by sorcerers, druids and paladins of level 50 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end

        if(doTargetCombatMana(0, itemEx.uid, 115, 185, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
    elseif(item.itemid == greatSpiritPot) then
        if(not(isPaladin(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by paladins of level 80 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end

        if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 250, 320, CONST_ME_MAGIC_BLUE) == LUA_ERROR or doTargetCombatMana(0, cid, 125, 162, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
    elseif(item.itemid == greatHealthPot) then
        if(not(isKnight(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by knights of level 80 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end

        if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 530, 620, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
    elseif(item.itemid == greatManaPot) then
        if(not(isSorcerer(cid) or isDruid(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by sorcerers and druids of level 80 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end

        if(doTargetCombatMana(0, itemEx.uid, 180, 280, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
    elseif(item.itemid == ultimateHealthPot) then
        if(not(isKnight(cid)) or (getPlayerLevel(cid) < 130)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by knights of level 130 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end

        if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 650, 850, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
    end
    return TRUE
end
 
This causes everything on the server that adds health on use, to not work anymore here is my potion script:
You misspelled something when you pasted lib.
 
Yeah its working. When you add /remove an item with hp % you get full right away.

I also don't get magic lvl bonus to work, everything else is great. :)

Kind Regards,
Eldin.
 
You misspelled something when you pasted lib.


Could you tell me why this script doesn't encounter kills now that this is imported? When i take out the slot login in works but when I don't, it doesn't :

Code:
local config = {
    ['Wild Troll'] = {amount = 50, storage = 19480, startstorage = 20016, startvalue = 0},
    ['Wild Troll Champion'] = {amount = 35, storage = 19481, startstorage = 20016, startvalue = 0}
}
function onKill(cid, target, lastHit)
    local monster = config[getCreatureName(target)]
    if isPlayer(target) or not monster then
        return true
    end

    if getPlayerStorageValue(cid, monster.storage) >= -1 and (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount and getPlayerStorageValue(cid, monster.startstorage) >= monster.startvalue then
        setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Luannas message: '..(getPlayerStorageValue(cid, monster.storage)+1)..' of '..monster.amount..' '..getCreatureName(target)..'s killed.')
    end
    if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and completed the required amount, return to Luanna Rocky.')
        setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
    end
   
   
    return true
end
 
Yeah its working. When you add /remove an item with hp % you get full right away.

I also don't get magic lvl bonus to work, everything else is great. :)

Kind Regards,
Eldin.


For where it says
setConditionParam(conditionML, CONDITION_PARAM_STAT_MAGICLEVELPERCENT, 100+i)

change to :

setConditionParam(conditionML, CONDITION_PARAM_STAT_MAGICPOINTSPERCENT, 100+i)
 
I'm getting tired of this shit. Please close this thread.
I'm not going to provide any help with that anymore.
It's just a few simple steps to install that in your ot and you can't get it to work.
 
This is amazing, Thanks!
 
I get a debug when I eat some meat.. the meat works when I disable the script
 
Last edited:
Remove this from the library
Code:
TALKTYPE_MONSTER = 34
TALKTYPE_MONSTER_SAY = 34
TALKTYPE_MONSTER_YELL = 35
 
I love this system and the players on my server are really enjoying it!

I have one "Noob" question.

Is there a way I can make it round UP?

For example: .68 should round to 1
 
I love this system and the players on my server are really enjoying it!

I have one "Noob" question.

Is there a way I can make it round UP?

For example: .68 should round to 1

math.ceil(number) rounds to higher value
math.floor(number) rounds to lower

which number you'd like to round? Paste line of code here.
 
math.ceil(number) rounds to higher value
math.floor(number) rounds to lower

which number you'd like to round? Paste line of code here.

Well let's say a Paladin with magic level 34 uses an Upgrade and wins 2% m lvl bonus.

2% of 34 turns out to be .68, at the moment it rounds down to 0 instead of to 1, i'm trying to figure out how to make it round up.

I'm not entirely sure which line of code to paste here. :confused:
 
Status
Not open for further replies.
Back
Top