• 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 - 4 Effekts

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,249
Solutions
71
Reaction score
621
Location
Hell
EDIT: I Only called one combat and it didn't give any errors, how Do I make it use multiple combats without causing any errors?

——————————————
I have (tried to make) made a custom wand which shoots 4 effekts at once.
After registering the wand and restarting the server, i get an error on console which does not tell me which file is causing the error - if I use the wand.

btw, @Cykotitan has told me that it was calling a function with a NIL value.

Code:
[23:2:42.380] [Error - Weapon Interface]
[23:2:42.380] (Unknown script file)
[23:2:42.380] Description:
[23:2:42.380] attempt to call a nil value

weapons.xml
Code:
        <wand id="2363" level="8" mana="20" event="script" value="donate_wand.lua">
                <vocation id="1"/>
                <vocation id="2"/>
                <vocation id="5"/>
                <vocation id="6"/>
        </wand>
items.xml
Code:
<item id="2363" article="a" name="Purelava Wand">
                <attribute key="weight" value="150" />
                <attribute key="weaponType" value="wand" />
                <attribute key="shootType" value="smallearth" />
                <attribute key="range" value="8" />
        </item>


Code:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 39)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 30)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 37)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, 35)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 17)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, 31)

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

function onGetFormulaValues(cid, level, maglevel)
    min = 700000
    max = 1000000
    return -min, -max
end

setCombatCallback(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat3, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
        doCombat(cid, combat1, var)
        doCombat(cid, combat2, var)
        doCombat(cid, combat3, var)
        doCombat(cid, combat, var)
        return TRUE
end
 
Last edited:
wh
EDIT: I Only called one combat and it didn't give any errors, how Do I make it use multiple combats without causing any errors?

——————————————
I have (tried to make) made a custom wand which shoots 4 effekts at once.
After registering the wand and restarting the server, i get an error on console which does not tell me which file is causing the error - if I use the wand.

btw, @Cykotitan has told me that it was calling a function with a NIL value.

Code:
[23:2:42.380] [Error - Weapon Interface]
[23:2:42.380] (Unknown script file)
[23:2:42.380] Description:
[23:2:42.380] attempt to call a nil value

weapons.xml
Code:
        <wand id="2363" level="8" mana="20" event="script" value="donate_wand.lua">
                <vocation id="1"/>
                <vocation id="2"/>
                <vocation id="5"/>
                <vocation id="6"/>
        </wand>
items.xml
Code:
<item id="2363" article="a" name="Purelava Wand">
                <attribute key="weight" value="150" />
                <attribute key="weaponType" value="wand" />
                <attribute key="shootType" value="smallearth" />
                <attribute key="range" value="8" />
        </item>


Code:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 39)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 30)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 37)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, 35)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 17)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, 31)

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

function onGetFormulaValues(cid, level, maglevel)
    min = 700000
    max = 1000000
    return -min, -max
end

setCombatCallback(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat3, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
        doCombat(cid, combat1, var)
        doCombat(cid, combat2, var)
        doCombat(cid, combat3, var)
        doCombat(cid, combat, var)
        return TRUE
end
why not just use 1 combat and senddistanceeffect for all 4 effects?
 
Back
Top