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

onStatsChange Problem

Sherice

Sky&Wind
Joined
Jan 20, 2012
Messages
183
Reaction score
7
Location
Sweden
Hey, I got this little bug here, when I use an onStatsChange script with healthloss and physicaldmg combat on monsters, they can't get poisoned, burned or anything.
Hope s1 can help me, it's really annoying :/ Thanks in advance! (I'll rep if I haven't already)
 
Hey, I got this little bug here, when I use an onStatsChange script with healthloss and physicaldmg combat on monsters, they can't get poisoned, burned or anything.
Hope s1 can help me, it's really annoying :/ Thanks in advance! (I'll rep if I haven't already)

U are my master :) Add post where u need script help and don't show us this script xDDD
GJ!
 
Scirpt here then:

Lua:
function onStatsChange(cid, attacker, type, combat, value)
    if combat == COMBAT_PHYSICALDAMAGE then
        if type == STATSCHANGE_HEALTHLOSS and getCreatureStorage(cid, 5) == -1 then
            --value = (value + getCreatureStorage(cid, 10) * 2)
            value = value + 100
                doCreatureSetStorage(cid, 5, 1)
                doTargetCombatHealth(attacker, cid, COMBAT_PHYSICALDAMAGE, -value, -value, CONST_ME_NONE)
                doCreatureSetStorage(cid, 5)
                return
            end
        end
    return true
end
(creds to cykotitan)


My title is not meant to mean anything bad, I just wrote it 4fun really. If it really is so offending then I'll just change it.
I didn't include the script since I didn't think it contained anything that could bug it, except for the "type" and "combat", which I wrote. Looks like I am wrong, I dont understand why you don't ask me to write the script more kindly, tho.

Btw, complicate everyones life? Is it really so hard to ask for the script? Maybe I just forgot it? (in this case not, though)
 
return false, if that doesn't do anything then you'll have to add conditions manually by getting if the attack has any other type of combat damage.

something like this:
Lua:
function onStatsChange(cid, attacker, type, combat, value)
    if combat == COMBAT_PHYSICALDAMAGE then
        if type == STATSCHANGE_HEALTHLOSS and getCreatureStorage(cid, 5) == -1 then
            --value = (value + getCreatureStorage(cid, 10) * 2)
            value = value + 100
            doCreatureSetStorage(cid, 5, 1)
            doTargetCombatHealth(attacker, cid, COMBAT_PHYSICALDAMAGE, -value, -value, CONST_ME_NONE)
            doCreatureSetStorage(cid, 5)
            if combat == COMBAT_FIREDAMAGE then
                -- add fire condition
            end
            if combat == COMBAT_ENERGYDAMAGE then
                -- add energy condition
            end
            if combat == COMBAT_POISONDAMAGE then
                --add poison condition
            end

            return false
        end
    end
return true
end
 
Last edited:
Back
Top