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

Exeta res

Kjhgfd

New Member
Joined
Dec 25, 2016
Messages
63
Reaction score
1
hello guys i wana ask for spell like exeta res but when use this spell on ranger monster like orc spearman and elf and elf arcanist and hunter change attack type to normal monster like any monster

tfs 0.4
 
A way to achieve this is creating melee-only variants and summoning them with the current monster's health, so it's going to take a little bit of work from your part.

Spell:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onTargetCreature(cid, target)
    local rangedCreatures = {"orc spearman","elf"}
 
    if isInArray(rangedCreatures, getCreatureName(target)) then
        local name = "" .. getCreatureName(target) .. " melee"
        local pos = getCreaturePosition(target)
        local maxhealth = getCreatureMaxHealth(target)
        local health = getCreatureHealth(target)
        local damage = maxhealth - health

        doRemoveCreature(target)
        local meleeCreature = doSummonCreature(name,pos)
        doCreatureAddHealth(meleeCreature,-damage)
        return doChallengeCreature(cid, meleeCreature)
    else
        return doChallengeCreature(cid, target)
    end
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(cid, var)
 
    return doCombat(cid, combat, var)
end

Copy an existing ranged monster (orc spearman for example) and change the <flag targetdistance="4"/> to <flag targetdistance="1"/> and delete his spear attack.
Save it as:
Code:
orc spearman melee.xml

Add it to monsters.xml:
Code:
<monster name="Orc Spearman Melee" file="Orcs/orc spearman melee.xml"/>

Repeat for as many monsters as you desire, making sure you add the word "melee" after their file name, aswell as adding them to the rangedCreatures array in the spell.
 
Last edited:
Back
Top