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

Spell Sword Throwing Spell †

Alehopper

†C++|C#|Java†
Joined
Jun 25, 2011
Messages
325
Reaction score
17
Location
Poland
Sword Throwing Spell
simple spell for a knights & elite knights
____________________________________________________________________

Player throw to target own weapons dealing a physicial damage and stun (exhausted, muted and can't move) target for 1.5 seconds.
  • [*=1]Damage: from (skill + attack) / 3 + (level / 5) to (skill + attack) + (level / 5)[*=1]Duration: 1,5 seconds
    [*=1] Cooldown: 8 seconds[*=1]Mana: 60 points
____________________________________________________________________

przechwytywaniedb.png


____________________________________________________________________

-- <?xml version="1.0" encoding="UTF-8"?>/mods/filename.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Sword Throwing Spell" version="14-07-11" author="Alehopper" contact="otland.net" enabled="yes">

    <instant name="Sword Throwing" words="exori ani" lvl="20" mana="60" prem="1" range="3" needtarget="1" blockwalls="1" needweapon="1" exhaustion="8000" needlearn="0" event="script" value="sword throwing.lua">
        <vocation id="4"/>
        <vocation id="8"/>
    </instant>
    
</mod>
/mods/scripts/sword throwning.lua
Code:
[SIZE=3]-- <?xml version="1.0" encoding="UTF-8"?>[/SIZE]
-- <mod name="Sword Throwing Spell" version="14-07-11" author="Alehopper" contact="otland.net" enabled="yes">


    -- Create a combat object with params
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE,             COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_USECHARGES,     true)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
    
    -- Create a condition, which add to player/monster muted.
    local conditionMuted     = createConditionObject(CONDITION_MUTED)
    setConditionParam(conditionMuted,     CONDITION_PARAM_TICKS, 1500)
    local conditionExhaust     = createConditionObject(CONDITION_EXHAUST)
    setConditionParam(conditionExhaust, CONDITION_PARAM_TICKS, 1500)
    
    -- Create a formula for early created combat object
    function onGetFormulaValues(cid, level, skill, attack, factor)
        local skillTotal, levelTotal = skill + attack, level / 4.5
        return -(skillTotal / 2.5 + levelTotal), -(skillTotal + levelTotal)
    end
    setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


    -- Function, which a set a stun and teleport player to monster.
    function onCastSucces(cid, var, finish)
        local target = variantToNumber(var)
        if (not isCreature(target)) then
        elseif (finish) then
            doCreatureSetNoMove(target, false)
            for _, condition in ipairs({conditionMuted, conditionExhaust}) do
                doAddCondition(cid, condition) end
        else
            doCreatureSetNoMove(target, true)
            addEvent(onCastSucces, 1500, cid, var, true)
        end
        return true
    end
    
    -- Main functions
    function onCastSpell(cid, var)
        return doCombat(cid, combat, var) and addEvent(onCastSucces, 0, cid, var, false)[INDENT]    end[/INDENT]


____________________________________________________________________











Regards,
Alehopper~~

 
Last edited:
Thanks for comments. I introduce change to script, when somebody downloaded last version - i advise to upgrade.
 
Here it shows:
[luaDoCreatureSetNoMove] Creature not found.

Can you help me?
 
Back
Top