shivaria
Active Member
- Joined
- Sep 2, 2009
- Messages
- 158
- Reaction score
- 36
TFS 1.1, or 10.77
Its showing no errors yet its not adding the skill level (I want it to increase it by 1)
I also want it to learn a random spell from the list (its not learning the spell)
SOLVED
Its showing no errors yet its not adding the skill level (I want it to increase it by 1)
I also want it to learn a random spell from the list (its not learning the spell)
SOLVED
Code:
local randomSpell = {"SPELL", "OTHER SPELL", "Better Spell", "Crappy Spell", "Spell Name Here Not Words"}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(13529) == -1 then
if player:removeItem(13529, 1) then
local spell = math.random(#randomSpell)
local skillId = SKILL_AXE
player:addSkillTries(skillId, player:getVocation():getRequiredSkillTries(skillId, player:getSkillLevel(skillId) + 1) - player:getSkillTries(skillId))
player:setStorageValue(13529, -1)
player:learnSpell(randomSpell[spell])
fromPosition:sendMagicEffect(CONST_ME_HOLY)
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You learned "..randomSpell[spell])
player:popupFYI("You learned "..randomSpell[spell])
end
else
player:removeItem(13529, 1)
player:say("It turned to ashes..", TALKTYPE_MONSTER_SAY)
fromPosition:sendMagicEffect(CONST_ME_POFF)
end
return true
end
Last edited: