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

Homeslice

-anoyn/Rage the Mage
Joined
May 9, 2010
Messages
113
Reaction score
51
Location
Canada
I'm using this on TFS 1.2. There is a bug when applying item attributes, it sets the range of melee weapons according to item level. So a sword lvl 2 will have 2 range if the lvl bonus in config for range is 1 etc.

Just add a check in there, if current index of attributes (i) is range (6), and n_item_stat (current item attribute) is 0 then do not setattribute. That way melee weapons will never have their range changed.
 

Hokku

Well-Known Member
Joined
Jul 25, 2013
Messages
91
Reaction score
13
Can you explain me how u did it, cuz i have the same problem
 

Homeslice

-anoyn/Rage the Mage
Joined
May 9, 2010
Messages
113
Reaction score
51
Location
Canada
To fix the ranged melee weapons bug:

In the function
function stat_onUse(player, item, fromPosition, target, toPosition, attempt)

Change
Lua:
if upgradable_stats[i][1] ~= ITEM_ATTRIBUTE_ATTACK or it_id:getWeaponType() ~= WEAPON_SHIELD then
to
Lua:
if (upgradable_stats[i][1] ~= ITEM_ATTRIBUTE_ATTACK or it_id:getWeaponType() ~= WEAPON_SHIELD) and not (n_item_stat == 0 and i == 6) then
 

Scracky1

New Member
Joined
Oct 2, 2017
Messages
19
Reaction score
0
I can't figure out how to increase the drop rate. :( Anyone that could give me a hint? <3
 

Allesn

Member
Joined
May 4, 2011
Messages
209
Reaction score
24
I can't figure out how to increase the drop rate. :( Anyone that could give me a hint? <3
Change the chances on this part:
Lua:
weapon_levels = {
                -- weapon name if no slots were assigned, chance(1000 = 1%)
                [-9] = {'useless', 300},
                [-8] = {'broken', 500},
                [-7] = {'trash', 1000},
                [-6] = {'ruined', 1500},
                [-5] = {'damaged', 2000},
                [-4] = {'worthless', 2500},
                [-3] = {'blunt', 4000},
                [-2] = {'cheap', 7000},
                [-1] = {'common', 9000},
                [1] = {'uncommon', 25000},
                [2] = {'strengthened', 20000},
                [3] = {'fine', 15000},
                [4] = {'superior', 10000},
                [5] = {'rare', 7500},
                [6] = {'unique', 3500},
                [7] = {'flawless', 2500},
                [8] = {'epic', 1000},
                [9] = {'legendary', 500}
        },
 

Scracky1

New Member
Joined
Oct 2, 2017
Messages
19
Reaction score
0
Change the chances on this part:
Lua:
weapon_levels = {
                -- weapon name if no slots were assigned, chance(1000 = 1%)
                [-9] = {'useless', 300},
                [-8] = {'broken', 500},
                [-7] = {'trash', 1000},
                [-6] = {'ruined', 1500},
                [-5] = {'damaged', 2000},
                [-4] = {'worthless', 2500},
                [-3] = {'blunt', 4000},
                [-2] = {'cheap', 7000},
                [-1] = {'common', 9000},
                [1] = {'uncommon', 25000},
                [2] = {'strengthened', 20000},
                [3] = {'fine', 15000},
                [4] = {'superior', 10000},
                [5] = {'rare', 7500},
                [6] = {'unique', 3500},
                [7] = {'flawless', 2500},
                [8] = {'epic', 1000},
                [9] = {'legendary', 500}
        },
Thanks man! But will that not just change the chance of what kind of quality the item will get when droped?

What i would like to know is how to make the actuall drop rate %?
 

Scracky1

New Member
Joined
Oct 2, 2017
Messages
19
Reaction score
0
Also i can't get this script to work on monsters, it's working on players (Not elemental protection).

Anyone that have managed to get the damage to work on monsters?
 

Scracky1

New Member
Joined
Oct 2, 2017
Messages
19
Reaction score
0
Fixed it by adding a few lines to creature.lue

Etc
Lua:
target:registerEvent("statHP")
 

element90

Excellent OT User
Joined
Mar 24, 2009
Messages
114
Reaction score
26
Anyone know if i can enable the Rare Loot to work for Reward Containers from bosses?
 

element90

Excellent OT User
Joined
Mar 24, 2009
Messages
114
Reaction score
26
Here is @Sir Islam's fix for my aol problem -

Slot.lua
Code:
function onUse(player, item, fromPosition, itemEx, toPosition)
if not (Item(itemEx.uid) or not Creature(itemEx.uid))  or  itemEx.itemid == 2173 then return false end
stat_onUse(player, item, fromPosition, itemEx, toPosition)
return true
end
Simple, yet effective. like a bow and arrow :eek:

haha thanks :p

Hey, any idea on how i can add more ID's?

Working with only one ID, but when i tryed like this none of them got blacklisted anymore.
Code:
function onUse(player, item, fromPosition, itemEx, toPosition)
if not (Item(itemEx.uid) or not Creature(itemEx.uid)) or itemEx.itemid == 2173,2197,2164 then return false end
stat_onUse(player, item, fromPosition, itemEx, toPosition)
return true
end
Any help would be appreciated by a noob like me,
Cheers
 

element90

Excellent OT User
Joined
Mar 24, 2009
Messages
114
Reaction score
26
Hello guys,

Anyone using this on OTX?

Getting these errors paired with Extra Loot.

Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/stats.lua:2173: attempt to index a nil value
stack traceback:
        [C]: in function '__index'
        data/stats.lua:2173: in function 'improveChance'
        data/stats.lua:2247: in function <data/stats.lua:2222>

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/extra_loot.lua:onDeath
data/creaturescripts/scripts/extra_loot.lua:47: attempt to call method 'isContainer' (a nil value)
stack traceback:
        [C]: in function 'isContainer'
        data/creaturescripts/scripts/extra_loot.lua:47: in function <data/creaturescripts/scripts/extra_loot.lua:45>

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/extra_loot.lua:onDeath
data/creaturescripts/scripts/extra_loot.lua:47: attempt to call method 'isContainer' (a nil value)
stack traceback:
        [C]: in function 'isContainer'
        data/creaturescripts/scripts/extra_loot.lua:47: in function <data/creaturescripts/scripts/extra_loot.lua:45>
Anyone have any ideas? :)

Thanks in advance,
Peace
 

Homeslice

-anoyn/Rage the Mage
Joined
May 9, 2010
Messages
113
Reaction score
51
Location
Canada
Known bugs:
- loot: non upgradable items get +x
"You see a bone +5"
to fix:

Change
Lua:
if STATS_SYSTEM_CONFIG.rare_loot_level then
to
Lua:
if STATS_SYSTEM_CONFIG.rare_loot_level and u then
 

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
453
Reaction score
167
Location
Argentina
elemental protection work for you guys?
In TFS 1.2 to make elemental protection work (Only tested it on fields) do the following:

Go to data/events/scripts/creature.lua

Inside that file you will find this function:
Code:
function Creature:onAreaCombat(tile, isAggressive)
    return true
end
Now just add this line under the function itself.
creature:registerEvent("statHP")

It should now look like this:
Code:
function Creature:onAreaCombat(tile, isAggressive)
    creature:registerEvent("statHP")
    return true
end
There you go.
 

qosiu

New Member
Joined
May 23, 2018
Messages
11
Reaction score
1
Hi. Could anyone help me with doubled item information on look? I'm looking for the solution and nothing...

12:55 You see a sword (Atk:14, Def:12 +1).
Imbuements: (Empty Slot, Empty Slot).
It weighs 35.00 oz.a sword (Atk:14, Def:12 +1).
Imbuements: (Empty Slot, Empty Slot).
It weighs 35.00 oz.
Item ID: 2376
Position: 32328, 32217, 8
 

qosiu

New Member
Joined
May 23, 2018
Messages
11
Reaction score
1
Hi. I would like to ask you how to change range of changes, for example i got boots +7 so they have 14 def. It's way too much!
 

samco

4x4 Developer.
Joined
Jul 3, 2007
Messages
882
Reaction score
173
Location
Spain
In stats.lua theres a multiplier for each attribute in the levels
 

samco

4x4 Developer.
Joined
Jul 3, 2007
Messages
882
Reaction score
173
Location
Spain
In gems? Where exacly? And how to make all items max +2?
You will find this
Code:
-- spells and values for certain types of item
    UPGRADE_STATS_VALUES_PER_LVL = {
        -- value per level
            atk = 2,
            def = 2,
            extradef = 1,
            arm = 2,
            hitchance = 3,
            shootrange = 1
    },
That is a multiplier, so if you have +9 ranges, your weapon can get 9*2 = 18 extra attack. Thats weir, a troll can drop a 18def leather boots.

I disabled level function. You may tray to put everything +1, then only have 2 or 3 levels.
 

Danat

Excellent OT User
Joined
Jun 6, 2008
Messages
47
Reaction score
12
this works great on 1.2, added to my server and added a couple of things like slot removal, based on this great script of course, thanks zbizu for this amazing system.
-"I was wondering if im missing something, the element damage attacks like fire and others work good on player vs player, but not on player vs monster."
its what i was writing while i fixed it. now it works great against player vs monster.
you can check it out on my server, info on my signature.
THANKS ZBIZU!
 
Top