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

Trapped floor tile tfs 1.4.2

TheoldSchoolWay

New Member
Joined
Nov 27, 2022
Messages
5
Reaction score
1
Im trying to make a trapped tile. Simply, if you step in it, a spell goes off (like energy beam/wave). Im new to all of this but it seems i need to use sendmagiceffect() as well as dotargetcombathealth(). The problem im having is that i cant find any documentation on how to do this. The docs im using are LuaScript Interface - OTS Guide (https://docs.otland.net/ots-guide/tfs-documentation/luascript-interface) and Script Interface · otland/forgottenserver Wiki (https://github.com/otland/forgottenserver/wiki/Script-Interface) . There seems to be no entry at all for dotargetcombathealth specifically.

Is it possible to cast an instant spell like energy beam without a caster(player)?
Are there other docs I should be aware of?

I have several other questions that arent related to scripting. I might as well ask on the off chance a simple answer is at hand.

Is it possible to change regen speed(hp/mana) without recompiling the server, like is it in a config somewhere?
Is it possible to change the "look" text of an item? (You see a floor tile. It appears to be trapped) -preferably only when you are on an adjacent tile.
I have the server, the client, and rmemeres map editor. Is there some item/npc editing software that works with tfs 1.4.2./10.98?

Any better guide/docs pertaining to tfs would be appreciated. Thanks in advance for any help.
 
Im trying to make a trapped tile. Simply, if you step in it, a spell goes off (like energy beam/wave). Im new to all of this but it seems i need to use sendmagiceffect() as well as dotargetcombathealth(). The problem im having is that i cant find any documentation on how to do this. The docs im using are LuaScript Interface - OTS Guide (https://docs.otland.net/ots-guide/tfs-documentation/luascript-interface) and Script Interface · otland/forgottenserver Wiki (https://github.com/otland/forgottenserver/wiki/Script-Interface) . There seems to be no entry at all for dotargetcombathealth specifically.

Is it possible to cast an instant spell like energy beam without a caster(player)?
Are there other docs I should be aware of?

I have several other questions that arent related to scripting. I might as well ask on the off chance a simple answer is at hand.

Is it possible to change regen speed(hp/mana) without recompiling the server, like is it in a config somewhere?
Is it possible to change the "look" text of an item? (You see a floor tile. It appears to be trapped) -preferably only when you are on an adjacent tile.
I have the server, the client, and rmemeres map editor. Is there some item/npc editing software that works with tfs 1.4.2./10.98?

Any better guide/docs pertaining to tfs would be appreciated. Thanks in advance for any help.
Lua:
function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() then
        -- Send magic effect to the player to indicate that the spell has been cast
        creature:sendMagicEffect(CONST_ME_ENERGYHIT)
        
        -- Use doTargetCombatHealth to deal damage to the player
        creature:doTargetCombatHealth(0, -100, CONST_ME_ENERGYHIT)
    end
    return true
end
This script will send an energy hit magic effect to the player and deal 100 points of damage to the player when they step on the trapped tile. You can customize the magic effect and the amount of damage dealt by using different constants and values in the sendMagicEffect and doTargetCombatHealth functions.
 
Im guessing for something like an energy beam or wave i actually need to call sendMagicEffect from a tile or tiles(for a beam)? Is there somewhere i can read about doTargetCombatHealth. I can guess the second param is the damage and 3rd is type, what is the first(0)?
 
doTargetCombatHealth
That is a compat.lua function, Main function can be found here.
Lua:
doTargetCombat(cid, target, type, min, max, effect[, origin = ORIGIN_SPELL[, blockArmor = false[, blockShield =
    // false[, ignoreResistances = false]]]])
Im guessing for something like an energy beam or wave i actually need to call sendMagicEffect from a tile or tiles(for a beam)?

You can try using this part taken from here, To send magic effect on more tiles.
Lua:
local effects = {
    {fromPosition = Position(32526, 32536, 12), toPosition = Position(32526, 32539, 12), effect = CONST_ME_ENERGYHIT}
}

for i = 1, #effects do
    local settings = effects[i]
    fromPosition = settings.fromPosition
    toPosition = settings.toPosition
    if settings.effect then
        for y = fromPosition.y, toPosition.y do
            local newPosition = Position(fromPosition.x, y, fromPosition.z)
            newPosition:sendMagicEffect(settings.effect)
 
Last edited:
Back
Top