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

Lua Spell problem and one question.

Moj mistrz

Monster Creator
Joined
Feb 1, 2008
Messages
932
Solutions
10
Reaction score
308
Location
Poland
Hello, I have problem with that spell
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)

    arr1 = {
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {3}
    }

    arr2 = {
    {3, 1, 1, 1, 1, 1, 1, 1, 1, 1}
    }

    arr3 = {
    {3},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1}
    }

    arr4 = {
    {1, 1, 1, 1, 1, 1, 1, 1, 1, 3}
    }


if getPlayerLookDir(cid) == 0 then
local area1 = createCombatArea(arr1)
    setCombatArea(combat, area1)
elseif getPlayerLookDir(cid) == 1 then
local area2 = createCombatArea(arr2)
    setCombatArea(combat, area2)
elseif getPlayerLookDir(cid) == 2 then
local area3 = createCombatArea(arr3)
    setCombatArea(combat, area3)
elseif getPlayerLookDir(cid) == 3 then
local area4 = createCombatArea(arr4)
    setCombatArea(combat, area4)
end
local function delayedCastSpell(cid, var)
    if isCreature(cid) == true then
        doCombat(cid, combat, numberToVariant(cid))
        doCreatureSay(cid, "OMRAFIR BREATHES INFERNAL FIRE", TALKTYPE_ORANGE_2)
    end
end

function onCastSpell(cid, var)
    doCreatureSay(cid, "OMRAFIR INHALES DEEPLY!", TALKTYPE_ORANGE_2)
    addEvent(delayedCastSpell, 4000, cid, var)
    return true
end
Basically I want that spell to deal damage at first(obvious) cuz it isn't making any and spell should follow its caster, that spell shouldn't be casted twice in a row(well it can be casted but without spell effect), so message should appear everytime it is casted, but if casted twice or more within 4 seconds it should send beam effect only once(last cast should work here). Hope you get what I mean.

Second problem or question(?).
Is it possible to 'convert' that moveevent to creaturescript or make it like that so it wont affect firefield moveevent?
Code:
function onStepIn(cid, item, position, fromPosition)
    local health = math.random(7500, 9000)
    local chance = math.random(1, 100)
    local hp = (getCreatureHealth(cid)/getCreatureMaxHealth(cid))*100
    if isMonster(cid) == true and getCreatureName(cid) == "Omrafir" and (chance < 40) and (hp < 99) then
        doCreatureAddHealth(cid, health)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(cid, "Omrafir gains new strength from the fire", TALKTYPE_ORANGE_1)
    end
    return true
end
This is fire field event:
Code:
<movevent event="StepIn" itemid="1487" function="onStepInField"/>
and I tried this:
Code:
<movevent event="StepIn" itemid="1487" function="onStepInField" script="monster heal.lua"/>
  <movevent event="StepIn" itemid="1487" script="monster heal.lua"/>
But by both lines fire field doesn't make any damage(not working at all), but the moveevent works perfectly.

I would appreciate any help. Thanks and I hope I posted in right board.
 
Come on dude, I gave you a working spell for 0.3.6 and you said that the only one thing that isnt working (becasue of your version of TFS) is directions. You didn't say that it's spell for monsters. For players it works good, probably even on your server. For monsters it can be hard to do delayed spell (I just personally never did that). But for the damage part, if it's only for monster you need to set it in monster file not in spell. Also you can set there how often the monster will cast this spell and with what chance, for example every 4 seconds with 60% chance.
 
Back
Top