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

[C++] Item.xml skills negative

Zerox009

Member
Joined
Dec 20, 2007
Messages
17
Reaction score
7
Hello, I'm working on a project, which is that depending on your weapons you can have a certain ability in the game, but I noticed that when a condition such as the attribute of an item becomes negative, it becomes positive, causing it to automatically turn positive


Example:
<item id="8881" article="a" name="fireborn giant armor">
<attribute key="weight" value="12000" />
<attribute key="armor" value="15" />
<attribute key="skillSword" value="-40" />
<attribute key="absorbPercentFire" value="5" />
<attribute key="absorbPercentIce" value="-5" />
<attribute key="slotType" value="body" />
</item>

if the player has skill 10
the character is left with 65506 skills, and I can't get it to stay at 0 better

I am using tfs 1.4 the master
Thank you very much in advance
 
Well, you can put this script on 'movements.xml', like:

XML:
    <movevent type="Equip" itemid="8881" slot="armor" event="script" value="fireborn giant armor.lua"/>
    <movevent type="DeEquip" itemid="8881" slot="armor" value="fireborn giant armor.lua"/>

Then, you write a script inside linked to 'movements.xml', such as 'fireborn giant armor.lua' and with the script somehow like this

Lua:
function onEquip(cid, item, slot)
  if getPlayerSkillLevel(cid, 2) > 40 then
    doPlayerAddSkill(cid, 2, -40, round) -- I don't really know what's round mean, but you may test it to find it out xD
  else
    doPlayerAddSkill(cid, 2, -getPlayerSkillLevel(cid, 2)+1, round) -- Prevent to set the skills equal to zero, maybe this can cause troubles...
  end
  return true
end

when the player use ther amor, it will remove the amount of sword skills necessary for your condition. Just a little remind about the number related from the skill:

skill = 0 -- Fist
skill = 1 -- Club
skill = 2 -- Sword
skill = 3 -- Axe
skill = 4 -- Distance
skill = 5 -- Shield
skill = 6 -- Fish

I didn't test it, but I think this may be an option. If it happens any bug such as loosing the skills forever, maybe you must write something like

Lua:
function onEquip(cid, item, slot)
...
end

function onDeEquip(cid, item, slot)
...(add skill)...
end

The though thing about this 'probably bug' is that you don't know how much skill the player had before he use the armor. But try the first thing first before we check newer problems... If it works, don't forget to give me a rep+!
 
Back
Top