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

TFS 1.X+ War Mine TFS 1.5

Izaack

Member
Joined
Jun 18, 2012
Messages
70
Solutions
1
Reaction score
17
Location
México
Hello friends of Otland, I am starting to do scripts, I am currently making a war mine, I have two questions
The first: how can I make the item only activate on the floor?
The second: how can I make the damage when stepped on if the player has utamo vita lower his mana first. Here is a gift of how I have the script so far.


2023-08-06 00-04-47.gif

My Actions
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

if player:getItemCount(2346) >= 1 then
player:sendCancelMessage("no puedes usarlo.")
return false
end

if not player:getTile():hasFlag(TILESTATE_PROTECTIONZONE) then
if player:getLevel() >= 10 then
Game.createItem(6299, 1, item:getPosition())
item:remove(1)
return true
end

   player:sendCancelMessage("You can't do it without be in a protection zones.")
    return true
end

end

My Movements
Lua:
function onStepIn(creature, item, position, fromPosition)
if item:getId() == 6299 then
creature:addHealth(-150)
item:remove(1)
end
return true
end

Thank you for your attention, I hope you can help me.
 
Solution
E
try:
Lua:
function onStepIn(creature, item, position, fromPosition)
    if creature:isMonster() or creature:isPlayer() then
        doTargetCombat(0, creature, COMBAT_PHYSICALDAMAGE, 150, 150, CONST_ME_EXPLOSIONAREA)
    end

    item:remove(1)
    return true
end

item id check is not necessary as you already registered the item id in movements.xml
Last edited by a moderator:
with this script you can get an answer to both questions:

1. if else block from line 2 to line 10

2. line 9
Lua:
// doTargetCombat(cid, target, type, min, max, effect[, origin = ORIGIN_SPELL[, blockArmor = false[, blockShield = false[, ignoreResistances = false]]]])
Thanks brother, but how do I now do the damage from the crack when they step on it? If the player has utamo vita, first I lower the life and then the mana.
the action only gives the damage if you use it in the backpack to the same player.
 
this error when stepping on the crack does not do the damage
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/mina.lua:eek:nStepIn
LuaScriptInterface::luaDoTargetCombat(). Creature not found
stack traceback:
[C]: in function 'doTargetCombat'
data/movements/scripts/mina.lua:6: in function <data/movements/scripts/mina.lua:3>
 
try:
Lua:
function onStepIn(creature, item, position, fromPosition)
    if creature:isMonster() or creature:isPlayer() then
        doTargetCombat(0, creature, COMBAT_PHYSICALDAMAGE, 150, 150, CONST_ME_EXPLOSIONAREA)
    end

    item:remove(1)
    return true
end

item id check is not necessary as you already registered the item id in movements.xml
 
Solution
Back
Top