TFS 1.0 (10.41 rev)
function getItemAttack(uid) return ItemType(getThing(uid).itemid):getAttack() end
function getItemArmor(uid) return ItemType(getThing(uid).itemid):getArmor() end
function isArmor(uid) if (getItemArmor(uid) ~= 0 and getItemWeaponType(uid) == 0) then return true else return false end end
function isWeapon(uid) return (getItemWeaponType(uid) > 0 and getItemWeaponType(uid) ~= 4) end
A few of these seem to work, and a few of these do not seem to work.
The ones that seem to work are:
isWeapon(uid)
getItemAttack(uid)
The ones that I know to NOT be working, are:
isArmor(uid)
getItemArmor(uid)
1)No matter what I do, my armor value shows as "0" in my script.
2)I have scripted the action to set the armor value to "0" while no armor is present.
3)So either it is failing to recognize that I am wearing armor, or it is failing to recognize the armor value.
4)There are no errors in the server. I am literally just trying to retrieve the value of how much armor my character is wearing.
Any help?
Here is my script, although I don't think there is anything wrong with it:
BTW: I tried isArmor WITHOUT checking for true. Same result.
I ALSO tried not checking for isArmor, but only setting getItemArmor. Same result.
function onThink(cid, interval)
if isArmor(getPlayerSlotItem(cid, CONST_SLOT_HEAD).uid) == true then
setPlayerStorageValue(cid, 2006, getItemArmor(getPlayerSlotItem(cid, CONST_SLOT_HEAD).uid))
else
setPlayerStorageValue(cid, 2006, 0)
end
return true
end
My storage is 0 no matter what. And yes... of course its registered in login.lua and creaturescripts.xml
function getItemAttack(uid) return ItemType(getThing(uid).itemid):getAttack() end
function getItemArmor(uid) return ItemType(getThing(uid).itemid):getArmor() end
function isArmor(uid) if (getItemArmor(uid) ~= 0 and getItemWeaponType(uid) == 0) then return true else return false end end
function isWeapon(uid) return (getItemWeaponType(uid) > 0 and getItemWeaponType(uid) ~= 4) end
A few of these seem to work, and a few of these do not seem to work.
The ones that seem to work are:
isWeapon(uid)
getItemAttack(uid)
The ones that I know to NOT be working, are:
isArmor(uid)
getItemArmor(uid)
1)No matter what I do, my armor value shows as "0" in my script.
2)I have scripted the action to set the armor value to "0" while no armor is present.
3)So either it is failing to recognize that I am wearing armor, or it is failing to recognize the armor value.
4)There are no errors in the server. I am literally just trying to retrieve the value of how much armor my character is wearing.
Any help?
Here is my script, although I don't think there is anything wrong with it:
BTW: I tried isArmor WITHOUT checking for true. Same result.
I ALSO tried not checking for isArmor, but only setting getItemArmor. Same result.
function onThink(cid, interval)
if isArmor(getPlayerSlotItem(cid, CONST_SLOT_HEAD).uid) == true then
setPlayerStorageValue(cid, 2006, getItemArmor(getPlayerSlotItem(cid, CONST_SLOT_HEAD).uid))
else
setPlayerStorageValue(cid, 2006, 0)
end
return true
end
My storage is 0 no matter what. And yes... of course its registered in login.lua and creaturescripts.xml
Last edited: