• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Script that players can use spells only when they have equipped wand

iksior

New Member
Joined
Jan 25, 2009
Messages
33
Reaction score
0
Hello everyone !
I need script for cryingdamson6pl1 (tibia8.54) for something like that
If player have VoC'e or Snake Bire rod eqquiped he can use spells, otherwise he can't use any spells
 
Ok, so i've got spell, and where should i paste this code ? I want to use spells with items from id 1000-1006 and 2004

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
function getSpellDamage(cid, weaponSkill, weaponAttack, attackStrength)
    local level = getPlayerLevel(cid)
    local maglevel = getPlayerMagLevel(cid)
    local min = -(level + maglevel)*0.1
    local max = -(level + maglevel)*0.5
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage")

local condition = createConditionObject(CONDITION_CURSED)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
local ileIch = 10
local coIle = 2 * 1000 -- 1000 milisekund to sekunda, pomnozone razy dwa to dwie sekundy
local obrazenia = 250
addDamageCondition(condition, ileIch, coIle, -obrazenia)
setCombatCondition(combat, condition)




function onCastSpell(cid, var)
    
    if(variantToNumber(var) ~= 0) then
        return doCombat(cid, combat, var)
    else
        doPlayerSendCancel(cid,"Musisz wybrac cel.")
        doSendMagicEffect(getCreaturePos(cid),CONST_ME_POFF)
    end
        return 0
end
 
Ok, so i've got spell, and where should i paste this code ? I want to use spells with items from id 1000-1006 and 2004

first, if you are copying script you have to use [ lua ] instead of [ code ].

here is your spell, i added this line:
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
function getSpellDamage(cid, weaponSkill, weaponAttack, attackStrength)
    local level = getPlayerLevel(cid)
    local maglevel = getPlayerMagLevel(cid)
    local min = -(level + maglevel)*0.1
    local max = -(level + maglevel)*0.5
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage")

local condition = createConditionObject(CONDITION_CURSED)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
local ileIch = 10
local coIle = 2 * 1000 -- 1000 milisekund to sekunda, pomnozone razy dwa to dwie sekundy
local obrazenia = 250
addDamageCondition(condition, ileIch, coIle, -obrazenia)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
-------------\/------------
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).uid == 1000 or getPlayerSlotItem(cid, CONST_SLOT_RIGHT).uid == 1000 then
-------------/\------------
    if(variantToNumber(var) ~= 0) then
        return doCombat(cid, combat, var)
    else
        doPlayerSendCancel(cid,"Musisz wybrac cel.")
        doSendMagicEffect(getCreaturePos(cid),CONST_ME_POFF)
    end
-----------\/-----------
else 
	return false
end
-----------/\-----------
return true
end

if you are using TFS, you can add this to specific spell in your spells.xml instead of editing every spell. might not work, didnt test it before.
LUA:
reagentId="1000"
example:
Code:
<instant name="Divine Healing" words="exura san" lvl="35" mana="210" [B]reagentId="1000"[/B] selftarget="1" aggressive="0" script="healing/divine_healing.lua">
<vocation name="Paladin"/>
</instant>

and remember, at end of script there should be "return true" or "return lua_no_error". otherwise your script will be bugged (players might spam this spell without mana cost and exhaust for example)
 
Last edited:
Back
Top