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

Armor that adds(equip) and remove(deequip) a skill.

Kaboo

New Member
Joined
Feb 14, 2009
Messages
142
Reaction score
0
Hi, i'm trying to use the following script for an armor, so it will improve Club in 15 (i'll configure it for more skills later).
When you equip the armor, it must adds 15 skills, and then when it is deequiped it will decrease club fighting in 15:
Code:
function onEquip(cid, item, slot)
if (getPlayerStorageValue(cid, 312423) == 1) then
doCreatureSay(cid, "You have storage!", TALKTYPE_ORANGE_1)
[B]doPlayerAddSkill(cid,1,15)[/B]
return TRUE
elseif (getPlayerStorageValue(cid, 312423) == -1) then
doCreatureSay(cid, "Must Have Storage!", TALKTYPE_ORANGE_1)
return FALSE
end
end
function onDeEquip(cid, item, slot)
[B]doPlayerAddSkill(cid,1,-15)[/B]
end

But it just add 2 Club Skills when i equip it, and it adds 1 more Club Skill when i deequip.
Is something wrong? I cannot just configure it in items.xml because it needs a storage value to equip the armor.
Any tips of what's wrong?
 
I think he wants an armor that when you put it on, you get 15+ in what ever skill, but when you take it off, you loose the skills you gained when you used it away. Like a bullseye potion.

What he has right now is an armor that when you wear it, you only gain 2 skills and not 15. When you take it off it adds 1 more skill.
 
why wouldnt you just use the items.xml and movements?

this seems like a complex way of doing something easy

good luck with it
Yea.. I know... but if I configure the item in item.xml and with a movement script(this armor requires a storage value) it just doesn't add the skill, that's why i'm trying to do by this way.
 
You cannot prevent the item from being equipped by returning false.

This seems to be the only way:
Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, 15)
setConditionParam(condition, CONDITION_PARAM_SUBID, 4)

function onEquip(cid, item, slot)
	if getPlayerStorageValue(cid, 312423) > 0 then
		doAddCondition(cid, condition)
	end
end

function onDeEquip(cid, item, slot)
	if hasCondition(cid, CONDITION_ATTRIBUTES, 4) then
		doRemoveCondition(cid, CONDITION_ATTRIBUTES, 4)
	end
end
 
Last edited:
You cannot prevent the item from being equipped by returning false.

This seems to be the only way:
Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, 15)
setConditionParam(condition, CONDITION_PARAM_SUBID, 4)

function onEquip(cid, item, slot)
	if getPlayerStorageValue(cid, 312423) > 0 then
		doAddCondition(cid, condition)
	end
end

function onDeEquip(cid, item, slot)
	if hasCondition(cid, CONDITION_ATTRIBUTES, 4) then
		doRemoveCondition(cid, CONDITION_ATTRIBUTES, 4)
	end
end
It works, the only problem is that the skill is improved, but in less than a half second the skill improvement turn back to what it was before wearing the armor.
I think i must add something, like CONDITION_TICKS, but how to make it infinite?
Sorry for asking this, i never used conditions before
 
and what happens when you re-login? :s
It continues with the improved skill.
I did some tests and I didn't manage to exploit it succefully.
I tried to die and lose, trade it, train skills, drop and things like this while wearing the armor.
 
Back
Top