CreatureEvent [TFS 1.1] Ultimate item stat system (elements, skills, exp, loot and more)

RazorBlade

Retired Snek
Joined
Nov 7, 2009
Messages
2,030
Best answers
1
Reaction score
590
Location
Canada
okay. I also made a full lightning set with 10% additional energy resistance, plus ring and amulet and shield, well over 100% energy resist total. Still taking major energy damage from an energy elemental, so it seems the elemental resistance doesn't work.
 

SN4KY

Member
Joined
Mar 19, 2015
Messages
58
Best answers
0
Reaction score
12
@RazorBlade
resistance doenst work like you think... they dont stack
imagine your set.. each piece gives 10%
now you suffer 1000 dmg
at first it will decrease 10% from your helmet stats to 900 dmg
then will decrease 10% from next part to 810 dmg .. etc
 

nugo

Australia OT Mapper
Premium User
Joined
Apr 1, 2009
Messages
209
Best answers
1
Reaction score
37
@zibzu

When i try to login i get



I also noticed in your OP you have script="slot.lua

Code:
<action itemid="8305" script="slot.lua"/>
<action itemid="8310" script="slot.lua"/>
<action fromid="8298" toid="8301" script="slot.lua"/>
Then for the action script you have "stat_slot.lua action" Is this intentional or a mistake? should the file be caled slot.lua instead?

Code:
function onUse(player, item, fromPosition, itemEx, toPosition)
return stat_onUse(player, item, fromPosition, itemEx, toPosition)
end
 
OP
zbizu

zbizu

Veteran OT User
Joined
Nov 22, 2010
Messages
2,460
Best answers
1
Reaction score
1,369
Location
Poland
There is difference between protection (maxdmg) and protection %
If there is no %, it will block/do up to x dmg

Regarding errors: I'll test it with newest tfs today.
 

Mariuskens

Sword Art Online 2D-MMORPG
Joined
Nov 21, 2008
Messages
982
Best answers
0
Reaction score
87
Location
Spain
@zibzu

When i try to login i get



I also noticed in your OP you have script="slot.lua

Code:
<action itemid="8305" script="slot.lua"/>
<action itemid="8310" script="slot.lua"/>
<action fromid="8298" toid="8301" script="slot.lua"/>
Then for the action script you have "stat_slot.lua action" Is this intentional or a mistake? should the file be caled slot.lua instead?

Code:
function onUse(player, item, fromPosition, itemEx, toPosition)
return stat_onUse(player, item, fromPosition, itemEx, toPosition)
end
same bug
 

RazorBlade

Retired Snek
Joined
Nov 7, 2009
Messages
2,030
Best answers
1
Reaction score
590
Location
Canada
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/stats.lua:eek:nHealthChange
data/lib/stats.lua:1731: attempt to index a nil value
stack traceback:
[C]: in function '__index'
data/lib/stats.lua:1731: in function 'getItemWeaponType'
data/lib/stats.lua:1732: in function 'isWeapon'
data/lib/stats.lua:1515: in function <data/lib/stats.lua:1501>

Just got this one as well. I wasn't online when it happened so I don't know what exactly occurred to cause the error. My server has been having issues since I installed this as well. Every so often players get kicked and can't get back on, sometimes it just kicks everyone and nobody can get on till I restart the server. I'm using the latest revision of 1.1 and basically everything else is 100% stock and there's never any errors in console when it happens. Do you know of anyone else who's having this sort of issue after installing this system? Think it could be related?
 

RazorBlade

Retired Snek
Joined
Nov 7, 2009
Messages
2,030
Best answers
1
Reaction score
590
Location
Canada
Hm, noticing that if you equip two items with melee+10%, it's fine, but if you equip a third, it gains nothing, and unequiping one of the original two while the third is on, keeps the stats of 2. So 3+ just doesn't work.
 

RazorBlade

Retired Snek
Joined
Nov 7, 2009
Messages
2,030
Best answers
1
Reaction score
590
Location
Canada
I just tried it on today's nightly rev (675) and it completely broke half the systems in my server. It was returning nil values on all kinds of functions like isContainer.

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/extra_loot.lua:eek:nDeath
data/creaturescripts/scripts/extra_loot.lua:43: attempt to call method 'isContai
ner' (a nil value)
stack traceback:
[C]: in function 'isContainer'
data/creaturescripts/scripts/extra_loot.lua:43: in function <data/creatu
rescripts/scripts/extra_loot.lua:41>


This error does not occur with the way stat.lua used to be.

Upgrading also does not work at all when trying with the new stat.lua. No errors in console when trying to upgrade.
 
OP
zbizu

zbizu

Veteran OT User
Joined
Nov 22, 2010
Messages
2,460
Best answers
1
Reaction score
1,369
Location
Poland
You either made a syntax error or use wrong tfs version
 

RazorBlade

Retired Snek
Joined
Nov 7, 2009
Messages
2,030
Best answers
1
Reaction score
590
Location
Canada
I fixed the error with extra loot, but when I use the new stats.lua, none of the upgrading works.

I tried with the latest tfs version, posted this morning. I also downloaded 663 and the whole data folder as a separate server, which is from the 29th, and it still doesn't work. I copied everything as it is and made no changes to it at all. No errors in console still.
 
Last edited:

RazorBlade

Retired Snek
Joined
Nov 7, 2009
Messages
2,030
Best answers
1
Reaction score
590
Location
Canada
Oh jeez. Found a big issue in the new one. Enchanting doesn't work for me still, but enchanted weapons do normal damage now. However, my spike sword is hitting dragons from like 5+ squares away. It did not do that before xD

EDIT: a sword with enchantments is not doing this. Just the spike sword with enchantments.
 
Last edited:

Mariuskens

Sword Art Online 2D-MMORPG
Joined
Nov 21, 2008
Messages
982
Best answers
0
Reaction score
87
Location
Spain
Then now work all but im stupid idnow where put this;

function Player:eek:nLook(thing, position, distance)
local description = "You see " .. thing:getDescription(distance)
description = stat_onLook(thing, description)
here:

https://github.com/orts/server/blob/master/data/events/scripts/player.lua


And it
function Creature:eek:nTargetCombat(target)
return stat_onTargetCombat(self, target)
end
here:

https://github.com/orts/server/blob/master/data/events/scripts/creature.lua
 
Last edited:

RazorBlade

Retired Snek
Joined
Nov 7, 2009
Messages
2,030
Best answers
1
Reaction score
590
Location
Canada
That goes in events/scripts/creature.lua @Mariuskens
The function already exists, you just change the existing one to that one
 

Mariuskens

Sword Art Online 2D-MMORPG
Joined
Nov 21, 2008
Messages
982
Best answers
0
Reaction score
87
Location
Spain
ok

Now ?

Code:
function Creature:onChangeOutfit(outfit)
    return true
end

function Creature:onAreaCombat(tile, isAggressive)
    return true
end

local function removeCombatProtection(cid)
    local player = Player(cid)
    if not player then
        return true
    end

    local time = 0
    if player:isMage() then
        time = 10
    elseif player:isPaladin() then
        time = 20
    else
        time = 30
    end

    player:setStorageValue(STORAGE.COMBATPROTECTIONSTORAGE, 2)
    addEvent(function(cid)
        local player = Player(cid)
        if not player then
            return
        end

        player:setStorageValue(STORAGE.COMBATPROTECTIONSTORAGE, 0)
        player:remove()
    end, time * 1000, cid)
end

function Creature:onTargetCombat(target)
   return stat_onTargetCombat(self, target)
    if not self then
        return true
    end

    if target:isPlayer() then
        if self:isMonster() then
            local protectionStorage = target:getStorageValue(STORAGE.COMBATPROTECTIONSTORAGE)

            if target:getIp() == 0 then -- If player is disconnected, monster shall ignore to attack the player
                if protectionStorage <= 0 then
                    addEvent(removeCombatProtection, 30 * 1000, target.uid)
                    target:setStorageValue(STORAGE.COMBATPROTECTIONSTORAGE, 1)
                elseif protectionStorage == 1 then
                    self:searchTarget()
                    return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
                end

                return true
            end

            if protectionStorage >= os.time() then
                return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
            end
        end
    end

    return true
end
 
OP
zbizu

zbizu

Veteran OT User
Joined
Nov 22, 2010
Messages
2,460
Best answers
1
Reaction score
1,369
Location
Poland
I installed it on clear datapack today and it works. I don't even know how could you fail it.
 

Mariuskens

Sword Art Online 2D-MMORPG
Joined
Nov 21, 2008
Messages
982
Best answers
0
Reaction score
87
Location
Spain
@zbizu All runs good but:

When player attack players Appear good all Effects holy/death/water etc but...

When you try to attack creatures dont appear nothing on monsters only PHYSICAL damage...

WHYYYYYY xDDDDD wtf imgoing craazy tonigh xDDDD.


 
Top