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,502 / 5,000 EXPStages PROTO8.6 ENGINEUltron OT RANK PTS6.6 -9% VOTES0 #2 FEATURED US Nefera 192 / 0 EXPx1 PROTO15.20 ENGINECrystal Server RANK PTS5.9 +25% VOTES0 #3 FEATURED CL ZHYRAVEX 13 / 500 EXPx5 PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.7 +100% VOTES0 #4 FEATURED ES Deixis 0 / 0 EXPStages PROTO1098 ENGINETFS RANK PTS4.0 -61% VOTES1 #5 DE DBU Online 206 / 400 EXP11 PROTO8.6 ENGINETFS 1.0 RANK PTS6.1 +1,000% VOTES0 #6 BR Exordion Legacy 83 / 2,000 EXPx2 PROTO7.72 ENGINEExordion RANK PTS5.7 +2% VOTES0 #7 MX Marlboro War 30 / 300 EXP999 PROTO8.6 ENGINETFS 0.3.7 RANK PTS5.5 -28% VOTES0 #8 BR Tibinha YurOts 22 / 150 EXPStages PROTO7.4 ENGINEYurOTS 1.5 RANK PTS5.5 +3% VOTES0 #9 ES JustRL FreeTC 1530 19 / 250 EXPx2 PROTO15.30 ENGINECrystal Server RANK PTS5.0 +19% VOTES0 #10 US Wiki Ots 54 / 1,000 EXPx9999 PROTOcustom client ENGINETFS 1.4.2 RANK PTS5.0 +100% VOTES0 #11 PL Lubelski 13 / 1,000 EXP200 PROTO7.6 ENGINELubelskiOTS 2.56.0 RANK PTS4.9 -17% VOTES0 #12 BR Turion Server 0 / 2,000 EXPx1 PROTO7.4 ENGINETurion 7.7 Project RANK PTS4.6 +252% VOTES0 #13 PL ReWar 0 / 2,000 EXPcustom PROTO8.6 ENGINEOther RANK PTS4.6 +100% VOTES0 #14 US Halera 0 / 0 EXPStages PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.4 -80% VOTES0 #15 PL Velesta 0 / 1,000 EXP20 PROTO8.0 ENGINETFS 1.4.2 RANK PTS4.4 -100% VOTES0 #16 US BerethaOnline 0 / 2,000 EXPStages PROTO15.0 ENGINETFS RANK PTS4.3 -76% VOTES0 #17 ES Farlia Global 2026 0 / 333 EXPx5 PROTO15.25 ENGINEFarliaServ 1.525 RANK PTS4.0 -100% VOTES0 #18 SE MortalisOT Custom 0 / 500 EXP100x -1.2x PROTO10.98 ENGINEMortalisOT V1 RANK PTS4.0 -100% VOTES0 #19 RU Oldavia | 8.60 0 / 0 EXPx9999 PROTO8.6 ENGINETFS 1.3 RANK PTS3.9 +100% VOTES0 #20 US Rommania 0 / 3,000 EXPstages, x10 PROTO7.4 ENGINETFS 0.4 RANK PTS3.6 -89% VOTES0 #21 MX Maeli 0 / 150 EXPx10 PROTO10.98 ENGINETFS 1.4.2 RANK PTS3.5 -33% VOTES0 #22 ES DarkDragon EXPx10 PROTO8.6 ENGINECanary RANK PTS0.0 0% VOTES0
Top