[PT-BR]
Eu uso o TFS 1.3 do Nekiro pra versão 8.6 e instalei o script de exercise Weapon, segue a baixo o sistema. Mas estou com alguns problemas:
1 - Não consigo colocar NPC pra vender os itens
2 - Os de mago não está dando magic level
3 - E queria que quando tirasse da mochila, move-se o item parasse também.
[ENG]
I use Nekiro's TFS 1.3 for version 8.6 and I installed the exercise Weapon script, the system follows below. But I have some problems:
1 - I can't put NPC to sell the items
2 - The mage ones are not giving magic level
3 - And I wanted that when you took it out of the backpack, the item would also stop moving.
Eu uso o TFS 1.3 do Nekiro pra versão 8.6 e instalei o script de exercise Weapon, segue a baixo o sistema. Mas estou com alguns problemas:
1 - Não consigo colocar NPC pra vender os itens
2 - Os de mago não está dando magic level
3 - E queria que quando tirasse da mochila, move-se o item parasse também.
[ENG]
I use Nekiro's TFS 1.3 for version 8.6 and I installed the exercise Weapon script, the system follows below. But I have some problems:
1 - I can't put NPC to sell the items
2 - The mage ones are not giving magic level
3 - And I wanted that when you took it out of the backpack, the item would also stop moving.
local skills = {
[12678] = {id=SKILL_CLUB,voc=4},
[12679] = {id=SKILL_CLUB,voc=4},
[12680] = {id=SKILL_CLUB,voc=4},
[12681] = {id=SKILL_SWORD,voc=4},
[12682] = {id=SKILL_SWORD,voc=4},
[12683] = {id=SKILL_SWORD,voc=4},
[12684] = {id=SKILL_AXE,voc=4},
[12685] = {id=SKILL_AXE,voc=4},
[12686] = {id=SKILL_AXE,voc=4},
[12687] = {id=SKILL_DISTANCE,voc=3,range=CONST_ANI_SIMPLEARROW},
[12688] = {id=SKILL_DISTANCE,voc=3,range=CONST_ANI_SIMPLEARROW},
[12689] = {id=SKILL_DISTANCE,voc=3,range=CONST_ANI_SIMPLEARROW},
[12690] = {id=SKILL_MAGLEVEL,voc=2,range=CONST_ANI_ICE},
[12691] = {id=SKILL_MAGLEVEL,voc=2,range=CONST_ANI_ICE},
[12692] = {id=SKILL_MAGLEVEL,voc=2,range=CONST_ANI_ICE},
[12693] = {id=SKILL_MAGLEVEL,voc=1,range=CONST_ANI_FIRE},
[12694] = {id=SKILL_MAGLEVEL,voc=1,range=CONST_ANI_FIRE},
[12695] = {id=SKILL_MAGLEVEL,voc=1,range=CONST_ANI_FIRE}
}
local dummies = {12697}
local skillRate = 1*configManager.getNumber(configKeys.RATE_SKILL)
-- skillRate = 1.1*30 = 30 + 3 (10%) = 33x
local function start_train(pid,start_pos,itemid,fpos)
local player = Player(pid)
if player ~= nil then
local pos_n = player:getPosition()
if start_pos:getDistance(pos_n) == 0 and getTilePzInfo(pos_n) then
if player:getItemCount(itemid) >= 1 then
if player:getStorageValue(Storage.isTraining) == 1 then
player:setStorageValue(Storage.isTraining,0)
end
local exercise = player:getItemById(itemid,true)
if exercise:isItem() then
if exercise:hasAttribute(ITEM_ATTRIBUTE_CHARGES) then
local charges_n = exercise:getAttribute(ITEM_ATTRIBUTE_CHARGES)
if charges_n >= 1 then
exercise:setAttribute(ITEM_ATTRIBUTE_CHARGES,(charges_n-1))
local voc = player:getVocation()
if skills[itemid].id == SKILL_MAGLEVEL then
magicTry = voc:getRequiredManaSpent(player:getBaseMagicLevel() + 1)-player:getManaSpent()
player:addManaSpent(math.ceil(250))
else
player:addSkillTries(skills[itemid].id, 1*skillRate)
end
fpos:sendMagicEffect(CONST_ME_HITAREA)
if skills[itemid].range then
pos_n:sendDistanceEffect(fpos, skills[itemid].range)
end
local training = addEvent(start_train, voc:getAttackSpeed(), pid,start_pos,itemid,fpos)
player:setStorageValue(Storage.isTraining,1)
else
exercise:remove(1)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Your training weapon vanished.")
stopEvent(training)
player:setStorageValue(Storage.isTraining,0)
end
end
end
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "Youy training has stopped.")
stopEvent(training)
player:setStorageValue(Storage.isTraining,0)
end
else
if player:getStorageValue(Storage.isTraining) == 1 then
player:setStorageValue(Storage.isTraining,0)
end
stopEvent(training)
if player then -- verificar se o player ainda existe (logado), caso esteja, enviar mensagem de erro e parar treino. isso evita erros no console
player:sendTextMessage(MESSAGE_INFO_DESCR, "Youy training has stopped.")
player:setStorageValue(Storage.isTraining,0)
end
end
return true
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local start_pos = player:getPosition()
if player:getStorageValue(Storage.isTraining) == 1 and player:getItemCount(item.itemid) >= 1 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You are already training.")
return false
end
if target:isItem() then
if isInArray(dummies,target:getId()) and player:getItemCount(item.itemid) >= 1 then
if not skills[item.itemid].range and (start_pos:getDistance(target:getPosition()) > 1) then
player:sendTextMessage(MESSAGE_INFO_DESCR, "Get closer to the dummy.")
stopEvent(training)
return true
end
player:sendTextMessage(MESSAGE_INFO_DESCR, "You started training.")
start_train(player:getId(),start_pos,item.itemid,target:getPosition())
end
end
return true
end