• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Spell Commander Spell tfs1.2

lokolokio

Well-Known Member
Joined
Jan 7, 2009
Messages
201
Solutions
13
Reaction score
78
Location
Mexico
Regards OT Landers i made this script for fun in the server, Im without internet because the rain, and I start to create a commander script I hope you like it.

Video Example:

Add this to 'data/spells/spells.xml'
Code:
<instant name="commander challenge" words="###500" direction="0" aggressive="1" blockwalls="1" needtarget="0" needlearn="1" script="monster/commander challenge.lua" />

Create a file called 'commander challenge.lua' inside of 'data/spells/scripts/monster/' and add this:
Code:
function selectBestTarget(creature)
    local t = creature:getTargetList()
    local l = {}  
    for i = 1, #t do
        local c = t[i]
        local h = Creature(c)
        if(h:getHealth()/h:getMaxHealth()*100 <= 60)then
            table.insert(l, h.uid)
        end
    end
    if isCreature(l[1]) then
        creature:selectTarget(l[1])
    end
end
function onCastSpell(creature, var)
    selectBestTarget(creature)
    local l = creature:getFriendList()
    local f = {}
    local t = creature:getTarget()
    local k = Creature(t)
    for i = 1, #l do
        local c = l[i]
        if(c:getName() == "Amazon")then
            table.insert(f, c.uid)
            l[i]:selectTarget(k)
        end
    end
    return creature:say("Let's Kill " .. k:getName() .. "!", TALKTYPE_ORANGE_1)
end

and on the monster you want to add it, just add this line on attacks:

Code:
<attack name="amazon challenge" interval="4000" chance="100"/>

Of course you can put the interval you want, I put it on each 4s to make the video :D Hope enjoy it!!
 
Back
Top Bottom