local distance = {
500,
1000,
2000,
5000
}
local magic = {
10000,
25000,
40000
}
for k, v in ipairs(distance) do
print(v)
end
for k, v in ipairs(magic) do
print(v)
end
Its pretty simple just create your table(s)
Code:local distance = { 500, 1000, 2000, 5000 } local magic = { 10000, 25000, 40000 }
Then use a for loop and ipairs to cycle through the tables
Code:for k, v in ipairs(distance) do print(v) end for k, v in ipairs(magic) do print(v) end
Assuming this is just for testing purpose, if this is not what your looking for then please rephrase your question![]()
yes i want full control skills/magic level/level its betterThere is thing with skills in TFS. If it gains negative value and it exceeds the amount player has, player will get maximum skill level possible (Which is 255 if not changed in source)
If you want full control over skills. Put all the player skills idk, around 200. Then remove it all with specific Condition.
Now on, when player gains skill tries and it would exceed the required amount (said in table). Then instead. "reset" the skillTries and increase the another skill level condition.
Keep in mind you would have to use effectiveSkillLevel for any kind of formulas then.
If you didn't know yet, skillTries are calculated in events playernGainSkillTries (or something like that)
uint32_t Vocation::getReqSkillTries(int32_t skill, int32_t level)
{
if (skill < SKILL_FIRST || skill > SKILL_LAST) {
return 0;
}
auto it = cacheSkill[skill].find(level);
if (it != cacheSkill[skill].end()) {
return it->second;
}
uint32_t tries = static_cast<uint32_t>(skillBase[skill] * std::pow(static_cast<float>(skillMultipliers[skill]), level - 11));
cacheSkill[skill][level] = tries;
return tries;
}
uint64_t Vocation::getReqMana(uint32_t magLevel)
{
auto it = cacheMana.find(magLevel);
if (it != cacheMana.end()) {
return it->second;
}
uint64_t reqMana = static_cast<uint64_t>(400 * std::pow(manaMultiplier, static_cast<int32_t>(magLevel) - 1));
uint32_t modResult = reqMana % 20;
if (modResult < 10) {
reqMana -= modResult;
} else {
reqMana -= modResult + 20;
}
cacheMana[magLevel] = reqMana;
return reqMana;
}
#define local
uint64_t currLevelExp = Player::getExpForLevel(level);
uint64_t nextLevelExp = Player::getExpForLevel(level = local level);
if (nextLevelExp > currLevelExp) {
levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp);
} else {
levelPercent = 0;
}
}
local level = {
10000,
};
i dont know....I don't know c++ either. Why don't you handle this in LUA? using data folder
not have onGainSkillTriesdata>events>scripts>player.lua>unction Player|onGainSkillTries(skill, tries)
ahmmmmmmmmmmmmmoh my. My fail, though TFS 1.0 had skillTries function too, apparently not.
Well, either update TFS or change the skillrate value to 0 in config.
and then in onHealthChange function start adding skilltries each time monster takes damage (in other words, you also will set how much of skill exp they get when they hit monster)
this fuction onhealthchange not haveyes you can do that.
but I'm correct the rates in .xml wont change anything. You would have to recognize the attacker vocation in onhealthchange function and then make another table of specific rates for each vocation.
fuction? onhealthchangeyes you can do that.
but I'm correct the rates in .xml wont change anything. You would have to recognize the attacker vocation in onhealthchange function and then make another table of specific rates for each vocation.
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
<event type="healthchange" name="randomName" script="your script name.lua"/>
hmmm?data>creaturescripts>scripts>your script name.lua
inside that you you write the function
to register the script you write into .xml file thisCode:function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
Code:<event type="healthchange" name="randomName" script="your script name.lua"/>
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
local level exp = {
0,
1,
2
}
local distance exp = {
1,
2,
}
end
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
local levelExp = {
0,
1,
2
}
local distance_exp = {
1,
2,
}
end
local levelExp = {
0,
1,
2
}
local distanceExp = {
1,
2,
}
print()
print("levelExp table ")
for tableKey, value in ipairs(levelExp) do
print("["..tableKey.."] = "..value)
end
print()
print("distanceExp table ")
for tableKey, value in ipairs(distanceExp) do
print("["..tableKey.."] = "..value)
end
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
end
now i understand yes i see.how to work it?variables cant be in 2 different words. but you are on a right track.
So, we write them like this:
Code:function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) local levelExp = { 0, 1, 2 } local distance_exp = { 1, 2, } end
But these don't have to be inside function itself, because they will never change while server is running? (right)
If you create table inside a function, then each time this function is called it will create the local table, and we don't need that.
Its enough if it loads the table once when server starts up. (right?)
So I would do something like this:
Code:local levelExp = { 0, 1, 2 } local distanceExp = { 1, 2, } print() print("levelExp table ") for tableKey, value in ipairs(levelExp) do print("["..tableKey.."] = "..value) end print() print("distanceExp table ") for tableKey, value in ipairs(distanceExp) do print("["..tableKey.."] = "..value) end function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) end