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

Extra damage on "fire" damage as explain?

Marko999x

ArchezOt soon
Premium User
Joined
Dec 14, 2017
Messages
3,974
Solutions
104
Reaction score
3,108
Location
Germany
Is it possible to create an script which is based on extra damage only for one effect?
Like if I have an item which is on "Arrow" Spot and that item gives like 20% more damage on all fire damage spells
do i need to make source edits for it?
+ would it work like that?
 
You can do: onHealthChange/onManaChange

local item = getPlayerSlotItem(COSNT_SLOT_ARROW)
if item and item.itemid == 1111 then
dmg = dmg + (dmg * .20)
end
 
best way is source edit but if u need lua u can test it
LUA:
function onStatsChange(cid, attacker, type, combat, value)
        if((not attacker) or (not isPlayer(attacker)) or (not isCreature(attacker))) then
                return true
        end
local item = getPlayerSlotItem(COSNT_SLOT_ARROW)
local damage = value+ (value*0.20)
    if item and item.itemid == 1111  then
       if(type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then
            doTargetCombatHealth(attacker, cid, type, -damage , -damage , CONST_ME_NONE)
        end
end
    return true
    end
 
Last edited:
best way is source edit but if u need lua u can test it
LUA:
function onStatsChange(cid, attacker, type, combat, value)
local item = getPlayerSlotItem(COSNT_SLOT_ARROW)
local damage = value+ (value*0.20)
    if item and item.itemid == 1111  then
       if(type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then
            doTargetCombatHealth(attacker, cid, type, -damage , -damage , CONST_ME_NONE)
        end
end
    return true
    end

in which would folder do i need to put it?
 
in which would folder do i need to put it?
creaturescript
and creaturescript.xml
LUA:
<event type="statschange" name="xxxxx" event="script" value="ssssss.lua"/>
and in login.lua add
registerCreatureEvent(cid, "xxxxx")

change xxxx to event name and change sssss to lua file name
 
creaturescript
and creaturescript.xml
LUA:
<event type="statschange" name="xxxxx" event="script" value="ssssss.lua"/>
and in login.lua add
registerCreatureEvent(cid, "xxxxx")

change xxxx to event name and change sssss to lua file name

tested, doesnt work :(

[17:4:32.140] [Error - CreatureScript Interface]
[17:4:32.141] data/creaturescripts/scripts/damage.lua:onStatsChange
[17:4:32.141] Description:
[17:4:32.142] (luaGetPlayerSlotItem) Player not found
 
tested, doesnt work :(

[17:4:32.140] [Error - CreatureScript Interface]
[17:4:32.141] data/creaturescripts/scripts/damage.lua:eek:nStatsChange
[17:4:32.141] Description:
[17:4:32.142] (luaGetPlayerSlotItem) Player not found
LUA:
function onStatsChange(cid, attacker, type, combat, value)
        if((not attacker) or (not isPlayer(attacker)) or (not isCreature(attacker))) then
                return true
        end
local item = getPlayerSlotItem(COSNT_SLOT_ARROW)
local damage = value+ (value*0.20)
    if item and item.itemid == 1111  then
       if(type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then
            doTargetCombatHealth(attacker, cid, type, -damage , -damage , CONST_ME_NONE)
        end
end
    return true
    end
 
LUA:
function onStatsChange(cid, attacker, type, combat, value)
        if((not attacker) or (not isPlayer(attacker)) or (not isCreature(attacker))) then
                return true
        end
local item = getPlayerSlotItem(COSNT_SLOT_ARROW)
local damage = value+ (value*0.20)
    if item and item.itemid == 1111  then
       if(type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then
            doTargetCombatHealth(attacker, cid, type, -damage , -damage , CONST_ME_NONE)
        end
end
    return true
    end

still doesnt work
+ no errors ^^
 
combat.cpp
in CombatHealthFunc and CombatManaFunc function
after
Code:
            change = random_range(var->minChange, var->maxChange, DISTRO_NORMAL);
    }
add
LUA:
    if(caster && caster->getPlayer())
        {
            std::string value;
            caster->getPlayer()->getStorage("145213", value);
            int32_t plus  = (int32_t)(atoi(value.c_str()));
            if(params.combatType == COMBAT_FIREDAMAGE)
              change  = (int32_t)std::ceil (change  + change  * plus  /100);
        }
and in creaturescript.xml add
<event type="think" name="ammo" event="script" value="ammo.lua"/>

Code:
local t = {
        [CONST_SLOT_AMMO] = {11111}, --- change items id
}

function onThink()
        for _, cid in ipairs(getPlayersOnline()) do
                local has = true
                for slot, ids in pairs(t) do
                        if not table.find(ids, getPlayerSlotItem(cid, slot).itemid) then
                                has = false
                                break
                        end
                end
                if has and getCreatureStorage(cid, 359453) == -1  then
                setPlayerStorageValue(cid, 145213, getPlayerStorageValue(cid, 145213) +20)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Default  bonus: your fire attack get  increased by 20%.")
                doSendMagicEffect(getCreaturePos(cid),1)
                setPlayerStorageValue(cid, 359453, 1)
                elseif  has == false and getCreatureStorage(cid, 359453) == 1  then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Default bonus effect has been lost.")
                setPlayerStorageValue(cid, 145213, getPlayerStorageValue(cid, 145213) - 20)
                doSendMagicEffect(getCreaturePos(cid),2)
                setPlayerStorageValue(cid, 359453, -1)
                end
                        end
        return true
end

and in login.lua add
registerCreatureEvent(cid, "ammo")
 
Back
Top