• 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!

[SOLVED] Drowning Wand. (LUA)

Exoltes

Novia OTserv Developer
Joined
Jul 2, 2009
Messages
563
Reaction score
47
Location
Belgium
I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).

I was trying to make a drowning wand, since I'm using drowning as a new player element. But the weapons.xml file does not recognize anything related to drowning. (it only recognizes: earth, ice, energy, fire, death and holy)

So I will be needing a .lua script to make this wand.

The following parameters are the ones i use related to drowning within my runes already.
Code:
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DROWNDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_TELEPORT)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

So if anyone, with the right knowledge, finds some spare time to fix this. Then I would be very grateful.

Thanks in advance.
 
You can do it the same way as a spell but then instead of onCastSpell, use
Code:
function onUseWeapon(cid, var)
In weapons.xml, instead of function, use script for the Lua script.
 
got the effects, just the dmg is not working.

Server\data\weapons\weapons.xml
Code:
<!-- Moonlight -->
    <wand id="7424" level="20" mana="5" min="20" max="40" script="moonlight.lua"> <!-- Lunar Staff -->
        <vocation name="Fire Mage"/>
        <vocation name="Energy Mage"/>
    </wand>
    <wand id="7409" level="100" mana="15" min="55" max="75" script="moonlight.lua"> <!-- Imaginary Staff -->
        <vocation name="Fire Mage"/>
        <vocation name="Energy Mage"/>
    </wand>
    <wand id="2453" level="150" mana="20" min="90" max="120" script="moonlight.lua"> <!-- Arcane Staff -->
        <vocation name="Fire Mage"/>
        <vocation name="Energy Mage"/>
    </wand>

Server\data\weapons\scripts\moonlight.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DROWNDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_TELEPORT)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

function onUseWeapon(cid, var)
    return doCombat(cid, combat, var)
end
 
You didn't added damage.
Code:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1.5, -30, -1.5, -50)
The min max won't work if you use a Lua script.
 
yea, because I have the dmg within the weapons.xml file.

So you are saying i need to make a separate script for each wand?
 
Will it still recognize the level from within the 'weapons.xml' or do i need to add that in the separate script as well?

Also using the following code
Code:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1.5, -30, -1.5, -50)
it will change dmg according to the magic level instead of giving static dmg like all other wands.
 
Last edited:
Yes, just the damage and type should be done in Lua.
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DROWNDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_TELEPORT)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

function onGetFormulaValues(cid, level, maglevel)
     min = 60
     max = 70
     return -min, -max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
   return doCombat(cid, combat, var)
end
You can also do it like this, here you can do the damage like normal wands, or you can also add damage based on ml and lvl.
 
Back
Top