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

Lua COMBAT_PARAM_CREATEITEM add pz locked

f0lpz

New Member
Joined
May 24, 2020
Messages
7
Reaction score
0
When you run the spell it adds pz locked on the player 1590453132542.png

Spell.lua
Lua:
-- Variáveis da Special Skill
local storageSkill = 30034
local storageExhaust = 51004
local tempoExhaust = 10
local manaPercentToUse = 30 -- em porcentagem
-- Variáveis da Special Skill

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 8009)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_CREATEITEM, 8010)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_YELLOW)

arr = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

arr2 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}

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

local area = createCombatArea(arr)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
setCombatArea(combat, area)
setCombatArea(combat2, area2)
setCombatArea(combat3, area3)

function onCastSpell(cid, var)
if getPlayerMana(cid) >= ((manaPercentToUse/100)*getCreatureMaxMana(cid)) then
if not isExhausted(cid, "karamatsu no mai") then
if getPlayerStorageValue(cid, storageSkill) >= 1 then
setCooldown(cid, "karamatsu no mai", tempoExhaust)
doPlayerAddMana(cid, -((manaPercentToUse/100)*getCreatureMaxMana(cid)))
    doCombat(cid, combat, var)
    doCombat(cid, combat2, var)
    doCombat(cid, combat3, var)
    else
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    doPlayerSendCancel(cid, "Voce nao possui esta habilidade especial.")
    end
    else
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    doPlayerSendCancel(cid, "Voc\ę preci\sa aguardar " .. math.ceil(getCooldown(cid, "karamatsu no mai")) .. " segundos para acumular o esp\írito.")
    end
    else
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You do not have enough mana.")
    end
return false
end

TFS 0.4
 
Solution
This is because spells by default are considered aggressive unless specified otherwise. The fact that create item spells typically are creating damaging fields like fire and poison notwithstanding.

Lua:
-- Variáveis da Special Skill
local storageSkill = 30034
local storageExhaust = 51004
local tempoExhaust = 10
local manaPercentToUse = 30 -- em porcentagem
-- Variáveis da Special Skill

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 8009)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat2...
This is because spells by default are considered aggressive unless specified otherwise. The fact that create item spells typically are creating damaging fields like fire and poison notwithstanding.

Lua:
-- Variáveis da Special Skill
local storageSkill = 30034
local storageExhaust = 51004
local tempoExhaust = 10
local manaPercentToUse = 30 -- em porcentagem
-- Variáveis da Special Skill

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 8009)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_CREATEITEM, 8010)
setCombatParam(combat2, COMBAT_PARAM_AGGRESSIVE, false)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_YELLOW)
setCombatParam(combat3, COMBAT_PARAM_AGGRESSIVE, false)

arr = {
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    {0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1},
    {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

arr2 = {
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
    {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
    {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

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

local area = createCombatArea(arr)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
setCombatArea(combat, area)
setCombatArea(combat2, area2)
setCombatArea(combat3, area3)

function onCastSpell(cid, var)
    if getPlayerMana(cid) >= ((manaPercentToUse / 100) * getCreatureMaxMana(cid)) then
        if not isExhausted(cid, "karamatsu no mai") then
            if getPlayerStorageValue(cid, storageSkill) >= 1 then
                setCooldown(cid, "karamatsu no mai", tempoExhaust)
                doPlayerAddMana(cid, -((manaPercentToUse / 100) * getCreatureMaxMana(cid)))
                doCombat(cid, combat, var)
                doCombat(cid, combat2, var)
                doCombat(cid, combat3, var)
            else
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
                doPlayerSendCancel(cid, "Voce nao possui esta habilidade especial.")
            end
        else
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            doPlayerSendCancel(cid, "Voc\ę preci\sa aguardar " .. math.ceil(getCooldown(cid, "karamatsu no mai")) .. " segundos para acumular o esp\írito.")
        end
    else
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid, "You do not have enough mana.")
    end
    return false
end

Explicit specification of non-aggression as a combat parameter should resolve this.
 
Solution
I'd have to look at the code, but I presume you need both. I think it works like this:

The one in the spells index decides the very moment you cast the spell if you are PZ locked.
The ones in the Lua file as combat parameter decided when doCombat function is called.

For example, you could have a delayed fireball spell where the spell itself is not aggressive to cast, but the combat object called by a doCombat delayed with an addEvent is aggressive still.
 
Back
Top