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

Need support with some stuff in my 8.6 TFServer

Zakhran

Pace
Joined
May 7, 2012
Messages
252
Reaction score
6
Location
Detroit, Michigan
Hi all, I have been creating a custom 8.60 server a long time ago and it's almost finished but I only need a few things more but I don't find how to do it.

-First of all I want the power of the vocations to be level depend, because I have noted that the power of the spells and that stuff it depends of the magic level.

-Also I have wondering how to do a "choose 3 item" quest from 10 items?



That's all I need support, hope I can get help here. THANKS!
 
Hi all, I have been creating a custom 8.60 server a long time ago and it's almost finished but I only need a few things more but I don't find how to do it.

-First of all I want the power of the vocations to be level depend, because I have noted that the power of the spells and that stuff it depends of the magic level.

-Also I have wondering how to do a "choose 3 item" quest from 10 items?



That's all I need support, hope I can get help here. THANKS!


Please post an example of just one of your spells that is magic level dependent please, then I will repost it being level dependent
 
F berserk:

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)
local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
function onGetFormulaValues(cid, level, skill, attack, factor)
 local skillTotal, levelTotal = skill + attack * 3, level / 4
 return -(skillTotal * 3.9 + levelTotal), -(skillTotal * 4 + levelTotal)
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
 return doCombat(cid, combat, var)
end

Eternal Winter:

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 22, 17, 24, 28)
local area = createCombatArea(AREA_CROSS5X5)
setCombatArea(combat, area)
function onCastSpell(cid, var)
 return doCombat(cid, combat, var)
end
 
For your quest you could take the anni example that comes with almost all ots and adjust it to your needs
at one point in the script it will check for your storage value (the quests unique id)
at this point it will either add the specific item from the chest if the player has not yet the storage value or it will not give an item because the player already has the storage value...

you must interfere at this point, ill give you some pseudo code:
Code:
if playerStorageValue < 3 then
  giveItem
  increaseStorageValue by 1
else
  say:"you already got your reward"
end

this will not work if you copy and paste / this is pseudo code
this is just to give you the idea of how it works -> you must write the real code
 
Level already has influence, just less than ml.
If you do it like this you can calculate it more easy with influence of lvl and ml on the damage.
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)

local area = createCombatArea(AREA_CROSS5X5)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, maglevel)
   min = (maglevel*6) +(level/5) +76
   max = (maglevel*8) +(level/5) +108

   return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
   return doCombat(cid, combat, var)
end
 
Yes, but I can't manage to do that script, I don't know how to use properly the storage.
Storage is kinda like a variable, you can hold all sorts of things in storage such as text (i like apples), numbers (1, 2, 1.0, 2.5, 3.567, 0.56799) or boolean values (1 or 0, true or false) the only thing you can't store in storage is a table we'll at least to my knowledge you can't or at least I haven't had any luck with it. :)

Unlike variables which usually begin with a letter or underscore, storage is defined using a number, you can define storage in a number of ways

Assigned to a variable
Code:
    local storage = 18000

Assigned as an element or index of a table
Code:
    local storage =
        {
            [18000] = 0 -- we should set this to something initially
       
        }
        or
    local config =
        {
            storage = 18000
        }

You can't officially define just a number, but you can write a comment stating this storage number is for such and such
Code:
    --18000

The way you initially assign a value to the storage is using its set method or function
Code:
    setPlayerStorageValue(cid, 18000, 1)
This is just a general explanation of functions & methods and will use them interchangeably

Functions / Methods perform an action, setPlayerStorageValue is a function that sets a storage value to be used elsewhere in any script, consider it a tiny database within the bigger database.

Functions can contain parameter(s) which are seen in between the parentheses they are used to pass value(s) to that function as an argument(s)

Lets look at the parameters of setPlayerStorageValue

The 1st parameter cid is the id of the player which is always a number, you don't need to define this as it is always passed to the function, the 2nd parameter is the storage, and the 3rd is the value you want to assign to the storage.

There are a number of ways you can set the storage value lets take a look, using the examples above
Please note these are not the only ways to assign storage
Code:
    setPlayerStorageValue(cid, 18000, 1) -- just using the number
    setPlayerStorageValue(cid, storage, 1) -- just using the variable as a reference
    setPlayerStorageValue(cid, storage[18000], 1) -- using a table element or index as a reference, this would replace the value of 0 with 1
    setPlayerStorageValue(cid, config.storage, 1) -- using a table element or index as a reference, this would replace the value of 0 with 1

When we set any storage value the storage is saved in the database

Now that we have our storage set, we can retrieve this value by calling it's get method or function

The get method returns or retrieves the value stored inside of our storage value 18000
Code:
    -- all of these would return 1
    getPlayerStorageValue(cid, 18000)
    getPlayerStorageValue(cid, storage)
    getPlayerStorageValue(cid, storage[18000])
    getPlayerStorageValue(cid, config.storage)

Which can then be used elsewhere in the program

Hope this has been a little helpful :)
 
Last edited:
Back
Top