• 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.2 Damage

lazarus321

Member
Joined
May 8, 2017
Messages
209
Reaction score
20
how would I do to put some of the damage I get from some monster in the "xxx" variable? Example. if it is a spell.
I get 150 damage.
local xxx = "150 damage"
HTML:
player: sendTextMessage (MESSAGE_EVENT_ADVANCE, "..xxx ..")
 
Solution
how would I do to put some of the damage I get from some monster in the "xxx" variable? Example. if it is a spell.
I get 150 damage.
local xxx = "150 damage"
HTML:
player: sendTextMessage (MESSAGE_EVENT_ADVANCE, "..xxx ..")
The creaturescript event onHealthChange is an option. For your example you could do this:
Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    local player = creature:getPlayer()
    if player and primaryType ~= COMBAT_HEALING and origin == ORIGIN_SPELL then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, primaryDamage)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

Origins include...
how would I do to put some of the damage I get from some monster in the "xxx" variable? Example. if it is a spell.
I get 150 damage.
local xxx = "150 damage"
HTML:
player: sendTextMessage (MESSAGE_EVENT_ADVANCE, "..xxx ..")
The creaturescript event onHealthChange is an option. For your example you could do this:
Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    local player = creature:getPlayer()
    if player and primaryType ~= COMBAT_HEALING and origin == ORIGIN_SPELL then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, primaryDamage)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

Origins include:
Lua:
ORIGIN_NONE
ORIGIN_CONDITION
ORIGIN_SPELL
ORIGIN_MELEE
ORIGIN_RANGED
 
Solution
Back
Top