• 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 create combat on shot fire field

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
How to set pvp locked when shot fire field on ground?

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL)

function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end
 
I don't think you need to add combat parameter
just add condition to the creature
Code:
Player(creature):addCondition(CONDITION_INFIGHT)
 
I don't think you need to add combat parameter
just add condition to the creature
Code:
Player(creature):addCondition(CONDITION_INFIGHT)


How?


local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL)
Player(creature):addCondition(CONDITION_INFIGHT)

function onCastSpell(creature, var, isHotkey)
return combat:execute(creature, var)
end
 
After
Code:
function onCastSpell(creature, var, isHotkey)
And Before
Code:
return
Code:
function onCastSpell(creature, var, isHotkey)
Player(creature):addCondition(CONDITION_INFIGHT)
return combat:execute(creature, var)
 
Should check if the combat is executed and not fail. Then do creature:addCondition
 
Code:
local fightCondition = Condition(CONDITION_INFIGHT, CONDITIONID_DEFAULT)
fightCondition:setTicks(configManager.getNumber(configKeys.PZ_LOCKED) * 1000)

function onCastSpell(creature, var, isHotkey)
    if combat:execute(creature, var) then
        creature:addCondition(fightCondition)
        return true
    end

    return false
end

You cannot put a constructer over creature, since it's a userdata.
 
I tryed this:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL)

function onCastSpell(creature, var, isHotkey)
Player(creature):addCondition(CONDITION_INFIGHT)
return combat:execute(creature, var)
end

and:

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL)

local fightCondition = Condition(CONDITION_INFIGHT, CONDITIONID_DEFAULT)
fightCondition:setTicks(configManager.getNumber(configKeys.PZ_LOCKED) * 1000)

function onCastSpell(creature, var, isHotkey)
    if combat:execute(creature, var) then
        creature:addCondition(fightCondition)
        return true
    end

    return false
end


both dont work ;o omg ;/


tfs 1.2
 
Back
Top