• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Constant AoE around player when equip armor

Doitforthegains

Well-Known Member
Joined
Aug 30, 2014
Messages
232
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.
 
Okay so I thought I had figured it out, but nothing is happening when I equip the armor...here's my movements.xml input and the onEquip script @Printer made:
Code:
<movevent event="Equip" itemid="2492" slot="armor" script="sunfirecape.lua"/> <!--DSM-->
<movevent event="DeEquip" itemid="2492" slot="armor" script="sunfirecape.lua"/>
and
Code:
local config = {
    minDmg = 5,
    maxDmg = 10,
    itemId = 2492
}

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, 2000, cid)
end

function onEquip(player, item, slot)
    sendDealingDamage(player.uid)
    return true
end
I don't know what else to do..
EDIT: I also tried what @Shadowsong posted after fixing the registerEvent and nothing happens as well..I must be doing something wrong. :/
 
Last edited:
if not armorSlot or armorSlot.itemid ~= config.itemId then

Also replace the function onEquip with this
Code:
function onEquip(player, item, slot)
    local armor = player:getSlotItem(slot)
    if not armor or armor.itemid ~= item.itemid then
        return true
    end

    sendDealingDamage(player.uid)
    return true
end
 
Update: Only one issue I'm having is when you equip the armor, de-equip and then re-equip it, it does the AoE 2x per interval..Other than that the script works wonderfully :D
 
thank you all for taking your time to work on this, awesome job! Now I tried installing it with the instructions
@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

Sorry, completely off topic, but could you tell me where to find the formula you used to calculate the dps?
 
@Shadowsong Does this help any?
Code:
function getBooleanFromString(input)
     local tmp = type(input)
     if tmp == 'boolean' then
         return input
     end

     if(tmp == 'number') then
         return input > 0
     end

     local str = string.lower(tostring(input))
     return (str == "yes" or str == "true" or (tonumber(str) ~= nil and tonumber(str) > 0))
end

@Codinablack in the creature script
Code:
local config = {
minDmg = 5,
maxDmg = 10,
itemId = 2492
}
Unless you're trying to use a formula that scales, I haven't figured that out yet..
 
@Shadowsong Does this help any?
Code:
function getBooleanFromString(input)
     local tmp = type(input)
     if tmp == 'boolean' then
         return input
     end

     if(tmp == 'number') then
         return input > 0
     end

     local str = string.lower(tostring(input))
     return (str == "yes" or str == "true" or (tonumber(str) ~= nil and tonumber(str) > 0))
end

@Codinablack in the creature script
Code:
local config = {
minDmg = 5,
maxDmg = 10,
itemId = 2492
}
Unless you're trying to use a formula that scales, I haven't figured that out yet..

Oh, nah, I meant that he could make a storage on equip/de-equip that would regulate this effect.
Like in 0.3.6 you have getPlayerStorageValue(cid, storage) / setPlayerStorageValue(cid, storage,value). You can make it so once you equip the item, it sets some storage to value 1, and the next time it tries to apply this effect, if that storage is equal to 1 - the script will return false so that the effect is not applied multiple times.
 
Still having issues with the passive stacking. @RosOT and I (99% him) just spent like an hour trying to figure it out to no avail.. @Shadowsong I'd try the storagevalue if I knew how to script it :/ that could be the answer to my problem but I don't know how to make it..
 
Back
Top