• Sign up for September Mapping Competition! The prize includes Otland Premium time.
  • 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!

[Weapon] All kinds of weapons

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
8
Reaction score
2,985
Location
Netherlands
Tested with TFS 0.3.6pl1 8.54

All kinds of weapons I made.
Most of them are from old requests, others from ideas, decided to put them all together in 1 thread.

For attack damage weapons:
Weapons.xml
XML:
<melee id="XXXX" level="20" unproperly="1" event="script" value="weapon.lua"/>
For wands:
Weapons.xml
XML:
	<wand id="XXXX" level="50" mana="15" event="script" value="wand.lua"> <!-- Wand -->
		<vocation id="1"/>
	</wand>

Weapons with % chance something happens
The math.random(1,10) means 10% chance.
If you don't know how to calculate the %, you can use 100 : the second number. So 100:10 = 10%, 100:20 = 5%. So for 5% will be math.random(1,20)​

Double hit
10% chance to hit 2x.

doublehitweapon.lua
Lua:
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_REDSPARKS)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

    local combat1 = createCombatObject()
    setCombatParam(combat1, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat1, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
    setCombatFormula(combat1, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat2, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

local function onUseWeapon1(parameters)
	doCombat(parameters.cid, combat, parameters.var)
end

local function onUseWeapon2(parameters)
	doCombat(parameters.cid, combat1, parameters.var)
end

local function onUseWeapon3(parameters)
	doCombat(parameters.cid, combat2, parameters.var)
end
    
function onUseWeapon(cid, var)
local parameters = { cid = cid, var = var, combat = combat, combat1 = combat1, combat2 = combat2 }
    if getPlayerLevel(cid) >= 20 then
        local chance = math.random(1,10)
        if chance == 1 then
	addEvent(onUseWeapon1, 1, parameters)
	addEvent(onUseWeapon2, 400, parameters)
        doSendAnimatedText(getPlayerPosition(cid),"Doublehit", TEXTCOLOR_RED)
        else
	addEvent(onUseWeapon3, 1, parameters)
        end
    else
        doPlayerSendCancel(cid, 'You need level 20 to use this weapon.')
    end
end
Paralyze
10% chance to paralyze the target.

paralyzeweapon.lua
Lua:
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

    local condition = createConditionObject(CONDITION_PARALYZE)
    setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
    setConditionParam(condition, CONDITION_PARAM_SPEED, -150)
    setCombatCondition(combat, condition)

    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat2, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
    
function onUseWeapon(cid, var)
local target = getCreatureTarget(cid)

    if getPlayerLevel(cid) >= 20 then
        local chance = math.random(1,10)
        if chance == 1 then
        doCombat(cid, combat, var)
        doSendAnimatedText(getPlayerPosition(target),"Paralyzed", TEXTCOLOR_YELLOW)
        else
        doCombat(cid, combat2, var)
        end
    else
        doPlayerSendCancel(cid, 'You need level 20 to use this weapon.')
    end
end
paralyzewand.lua
Lua:
        local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
 
    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*4) -level/5 
    max = -(maglevel*6) -level/5
 
    return min, max
    end
 
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
    local condition = createConditionObject(CONDITION_PARALYZE)
    setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
    setConditionParam(condition, CONDITION_PARAM_SPEED, -150)
 
 
function onUseWeapon(cid, var)
local target = getCreatureTarget(cid)
local chance = math.random(1,10)
 
    	if chance == 1 then
    		doTargetCombatCondition(0, target, condition, CONST_ME_STUN)
        	doCombat(cid, combat, var)
       	        doSendAnimatedText(getPlayerPosition(target),"Paralyzed", TEXTCOLOR_YELLOW)
    	else
        	doCombat(cid, combat, var)
	end
	return true
end
Poison
10% chance to poison the target.

poisonweapon.lua
Lua:
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

    local condition = createConditionObject(CONDITION_POISON)
    setConditionParam(condition, CONDITION_PARAM_DELAYED, TRUE)
    setConditionParam(condition, CONDITION_PARAM_STARTVALUE, -15)
    setConditionParam(condition, CONDITION_PARAM_MAXVALUE, -15)
    setConditionParam(condition, CONDITION_PARAM_MINVALUE, -5)
    setConditionParam(condition, CONDITION_PARAM_TICKINTERVAL, 1000)
    setCombatCondition(combat, condition)

    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat2, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

    
function onUseWeapon(cid, var)
local target = getCreatureTarget(cid)
local chance = math.random(1,10)

   	if chance == 1 then
		doCombat(cid, combat, var)
        	doSendAnimatedText(getPlayerPosition(target),"Poisoned!", TEXTCOLOR_GREEN)
    	else
		doCombat(cid, combat2, var)
    	end
end
Stun
5% chance to make the target unable to move for 5 seconds.

stunwand.lua
Lua:
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
 
    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*2) -level/5 -20
    max = -(maglevel*3) -level/5 -25
 
    return min, max
    end
 
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_STUN)

    local function onUseWeapon1(parameters)
	doCombat(parameters.cid, combat, parameters.var)
    end

    local function onUseWeapon2(parameters)
	doCombat(parameters.cid, combat2, parameters.var)
    end
 
    function removeStun(parameters)
	doCreatureSetNoMove(parameters.target, false)
    end

function onUseWeapon(cid, var)
local target = getCreatureTarget(cid)
local parameters = {cid = cid, var = var, combat = combat, combat2 = combat2, target = getCreatureTarget(cid)}
local chance = math.random(1,20)
 
    	if chance == 1 and isPlayer(target) then
		doCreatureSetNoMove(target, true)
		addEvent(onUseWeapon1, 1, parameters)
		addEvent(onUseWeapon2, 1000, parameters)
		addEvent(onUseWeapon2, 2000, parameters)
		addEvent(onUseWeapon2, 3000, parameters)
		addEvent(onUseWeapon2, 4000, parameters)
		addEvent(removeStun, 5000, parameters)
       	        doSendAnimatedText(getPlayerPosition(target),"Stunned!", TEXTCOLOR_WHITE)
    	else
		addEvent(onUseWeapon1, 1, parameters)
	end
	return true
end
Curse
10% chance to hit the target 10x with 10% of your hp as damage.

cursewand.lua
Lua:
 local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
 
    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*2) -level/5 -20
    max = -(maglevel*3) -level/5 -25
 
    return min, max
    end
 
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
    setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS)

    function onGetFormulaValues(cid)
    percent = 10 -- this means 10% from the maxhealth as damage, on players this will be 5%
    curse = -getCreatureMaxHealth(cid)*(percent/100) 
 
    return curse, curse
    end
 
    setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
    local function onUseWeapon1(parameters)
	doCombat(parameters.cid, combat, parameters.var)
    end
 
    local function onUseWeapon2(parameters)
	doCombat(parameters.cid, combat2, parameters.var)
    end
 
 
function onUseWeapon(cid, var)
local target = getCreatureTarget(cid)
local parameters = {cid = cid, var = var, combat = combat, combat2 = combat2}
local chance = math.random(1,10)
 
    	if chance == 1 then
		addEvent(onUseWeapon1, 1, parameters)
		addEvent(onUseWeapon2, 1000, parameters)
		addEvent(onUseWeapon2, 2000, parameters)
		addEvent(onUseWeapon2, 3000, parameters)
		addEvent(onUseWeapon2, 4000, parameters)
		addEvent(onUseWeapon2, 5000, parameters)
		addEvent(onUseWeapon2, 6000, parameters)
		addEvent(onUseWeapon2, 7000, parameters)
		addEvent(onUseWeapon2, 8000, parameters)
		addEvent(onUseWeapon2, 9000, parameters)
		addEvent(onUseWeapon2, 10000, parameters)
       	        doSendAnimatedText(getPlayerPosition(target),"Cursed!", TEXTCOLOR_GREY)
    	else
		addEvent(onUseWeapon1, 1, parameters)
	end
	return true
end

Healing weapons

Normal
The idea is based on lifesteal weapons. It heals % of the average damage that people will hit with a certain level, skills and attack of the weapon.

healingweapon.lua
Lua:
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
 
function onUseWeapon(cid, var)
	local skill = getPlayerSkill(cid,SKILL_SWORD) -- Change this to the type of weapon you are using
	local mat = 0.085*0.5*50*skill+(getPlayerLevel(cid)/5) -- Change 50 to the attack of the weapon
	local min = 5 -- this means 5% minimum healing
	local max = 15 -- this means 15% maximum healing
	local addhealth = math.random((mat * (min/100)), (mat * (max/100)))
 
    if getPlayerLevel(cid) >= 20 then
        doCreatureAddHealth(cid, addhealth)
        doSendAnimatedText(getPlayerPosition(cid),"+"..addhealth.."", TEXTCOLOR_GREEN)
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) 
        doCombat(cid, combat, var)
    else
        doPlayerSendCancel(cid, 'You need level 20 to use this weapon.')
    end
end
healingwand.lua
Lua:
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
 
    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*4) -level/5 
    max = -(maglevel*6) -level/5
 
    return min, max
    end
 
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
function onUseWeapon(cid, var)

	local level, magic, target = getPlayerLevel(cid), getPlayerMagLevel(cid), getCreatureTarget(cid)
	local mat1, mat2 = magic*2+level/10, magic*3+level/10 -- 50% from the min/max above
	local xmat1, xmat2 = magic*4+level/5, magic*6+level/5 -- same as the min/max above
	local percent = 10 -- change here the % of the healing. 
	local health, xhealth = math.random((mat1 * (percent/100)), (mat2 * (percent/100))), math.random((xmat1 * (percent/100)), (xmat2 * (percent/100)))
 
	if isPlayer(target) then
		doCreatureAddHealth(cid, health)
        	doSendAnimatedText(getPlayerPosition(cid),"+"..health.."", TEXTCOLOR_GREEN)
        	doCombat(cid, combat, var)
	else
		doCreatureAddHealth(cid, xhealth)
        	doSendAnimatedText(getPlayerPosition(cid),"+"..xhealth.."", TEXTCOLOR_GREEN)
        	doCombat(cid, combat, var)
	end
	return true
end

Leech Seed

The damage is based on the health of the target, it deals 3% of the targets health and gives this as healing to the person who is using the wand.

leechseedwand.lua
Lua:
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)
 
    function onGetFormulaValues(cid)
    percent = 3 -- this means the damage is 3% of the health of the target

    damage = -getCreatureMaxHealth(getCreatureTarget(cid))*(percent/100) 

    return damage, damage
    end
 
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
    setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
    setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)
 
    function onGetFormulaValues(cid)
    percent = 6 -- this means the damage is 3% of the health of the target, because it's on players
 
    damage = -getCreatureMaxHealth(getCreatureTarget(cid))*(percent/100) 

    return damage, damage
    end
 
    setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
function onUseWeapon(cid, var)
local target = getCreatureTarget(cid)
local percent = 3 -- this means the healing is 3% of the health of the target
local health = getCreatureMaxHealth(target)*(percent/100)
local monsters = {"Training Monk", "Squirrel"} -- add here the monsters you can't attack with this wand

if isPlayer(target) then
	doCreatureAddHealth(cid, health)
     	doSendAnimatedText(getPlayerPosition(cid),"+"..health.."", TEXTCOLOR_GREEN)
	doCombat(cid, combat2, var)
else
	for i, x in pairs(monsters) do
		if(getCreatureName(target)) == x then
			doPlayerSendCancel(cid, "You can\'t attack a "..getCreatureName(target).." with this wand.")
		return false
		end
	end 
	doCreatureAddHealth(cid, health)
    	doSendAnimatedText(getPlayerPosition(cid),"+"..health.."", TEXTCOLOR_GREEN)
	return doCombat(cid, combat, var)
end
end

Manadrain weapon

How does it work:
The target looses mana and the person who is using the weapon gets a part of this mana.
If the target doesn't have mana anymore, the manadrain and gain will stop untill the target has mana again.
For the rest it works like a normal weapon.​

manadrainweapon.lua
Lua:
        local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
 
	function onGetFormulaValues(cid, level, maglevel)
	min = -(maglevel*1) -level/5 -30
	max = -(maglevel*1) -level/5 -50
 
	return min, max
	end
 
	setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat2, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
 
function onUseWeapon(cid, var)
	local target = getCreatureTarget(cid)
	local min = getPlayerMagLevel(cid)+getPlayerLevel(cid)/5+30 -- should be the same as the min/max above
	local max = getPlayerMagLevel(cid)+getPlayerLevel(cid)/5+50
	local percent = 30 -- change here the % manadrain
	local addmana = math.random(min * 0.5 * (percent/100), max * 0.5 * (percent/100))
 	
 
    if getPlayerLevel(cid) >= 20 then
	if isPlayer(target) and getCreatureMana(target) >= 10 then
		doCombat(cid, combat, var)
		doCombat(cid, combat2, var)
        	doPlayerAddMana(cid, addmana)
        	doSendAnimatedText(getPlayerPosition(cid),"+"..addmana.."", TEXTCOLOR_LIGHTBLUE)
        	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
	else
        	doCombat(cid, combat2, var)
	end
    else
        doPlayerSendCancel(cid, 'You need level 20 to use this weapon.')
    end
end


Weapons with effects that get activated with a spell


On/Off
How does it work:
If you use the spell, you will see animated text in green with On, if you use the spell again, you see animated text in red with Off.
If the spell is on, the weapons change when you use them, if the spell is off, it will attack normal again.​


spells.xml
XML:
	<instant name="Weaponboost" words="boost" lvl="14" mana="60" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/spell.lua">
		<vocation id="1"/>
		<vocation id="2"/>
		<vocation id="3"/>
		<vocation id="4"/>
		<vocation id="5"/>
		<vocation id="6"/>
		<vocation id="7"/>
		<vocation id="8"/>
	</instant>
spell.lua
Lua:
function onCastSpell(cid, var)
local storage = 9810

	if(getPlayerStorageValue(cid, storage) == -1) then
		setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1)
        	doSendAnimatedText(getPlayerPosition(cid),"On", TEXTCOLOR_GREEN)
        	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN) 

	elseif(getPlayerStorageValue(cid, storage) == 0) then
		setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) - 1)
        	doSendAnimatedText(getPlayerPosition(cid),"Off", TEXTCOLOR_RED)
        	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED) 
	end
	return true
end
The same effect for every weapon in the script with 1 spell
If you want every weapon to have the same effect with 1 spell, you can do it like this (paralyze as example)
This will paralyze the target if people use the items in the list as long as the spell is on.

creaturescripts.xml
XML:
<event type="combat" name="Spell" event="script" value="paralyzeeffect.lua"/>
Add this to login.lua
Lua:
	registerCreatureEvent(cid, "Spell")
paralyzeeffect.lua
Lua:
    local condition = createConditionObject(CONDITION_PARALYZE)
    setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)
    setConditionParam(condition, CONDITION_PARAM_SPEED, -100)

function onCombat(cid, target)
local storage = 9810
local items = {2184, 2187, 7385} -- add here the weapons with the paralyze effect

	if(getPlayerStorageValue(cid, storage) == 0) then
		for i, x in pairs(items) do
			if(getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == x) or (getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == x) or (getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == x) then 
    				doTargetCombatCondition(0, target, condition, CONST_ME_STUN)
				doPlayerAddMana(cid, -20)
			end
		end
	end
	return true
end
Different effects for each weapon with 1 spell
If you do it like this, every weapon would have his own effect when the spell is on.
Back to weapons.xml

Explosion wand
This will create an explosion area while using the wand as long as the spell stays on.

explosionwand.lua
Lua:
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

    local area = createCombatArea({
	{0, 1, 1, 1, 0},
	{1, 1, 1, 1, 1},
	{1, 1, 3, 1, 1},
	{1, 1, 1, 1, 1},
	{0, 1, 1, 1, 0}
    })

    setCombatArea(combat, area)

    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*4) -level/5 
    max = -(maglevel*6) -level/5 

    return min, max
    end

    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

    local combat1 = createCombatObject()
    setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)

    local area = createCombatArea({
	{0, 0, 1, 1, 1, 0, 0},
	{0, 1, 0, 0, 0, 1, 0},
	{1, 0, 0, 0, 0, 0, 1},
	{1, 0, 0, 2, 0, 0, 1},
	{1, 0, 0, 0, 0, 0, 1},
	{0, 1, 0, 0, 0, 1, 0},
	{0, 0, 1, 1, 1, 0, 0}
    })

    setCombatArea(combat1, area)

    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*4) -level/5 
    max = -(maglevel*6) -level/5 

    return min, max
    end

    setCombatCallback(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
    setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
    
    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*4) -level/5 
    max = -(maglevel*6) -level/5
 
    return min, max
    end
 
    setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

    
function onUseWeapon(cid, var)
local storage = 9810

	if(getPlayerStorageValue(cid, storage) == -1) then
		doCombat(cid, combat2, var)
        else
		doPlayerAddMana(cid, -30)
		doCombat(cid, combat, var)
		doCombat(cid, combat1, var)
	end
	return true
end
For a certain time with attributes condition
How does it work:
If you use the spell, the weapon will hit more for 10 seconds.​

spell.lua
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000) -- time in seconds x1000
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
Boostwand.lua
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*2) -level/5
    max = -(maglevel*3) -level/5
 
    return min, max
    end
 
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*4) -level/5
    max = -(maglevel*6) -level/5
 
    return min, max
    end
 
    setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)

	if(getCreatureCondition(cid, CONDITION_ATTRIBUTES) == TRUE) then
        	doCombat(cid, combat2, var)
	else
        	doCombat(cid, combat, var)
        end
        return true
end
More types in 1 weapon
How does it work:
This allows a person to have more types (energy, death, poison, fire) in 1 weapon, each time you use the spell, it will switch to another type.​

spell.lua
Lua:
local t = {
	[1] = {type = "Death", color = TEXTCOLOR_GREY}, -- this is just the text someone gets, the real effect you have to change in the weapon.
	[2] = {type = "Poison", color = TEXTCOLOR_GREEN},
	[3] = {type = "Fire", color = TEXTCOLOR_RED},
	[4] = {type = "Energy", color = TEXTCOLOR_LIGHTBLUE}
}	

function onCastSpell(cid, var)
local xstorage = 9182
local storage = getPlayerStorageValue(cid, xstorage)
local items = {2184, 2187} -- add here the weapons with the mix effect

	for i, x in pairs(items) do
		if(getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == x) or (getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == x) then 

			if storage == -1 then
				setPlayerStorageValue(cid, xstorage, 1)
				storage = getPlayerStorageValue(cid, xstorage)
			end
 
			if t[storage] then
				setPlayerStorageValue(cid, xstorage, getPlayerStorageValue(cid, xstorage) + 1)
        			doSendAnimatedText(getPlayerPosition(cid),""..t[storage].type.."", t[storage].color)
        			doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN) 
 
			else
				setPlayerStorageValue(cid, xstorage, 1)
        			doSendAnimatedText(getPlayerPosition(cid),"Death", TEXTCOLOR_GREY)
				setPlayerStorageValue(cid, xstorage, getPlayerStorageValue(cid, xstorage) + 1)
        			doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN) 
			end
			return true
		else
			doPlayerSendCancel(cid, 'This spell has only effect if you use a mixwand.')
			return false
		end
	end
end
mixwand.lua
Lua:
    -- energy
    local combat1 = createCombatObject()
    setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
    setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
    setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
 
    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*4) -level/5 
    max = -(maglevel*6) -level/5
 
    return min, max
    end
 
    setCombatCallback(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
    
    -- death
    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
    setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS)
    setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)

    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*4) -level/5 
    max = -(maglevel*6) -level/5
 
    return min, max
    end
 
    setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

    -- poison
    local combat3 = createCombatObject()
    setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
    setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS)
    setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)
 
    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*4) -level/5 
    max = -(maglevel*6) -level/5
 
    return min, max
    end
   
    setCombatCallback(combat3, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

    -- fire
    local combat4 = createCombatObject()
    setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat4, COMBAT_PARAM_EFFECT, CONST_ME_FIREHIT)
    setCombatParam(combat4, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
 
    function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*4) -level/5 
    max = -(maglevel*6) -level/5
 
    return min, max
    end
 
    setCombatCallback(combat4, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local t = {
	[1] = {type = combat1}, -- energy, change the combat numbers to switch them
	[2] = {type = combat2}, -- death
	[3] = {type = combat3}, -- poison
	[4] = {type = combat4} -- fire
} 
 
function onUseWeapon(cid, var)
  
local storage = getPlayerStorageValue(cid, 9182)

	if t[storage] then
        	doCombat(cid, t[storage].type, var)
	else
        	doCombat(cid, combat1, var)
	end
	return true
end



Quest/VIP Weapons

1 quest or vip wand
This wand will hit more if you have vip or did a certain quest (depense on which storage you add).

vipwand.lua
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
 
function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*2) -level/5
    max = -(maglevel*3) -level/5
 
    return min, max
    end
 
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
 
function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*3) -level/5
    max = -(maglevel*4) -level/5
 
    return min, max
    end
 
    setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
function onUseWeapon(cid, var)
local storage = 12100 -- add here the storage from your vip system or quest
 
	if(getPlayerStorageValue(cid, storage) == -1) then
        	doCombat(cid, combat, var)
	else
        	doCombat(cid, combat2, var)
        end
        return true
end
Multiple questwand
The damage of this wand increases when you do quests, how more quests you do, how more the wand will hit.

questwand.lua
Lua:
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
 
    function onGetFormulaValues(cid, level, maglevel)
    n = 0
    for i= 5000,6000 do -- add here the storage from your quests. 5000,6000 means all storages between 5000 and 6000.
	if getPlayerStorageValue(cid, i) >= 1 then 
		n = n+1
	end
    end

    min = -(maglevel*2) -level/5 -(n*10) -- n stands for amount of quests, n*10 means: amount of quests x10 as extra damage.
    max = -(maglevel*3) -level/5 -(n*11)
 
    return min, max
    end
 
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
function onUseWeapon(cid, var)
	return doCombat(cid, combat, var)
end
 
Last edited:
OP
Limos

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
8
Reaction score
2,985
Location
Netherlands


Monster Weapons

Monsterwand
The damage of this wand increases when you kill certain monsters with that wand. You can change the monsters in the wandmonsters.lua.

creaturescripts.xml
XML:
<event type="kill" name="Wand" event="script" value="wandmonsters.lua"/>
Add this to login.lua
Lua:
	registerCreatureEvent(cid, "Wand")
wandmonsters.lua
Lua:
function onKill(cid, target)

local config = {
	["demon"] = {amount = 75, storage = 18000}, -- stor1 (in the weapon)
	["orshabaal"] = {amount = 45, storage = 18001}, -- stor2
	["morgaroth"] = {amount = 30, storage = 18002}, -- stor3
	["ghazbaran"] = {amount = 30, storage = 18003}, -- stor4
	["hellgorak"] = {amount = 30, storage = 18004}, -- stor5
	["apocalypse"] = {amount = 20, storage = 18005}, -- stor6
	["bazir"] = {amount = 15, storage = 18006}, -- stor7
	["infernatil"] = {amount = 10, storage = 18007} -- stor8
}

local monster = config[getCreatureName(target):lower()]
local items = {2184, 2187} -- add here the monster weapons

	if(isPlayer(target)) or not monster then
		return true
	end

	for i, x in pairs(items) do
		if(getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == x) or (getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == x) then 

			if getPlayerStorageValue(cid, monster.storage) >= -1 and (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount then	
				setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Wand upgrade message: "..(getPlayerStorageValue(cid, monster.storage)+1).." of "..monster.amount.." "..getCreatureName(target).."s killed.")
			end
			if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
				doPlayerSendTextMessage(cid, 22, "Congratulations, you have killed "..(getPlayerStorageValue(cid, monster.storage)+1).." "..getCreatureName(target).."s and reached the limit of upgrading your demon wand on "..getCreatureName(target).."s.")
				setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
			end
		end
	end
	return true
end
demonwand.lua
Lua:
 local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
 
    function onGetFormulaValues(cid, level, maglevel)
    local stor1, stor2, stor3, stor4, stor5, stor6, stor7, stor8 = getPlayerStorageValue(cid, 18000), getPlayerStorageValue(cid, 18001), getPlayerStorageValue(cid, 18002), getPlayerStorageValue(cid, 18003), getPlayerStorageValue(cid, 18004), getPlayerStorageValue(cid, 18005), getPlayerStorageValue(cid, 18006), getPlayerStorageValue(cid, 18007)
    local extradamage = stor1 +(stor2*2) +(stor3*3) +(stor4*3) +(stor5*3) +(stor6*4) +(stor7*4) +(stor8*5) -- stor8*5 means the amount of monsters you killed from stor8 x5 as extra damage

    min = -(maglevel*2) -level/5 -25 -extradamage
    max = -(maglevel*3) -level/5 -25 -extradamage
 
    return min, max
    end

    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
function onUseWeapon(cid, var)
	return doCombat(cid, combat, var)
end
Wand only for certain monsters
Idea by Luffy.
Certain monsters can only be killed with this wand and this wand will only have effect on those monsters.
If you want the wand to be able to attack all monsters, you can add a normal/other weapon in the creaturescripts lua script.
The idea behind this that people need a certain weapon to be able to kill a certain monster, for example boss monsters.

creaturescripts.xml
XML:
<event type="combat" name="Certainmonster" event="script" value="certainmonster.lua"/>
Add this to login.lua
Lua:
	registerCreatureEvent(cid, "Certainmonster")
certainmonster.lua
Lua:
function onCombat(cid, target)
local monsters = {"Demon Lord", "Squirrel"} -- add here the monsters you can attack with the certain weapons
local items = {2184, 2187, 7385} -- add here the weapons you can only kill the monsters with
 
	for i, x in pairs(monsters) do
		if(getCreatureName(target)) == x then
			for _, var in pairs(items) do
				if(getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == var) or (getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == var) then 
				        return true
				else
					doPlayerSendTextMessage(cid, 19, 'You can only attack this monster with a special weapon.')
					return false
				end
			end
		end
	end
	return true
end
certainmonsterwand.lua
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
 
function onGetFormulaValues(cid, level, maglevel)
    min = -(maglevel*2) -level/5 -20
    max = -(maglevel*3) -level/5 -30
 
    return min, max
    end
 
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
 
function onUseWeapon(cid, var)
local target = getCreatureTarget(cid)
local monsters = {"Demon Lord", "Squirrel"} -- add here the monsters you can attack with this wand
 
	for i, x in pairs(monsters) do
		if(getCreatureName(target)) == x then
        		doCombat(cid, combat, var)
		else
        		doCombat(cid, combat2, var)
			doPlayerSendCancel(cid, "This wand doesn\'t seem to have effect on this creature.")
		end
	end
	return true
end


If you want to make a request for a weapon, you can leave a commant or send me a pm.
Some weapons are only made as wands or normal weapons, if you want a wand or normal weapon version of a weapon, just ask.
Also let me know if you have any questions or bugs.

Note: Because of the animated text, most of the scripts won't work on client 9.1+ servers. You can remove it or ask me for a 9.1+ version.
 
Last edited:

Codinablack

Dreamer
Joined
Dec 26, 2013
Messages
1,216
Best answers
4
Reaction score
378
Is it possible to use a wildcard for the creatures name so that it can be any creature that counts for the kills in the Monsterwand?
 

saimon

New Member
Joined
Jul 9, 2015
Messages
12
Best answers
0
Reaction score
0
Impossible!

Thanks :)

I need help to make my arrow hit like 5000000 and when i got distance skillz hit harder . if you know how to make it .. help ,please :)
 

Robxxxx

New Member
Joined
Aug 28, 2015
Messages
18
Best answers
0
Reaction score
0
In case it helps anyone heres all meelee weapon id numbers for a normal tibia list (ie none of these have been modified)

2377,2379,2383,2384,2385,2390,2392,2393,2395,2396,2397,2400,2403
2404,2405,2406,2407,2408,2409,2411,2412,2413,2418,2419,2420,2442,2438,2446,2450,2451,6528,7382,7383,7384,7385,7386,7390,7391,7402,
7403,7404,7405,7406,7407,7408,7416,7418,7419,7420,7449,8930,8602,
8931,8932,2391,2394,2398,2401,2416,2417,2421,2422,2423,2424,2434,2436,2437,2439,2444,2445,2448,2449,2452,2453,3961,3966,7379,7381,
7387,7392,7437,7450,7451,7452,7410,7414,7415,7422,70000;7424,7425
7426,7428,7429,7430,7431,7432,8927,8928,8929,2378,2380,2381,2387,2388,2314,2415,2425,2426,2427,2428,2429,2430,2431,2432,2435,2440,
2441,2443,2447,2454,3962,6553,7380,7388,7389,7411,7412,7413,7453,
7454,7455,7433,7434,7435,7436,8926
 

klarkarak

New Member
Joined
Nov 19, 2011
Messages
4
Best answers
0
Reaction score
0
is there a script for a bolt or arrow, that deal a multiple shoots, not an area, just different target at the same time?
 

lukatxd

Member
Joined
Dec 9, 2010
Messages
50
Best answers
0
Reaction score
24
Is it possible to add area of effect to a sword, based on player vs. monster position? The idea is to add an exori min effect.

ie: If monster is to the right

0,0,1
0,3,1 <monster here
0,0,1

if monster is below
0,0,0,
0,3,0
1,1,1
^monster in the middle
 
Last edited:
Top