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

Constant AoE around player when equip armor

Doitforthegains

Well-Known Member
Joined
Aug 30, 2014
Messages
231
Reaction score
74
I'm using TFS 1.1 client 10.41 and the idea is to replicate Sunfire cape from Leauge of Legends...
I'm not sure if it's possible but it would be neat to equip lets say a DSM, and as long as you wear it (or even better as long as you're inCombat with the DSM equipped) you would have a constant area of effect (firearea) around you in 2second intervals doing a flat rate of damage.
I don't know what kind of script it would take to do this, I triedmaking dsm a weapon that u can wear and giving it an onUse function to start casting at intervals when used..however I'm a super noob and can't get anything to work.
 
@Doitforthegains
Something like this? Now i made this on 0.3.6 so you will need to change stuff..
Y2GEtcM.jpg

3xfMyEr.jpg

dTAFEXU.jpg
 
I did it the cheap way :( made it cast spell making it have formula and the damage increases
Code:
local t = {
   -- WORD | ARMOR ID | EFFECT # --
    {"EXPLOSION", 2463, 29}
}

function onThink(interval)
    for _, cid in ipairs(getPlayersOnline()) do
        for i = 1, #t do
            if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == t[i][2] then
        doCreatureSay(cid, t[i][1], TALKTYPE_ORANGE_1)
        doCreatureCastSpell(cid, "Berserk")
            end
        end
    end
    return true
end
 
It is very simple!!!!!! no globalevents
Spells + Movements

onEquip armor, say the spell words
onDequip armor, say the spell words again to cancel
In the movement script a storage

In the spell check if player has the storage (players cant cast using the words)
if -1 then return false
if 1 then doCombat [setStorage(2)]
if 2 then stopLoopEvent (cancel the spell)


LOVED it!
 
Why would you use global event for a player? Just use onThink creaturescript

Yeah, you're right, that's even better.

OP, try this:

In creaturescripts.xml add:
Code:
<event type="think" name="SunfireCape" event="script" value="sunfirecape.lua"/>

In creaturescripts/scripts/ make a script called sunfirecape.lua:
Code:
function onThink(cid)

-- CONFIG --
-- ID of sunfire cape:
local sunfirecape = 5555
-- ID of effect to be displayed:
local eff = 6
-- Define area of effect here:
local arr ={
{1,1,1},
{1,3,1},
{1,1,1}
}
-- Minimum and maximum damage:
local min = 10
local max = 20
------------
if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == sunfirecape then
doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, getThingPos(cid), arr, -min, -max, eff)
end

return true
end

And in creaturescripts/scripts/login.lua add:
Code:
 registerCreatureEvent(cid, "SunfireCape")
 
Yeah, you're right, that's even better.

OP, try this:

In creaturescripts.xml add:
Code:
<event type="think" name="SunfireCape" event="script" value="sunfirecape.lua"/>

In creaturescripts/scripts/ make a script called sunfirecape.lua:
Code:
function onThink(cid)

-- CONFIG --
-- ID of sunfire cape:
local sunfirecape = 5555
-- ID of effect to be displayed:
local eff = 6
-- Define area of effect here:
local arr ={
{1,1,1},
{1,3,1},
{1,1,1}
}
-- Minimum and maximum damage:
local min = 10
local max = 20
------------
if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == sunfirecape then
doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, getThingPos(cid), arr, -min, -max, eff)
end

return true
end

And in creaturescripts/scripts/login.lua add:
Code:
 registerCreatureEvent(cid, "SunfireCape")
Yeah i never thought that threw i guess :) good job
 
Tested that, it works:

KPmb70i.gif


I also made a cooldown so that it doesn't spam so fast like this (if you wanna use that):

Code:
function onThink(cid)

-- Cooldown (in seconds):
local cooldown = 1

        if not(exhaustion.check(cid,25372)) then
        exhaustion.set(cid, 25372, cooldown)
        else
        return false
        end
       
-- CONFIG --
-- ID of sunfire cape:
local sunfirecape = 11432

-- ID of effect to be displayed:
local eff = 454
-- Define area of effect here:
local arr ={
{1,1,1},
{1,2,1},
{1,1,1}
}
-- Minimum and maximum damage:
local min = 10
local max = 20
------------
if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == sunfirecape then
doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, getThingPos(cid), arr, -min, -max, eff)
end

return true
end
 
if you want it to just cast a spell here.
Credits: @Shadowsong :D
Code:
function onThink(cid)

local cooldown = 1

if not(exhaustion.check(cid,25372)) then
exhaustion.set(cid, 25372, cooldown)
else
return false
end

-- CONFIG --
-- ID of sunfire cape:
local sunfirecape = 5555
-- Name of spell:
local spellname = exori
-- Animated Message:
local message = "passive: berserk"

if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == sunfirecape then
doCreatureCastSpell(cid, spellname)
doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
end

return true
end
 
Urgh?

Code:
local config = {
    minDmg = 5,
    maxDmg = 10,
    itemId = 2463
}

local area = createCombatArea{
    {1, 1, 1},
    {1, 3, 1},
    {1, 1, 1}
}

local function sendDealingDamage(cid)
    local player = Player(cid)
    if not player then
        return
    end

    local armorSlot = player:getSlotItem(CONST_SLOT_ARMOR)
    if not armorSlot or armorSlot.itemid ~= config.itemid then
        return
    end

    doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, player:getPosition(), area, -config.minDmg, -config.maxDmg, CONST_ME_FIREAREA)
    addEvent(sendDealingDamage, 1000, cid)
end

function onEquip(player, item, slot)
    sendDealingDamage(player.uid)
    return true
end
 
First of all let me thank you all for taking your time to work on this, awesome job! Now I tried installing it with the instructions that Shadow Song posted and I had some issues. When I add this
Code:
registerCreatureEvent(cid, "SunfireCape")
to my login.lua I get this error when logging in to a char:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/others/login.lua:onLogin
data/creaturescripts/scripts/others/login.lua:62: attempt to call method 'regist
erCreature' (a nil value)
stack traceback:
        [C]: in function 'registerCreature'
        data/creaturescripts/scripts/others/login.lua:62: in function <data/crea
turescripts/scripts/others/login.lua:46>
I'm sure this is because of compatibility issues but I don't know how to fix it :/ Also if someone can explain or has a link to a thread that explains how compat.lua works that would be helpful..I call my compat.lua with dofile('data/compat.lua') but it doesn't seem to change anything.
Any ideas on how to solve my error? @Shadowsong @Printer
 
Ahh, sorry, yes. I've mistaken you for another person, though you weren't OP.
Well yes, in that case some things need to be changed from 0.3.6 to 1.0 style since 1.0 uses some different methods in lua. Unfortunately, I never scripted with 1.0 so I don't know how to write for 1.0. See if someone else can do it. :|
 
Back
Top