Script que al usar un item aprendas cierto spell

El Bu

Member
Messages
42
Points
151
Hola, alguien me podra ayudar con un scripts para al usar un item se me remueva el item y me de un spell que tenga condicion de que solo lo pueda usar cierta vocacion y si ya lo tiene el spell que ya no lo pueda usar, porfavor. Muchas Gracias Tibia version 13.21 canary
 
Solution
Hola, alguien me podra ayudar con un scripts para al usar un item se me remueva el item y me de un spell que tenga condicion de que solo lo pueda usar cierta vocacion y si ya lo tiene el spell que ya no lo pueda usar, porfavor. Muchas Gracias Tibia version 13.21 canary

Hola,

Un item seria de este tipo:

Code:
local miItem = Action()

function miItem.onUse(player, item)
local storage = 284500
local storageSpell = 284501
if player:getStorageValue(storage) < 1 then
player:setStorageValue(storageSpell, 1)
player:setStorageValue(storage, 1)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You learned this spell.")
item:remove(1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You already learned this spell.")
end
end

miItem:id(11111)...
Hola, alguien me podra ayudar con un scripts para al usar un item se me remueva el item y me de un spell que tenga condicion de que solo lo pueda usar cierta vocacion y si ya lo tiene el spell que ya no lo pueda usar, porfavor. Muchas Gracias Tibia version 13.21 canary

Hola,

Un item seria de este tipo:

Code:
local miItem = Action()

function miItem.onUse(player, item)
local storage = 284500
local storageSpell = 284501
if player:getStorageValue(storage) < 1 then
player:setStorageValue(storageSpell, 1)
player:setStorageValue(storage, 1)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You learned this spell.")
item:remove(1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You already learned this spell.")
end
end

miItem:id(11111) --- Item ID
miItem:register()


Ejemplo de una spell, cualquier, cogi la primera que encontré:

Code:
    local combat = Combat()
    combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
    combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION)

    local condition = Condition(CONDITION_PARALYZE)
    condition:setParameter(CONDITION_PARAM_TICKS, 20000)
    condition:setFormula(-0.70, 0, -0.85, 0)
    combat:addCondition(condition)

local spell = Spell("instant")

function spell.onCastSpell(creature, var)
    local storageSpell = 284501
    if creature:getStorageValue(storageSpell) == 1 then --- Mirar si tiene la spell obtenida por item
    return combat:execute(creature, var)
    else
    creature:sendTextMessage("You cannot use this spell", TALKTYPE_MONSTER_SAY)
end

spell:name("Nombre Spell")
spell:words("Nombre que decir para hacer la spell")
spell:group("support")
spell:vocation("priest;true", "elite priest;true") -- vocation
spell:id(128)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:level(32) --- nivel
spell:mana(120) --- mana
spell:isSelfTarget(true) ---  selfTarget (usar en si mismo, en caso quita la linea)
spell:isAggressive(false)
spell:isPremium(true) --- Premium
spell:needLearn(false) --- Si hay que aprenderla..
spell:register()
 
Solution
Adapte tu codigo al mio y me funciono de esta manera, sin tener que agregar nada en el codigo del spell, solamente poner pues learn en false.
Gracias

1728498720998.png
 

Tibia Server Lists

#1 FEATURED US Ultron OT 1,616 / 5,000Online EXPStages PROTO8.6 ENGINEUltron OT RANK PTS5.9 +100% VOTES0 #2 FEATURED US Nefera 156 / 0Online EXPx1 PROTO15.20 ENGINECrystal Server RANK PTS5.1 +100% VOTES0 #3 FEATURED ES Deixis 0 / 0Offline EXPStages PROTO1098 ENGINETFS RANK PTS3.7 +100% VOTES1 #4 FEATURED ES Maeli 7 / 150Online EXPx10 PROTO10.98 ENGINETFS 1.4.2 RANK PTS3.7 +100% VOTES0 #5 MX Marlboro War 40 / 300Online EXP999 PROTO8.6 ENGINETFS 0.3.7 RANK PTS5.5 -33% VOTES0 #6 BR Tibinha YurOts 18 / 150Online EXPStages PROTO7.4 ENGINEYurOTS 1.5 RANK PTS5.2 -14% VOTES0 #7 US Halera 3 / 0Online EXPStages PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.9 -83% VOTES0 #8 BR Exordion Legacy 54 / 2,000Online EXPx2 PROTO7.72 ENGINEExordion RANK PTS4.9 +100% VOTES0 #9 PL Lubelski 3 / 1,000Online EXP200 PROTO7.6 ENGINELubelskiOTS 2.56.0 RANK PTS4.6 -15% VOTES0 #10 DE DBU Online 0 / 400Online EXP11 PROTO8.6 ENGINETFS 1.0 RANK PTS4.3 +100% VOTES0 #11 PL ReWar 0 / 2,000Online EXPcustom PROTO8.6 ENGINEOther RANK PTS4.3 0% VOTES0 #12 PL Velesta 0 / 1,000Offline EXP20 PROTO8.0 ENGINETFS 1.4.2 RANK PTS4.3 -98% VOTES0 #13 ES JustRL FreeTC 1530 13 / 250Online EXPx2 PROTO15.30 ENGINECrystal Server RANK PTS4.3 +100% VOTES0 #14 ES Farlia Global 2026 0 / 333Offline EXPx5 PROTO15.25 ENGINEFarliaServ 1.525 RANK PTS3.9 -22% VOTES0 #15 SE MortalisOT Custom 0 / 500Offline EXP100x -1.2x PROTO10.98 ENGINEMortalisOT V1 RANK PTS3.8 +100% VOTES0 #16 US Rommania 0 / 500Online EXPstages, x10 PROTO7.4 ENGINETFS 0.4 RANK PTS3.6 +100% VOTES0 #17 US BerethaOnline 2 / 2,000Online EXPStages PROTO10.98 ENGINETFS RANK PTS3.5 +100% VOTES0
Top