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

Lua Custom wand does no damage

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
Here is the wand in weapons.xml

Code:
	<wand id="2453" level="80" mana="10" type="energy" function="script" script="spritewand.lua">
		<vocation name="Druid"/>
		<vocation name="Elder Druid" showInDescription="0"/>
		<vocation name="Sorcerer"/>
		<vocation name="Master Sorcerer" showInDescription="0"/>
	</wand>

And I did delete the club weapon 2453 down at the bottom of the script

Here is the script for the wand

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 0)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_LARGEROCK)

function onGetFormulaValues(cid, level, maglevel)
	local min = (((level/20)+(maglevel*.9)))
	local max = (((level/10)+(maglevel*1.2)))
	return -min, -max
end

function onUseWeapon(cid, var)
	if not doCombat(cid, combat, var) then
		return false
	end
end

When I use it, it just does no damage at all, how do I fix this?
 
what for versision you use ? 8.60

- - - Updated - - -

This in wepons.xml oki
PHP:
	<wand id="here your wand id" level="50" mana="30" min="700" max="800" type="here effect you want" event="function" value="default"> <!-- your wand name here -->
		<vocation id="2"/>
		<vocation id="1"/>
	</wand>

after go to items / items.xml and search your wand id or name and

PHP:
	<item id="here your wand id" article="a" your wand name here ">
		<attribute key="weight" value="2900"/>
		<attribute key="weaponType" value="wand"/>
		<attribute key="shootType" value="here effect you want"/>
		<attribute key="range" value="5"/>
	</item>

Now Test :) can 1 more tips to you for make custom wand

- - - Updated - - -

Or test this


PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_LARGEROCK)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, -400, 0, -800)

function onUseWeapon(cid, var)
	return doCombat(cid, combat, var)
end
 
Last edited:
Code:
local min = [COLOR="#FF0000"][B]-[/B][/COLOR](((level/20)+(maglevel*.9)))
local max = [COLOR="#FF0000"][B]-[/B][/COLOR](((level/10)+(maglevel*1.2)))
 
yes, here is what it looks like in weapons.xml

Code:
	<wand id="2453" level="80" mana="10" type="energy" function="script" script="spritewand.lua">
		<vocation name="Druid"/>
		<vocation name="Elder Druid" showInDescription="0"/>
		<vocation name="Sorcerer"/>
		<vocation name="Master Sorcerer" showInDescription="0"/>
	</wand>

Did I miss something, do I need to put some type of formula in this part of the script?
 
I don't believe, with custom scripted wands, that you put a damage "type" within the xml, you put it within the script. I -could- be wrong, because I've been for quite a while, but I suspect this will work.

Also, to be honest, I don't -believe- that the wand parameter will stand due to it having a script, but I may be over-reaching, so leave it for now.


LUA:
    <wand id="2453" level="80" mana="10" function="script" script="spritewand.lua"> 
       <vocation name="Druid"/> 
       <vocation name="Elder Druid" showInDescription="0"/> 
       <vocation name="Sorcerer"/> 
       <vocation name="Master Sorcerer" showInDescription="0"/> 
   </wand>
 
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 0)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_LARGEROCK)

function onGetFormulaValues(cid, level, maglevel)
	local min = - (getPlayerLevel(cid) * 0.20) + getPlayerMagLevel(cid) * 0.9)
	local max = -(getPlayerLevel(cid) * 0.40) + getPlayerMagLevel(cid) * 1.2)
	return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
	return doCombat(cid, combat, var)
end
 
Last edited:
Well it's finally doing something now, and that something is healing the monster that you attack it with. I tried removing the minus symbols from the min and max formulas but it still just healed the monster.
 
LUA:
function onGetFormulaValues(cid, level, maglevel)
	local min = level * 0.2 + maglevel * 0.9
	local max = level * 0.4 + maglevel * 1.2
	return -min, -max
end
 
Back
Top