CreatureEvent [TFS 1.3] Upgrade System

oen432

Intermediate OT User
Joined
Oct 3, 2014
Messages
390
Best answers
7
Reaction score
356
Location
Poland
NEW UPDATES -> GitHub
Upgrade System
Tibia has flat, dull, boring and not fun items system, time to change it. Expand your server with a lot of possibilities to make grinding more satisfying. No more useless items laying around and being ignored by others, now every item can be powerful. Using special crystals, items can be upgraded with new stats and powerful attributes. New property - Item Level - which determines how powerful given item is. A lot of crystals to upgrade items even further.


New items

NameDescriptionHow to obtain
Upgrade CrystalCan be used on a piece of equipment for a chance to upgrade it.Crystal Fossil
Enchantment CrystalCan be used on a piece of equipment to add random attribute.Crystal Fossil
Alteration CrystalCan be used on a piece of equipment to remove last attribute.Crystal Fossil
Cleansing CrystalCan be used on a piece of equipment to remove all attributes.Crystal Fossil
Fortune CrystalCan be used on a piece of equipment to change value of last attribute.Crystal Fossil
Faith CrystalCan be used on a piece of equipment to change values of all attributes.Crystal Fossil
Mind CrystalUsed to extract all attributes and values and store in that crystal. Can be used again to place these attributes to a new item. Lower item rarity will remove exceeded attributes.Custom - NPC, Quests etc.
Limitless CrystalUsed to remove Item Level requirement to equip given item.Custom - NPC, Quests etc.
Mirrored CrystalUsed to make a copy of any item. Copies can't be modified and mirrored again.Custom - NPC, Quests etc.
Void CrystalUsed to transform item into random Unique type.Custom - NPC, Quests etc.
Upgrade CatalystPrevents item destroy on upgrade. Consumed on item upgrade.Custom - NPC, Quests etc.
Crystal FossilThere is unknown crystal inside, try to use crystal extractor.Randomly drops from monsters
Crystal ExtractorUsed to extract rare crystals from crystal fossil.Custom - NPC, Quests etc.
Scroll of IdentificationCan be used on unidentified item to reveal hidden attributes.Custom - NPC, Quests etc.

Attributes

  1. Max HP
  2. Max MP
  3. Magic Level
  4. Melee Skills (all in one)
  5. Fist Fighting
  6. Sword Fighting
  7. Axe Fighting
  8. Club Fighting
  9. Distance Fighting
  10. Shielding
  11. Mana Shield
  12. Life Steal
  13. Experience
  14. Physical Damage
  15. Physical Protection
  16. Energy Damage
  17. Energy Protection
  18. Earth Damage
  19. Earth Protection
  20. Fire Damage
  21. Fire Protection
  22. Ice Damage
  23. Ice Protection
  24. Holy Damage
  25. Holy Protection
  26. Death Damage
  27. Death Protection
  28. Elemental Damage (every element in one except physical)
  29. Elemental Protection (every element in one except physical)
  30. Cast Flame Strike on Attack
  31. Cast Flame Strike on Hit
  32. Cast Ice Strike on Attack
  33. Cast Ice Strike on Hit
  34. Cast Terra Strike on Attack
  35. Cast Terra Strike on Hit
  36. Cast Death Strike on Attack
  37. Cast Death Strike on Hit
  38. Cast Energy Strike on Attack
  39. Cast Energy Strike on Hit
  40. Cast Divine Missile on Attack
  41. Cast Divine Missile on Hit
  42. Explosion on Kill
  43. Regenerate Health on Kill
  44. Regenerate Mana on Kill
  45. Mana Steal
  46. Chance to regenerate full HP on Kill
  47. Chance to regenerate full MP on Kill
  48. Chance to cast Mass Healing on Attack
  49. Increased healing from all sources
  50. Additional gold from monsters loot
  51. Chance to deal double damage
  52. Chance to be revived with 100% HP and MP upon death
  53. Chance to get Bonus Damage buff on Kill
  54. Chance to get Bonus Max HP buff on Kill
  55. Chance to get Bonus Max MP buff on Kill

Item Level
Item Level (iLvl) is set for every wearable item (excluding Stackable [spears, assassins stars, ammunition etc.] and Transformable [special rings or boots]) when dropped by a monster.
Default iLvl is calculated using special algorithm that determines monster level/power based on its Max HP and Experience.
Then additional iLvl value is given based on base item stats (Atk, Def, Armor, Hit Chance). After all of that, additional stats are calculated based on item iLvl.
Upgrading item level increases iLvl in addition to bonus stats and values for bonus attributes are based on iLvl of the item.
Given all of that I have made every item different. If you drop a Giant Sword from a Behemoth and a Giant Sword from a Ferumbras they will be different in stats.
You may ask "What if someone loots Sword from high level monster and a new player gets it? That's unbalanced." but don't be afraid.
If player level is lower than iLvl of given items, they can't equip them!

Unique Items
Items with predefined attributes that can't be altered, only their values can be changed. Unidentified items can become Unique.

Installation

  1. Open data/global.lua.
  2. Add somewhere on top
    Lua:
    dofile('data/upgrade_system_core.lua')
  3. Open data/events/events.xml.
  4. Make sure you have enabled
    XML:
    <event class="Creature" method="onTargetCombat" enabled="1" />
    
    <event class="Player" method="onLook" enabled="1" />
    <event class="Player" method="onMoveItem" enabled="1" />
    <event class="Player" method="onItemMoved" enabled="1" />
    <event class="Player" method="onGainExperience" enabled="1" />
  5. Open data/events/scripts/player.lua.
  6. Find Player:onLook.
  7. Add after local description = "You see " .. thing:getDescription(distance)
    Lua:
    description = onItemUpgradeLook(self, thing, position, distance, description)
  8. Find Player:onMoveItem.
  9. Change return true from last line to
    Lua:
    return us_onMoveItem(self, item, fromPosition, toPosition)
  10. Find Player:onItemMoved.
  11. Add inside
    Lua:
    onUpgradeMoved(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
  12. Find Player:onGainExperience.
  13. Add at the end before return exp
    Lua:
    exp = us_onGainExperience(self, source, exp, rawExp)
  14. Open data/events/scripts/creature.lua.
  15. Find Creature:onTargetCombat.
  16. Add somewhere (the best place is after all events, before any event that calculates damage, like DPS Counter)
    Lua:
    target:registerEvent("UpgradeSystemHealth")
    target:registerEvent("UpgradeSystemDeath")
  17. Open data/actions/actions.xml.
  18. This is important part, you have to specify items ID for crystals, scroll of identification and crystal extractor. I have created custom items for myself and IDs are one after another so I'm using fromid and toid. I hope you can handle it.
    XML:
    <action fromid="26383" toid="26389" script="upgrade_system_actions.lua" /> <!-- Crystals and Scroll -->
    <action fromid="26393" toid="26396" script="upgrade_system_actions.lua" /> <!-- Crystals -->
    <action itemid="26391" script="upgrade_system_tool.lua" /> <!-- Crystal Extractor -->
  19. Open data/creaturescripts/creaturescripts.xml.
  20. Add
    XML:
    <event type="login" name="UpgradeSystemLogin" script="upgrade_system_cs.lua" />
    <event type="death" name="UpgradeSystemDeath" script="upgrade_system_cs.lua" />
    <event type="kill" name="UpgradeSystemKill" script="upgrade_system_cs.lua" />
    <event type="healthchange" name="UpgradeSystemHealth" script="upgrade_system_cs.lua" />
    <event type="manachange" name="UpgradeSystemMana" script="upgrade_system_cs.lua" />
    <event type="preparedeath" name="UpgradeSystemPD" script="upgrade_system_cs.lua" />
  21. Download upgrade_system.rar from attachment at the bottom of this post.
  22. Extract and copy data into your data.

Configuration
Every configuration is inside data/upgrade_system_const.lua.
I have added some comments that should explain each property. There are however few special properties for attributes.
VALUES_PER_LEVEL - this indicates max value that can be rolled for given attribute, based on item level. For example if set to 3 then every Item Level adds +3 value, at Item Level 100, max value for this attribute can be 300 (still rolled from 1 to max value).
minLevel - this indicates what Item Level is required for this attribute to be rolled. Use it to balance some early and late game attributes.
chance - chance in % that this attribute will be rolled. If you want 100% then remove that property or just set to 100.

Changelog
[2.0.0] - 2019-06-02
  • Reworked refreshing attributes when changing items
  • Reworked Item Level functionality
  • Monsters Level is now calculated using special algorithm
  • Item Level for dropped items from monsters is assigned based on Monster Level (min 1, random from monsterLevel - 5 to monsterLevel)
  • Item Level is now increased for every upgrade level
  • Item Level is now increased for every base stat of an item
  • Item Level now increases base stats for an item
  • Equipping items require player level to be equal or higher than Item Level
  • Equipping unidentified items is not possible anymore
  • Added Items Rarity - Common, max 1 slot; Rare, max 2 slots; Epic, max 3 slots; Legendary, max 4 slots
  • Rewritten onLook function. Cleaner description for items, additionally showing Total Item Level for a player that we look at.
  • Added Mind Crystal - extracts attributes from selected item and stores them in the crystal, can be then used on a different item to apply these attributes, very rare, not possible to obtain through loot
  • Added Limitless Crystal - adds special attribute (doesn't take attribute slot) "Removed Item Level Requirement" allowing item to be equipped by player with less level than Item Level, very rare, not possible to obtain through loot
  • Added Mirrored Crystal - after using on a item, makes a copy of that item with every value being the same, mirrored items can't be modified, extremely rare, not possible to obtain through loot
  • Added Void Crystal - transforms item into random Unique type, very rare, not possible to obtain through loot
  • Added new attributes:
    • Mana Steal
    • More gold from loot
    • Chance to gain full HP / MP on kill
    • Chance to deal double damage
    • Chance to cast Mass Healing on Attack
    • Chance to be revived on death
    • Chance to get buff (more damage, hp, mp) on kill for 8 seconds
    • Increased healing from all sources
  • Reworked some attributes to be more dynamic rather than fixed (Cast on Attack/Hit)
  • Added % chance (optional) property to attributes, making them harder to roll
  • Removed attributes limit for Unique items
  • New config values
  • Big thanks to @Aeronx for cool ideas and help with testing
[1.1.2] - 2019-05-26
  • Rewritten attributes refreshing when removing items
  • Removed onMoveItem event usage
[1.1.1] - 2019-05-25
  • Fixed property naming
[1.1.0] - 2019-05-24
  • Added Unique type items, predefined attributes that can't be altered, only their values can be changed. Unidentified items can become Unique.
  • Corrected onLook for plural names
[1.0.0] - 2019-05-24
  • Release version
 

Attachments

Last edited by a moderator:
OP
oen432

oen432

Intermediate OT User
Joined
Oct 3, 2014
Messages
390
Best answers
7
Reaction score
356
Location
Poland
New version! First post updated.
[1.1.0] - 2019-05-24
  • Added Unique type items, predefined attributes that can't be altered, only their values can be changed. Unidentified items can become Unique.
  • Corrected onLook for plural names
01:12 You see a [UNIDENTIFIED] mastermind shield (Def:37).
It weighs 57.00 oz.
It's an enchanted shield.
Item Level: 100

01:13 Unique item Water Spirit discovered!

01:15 You see a [Water Spirit] mastermind shield (Def:37).
It weighs 57.00 oz.
It's an enchanted shield.
Item Level: 100
Max MP +148
Magic Level +5
Ice Strike on Attack dealing 1-236 damage
Regenerate 61 Mana on Kill

01:13 You see a [UNIDENTIFIED] magic plate armor (Arm:17).
It can only be wielded properly by knights and paladins.
It weighs 85.00 oz.
Item Level: 100

01:14 Unique item Flame Spirit discovered!

01:14 You see a [Flame Spirit] magic plate armor (Arm:17).
It can only be wielded properly by knights and paladins.
It weighs 85.00 oz.
Item Level: 100
Max HP +287
Melee Skills +8
Heal for 3% of damage
Flame Strike on Attack dealing 1-143 damage

01:14 You cant remove Unique attributes!
01:14 You cant add attributes to Unique items!
Only data/upgrade_system_core.lua and data/upgrade_system_const.lua were changed.
For those who have previous version, you can simply replace upgrade_system_core.lua and add new configurations to upgrade_system_const.lua:
Inside US_CONFIG
Lua:
UNIQUE_CHANCE = 25 -- 1:X chance that unidentified item will become Unique, X means that approximately every X unidentified item will become unique
Somewhere, ie. before US_TYPES
Lua:
US_UNIQUES = {
  [1] = {
    name = "Flame Spirit",
    attributes = {
      -- Don't add more than MAX_ATTRIBUTES_COUNT (can be less but not more)
      1, -- Max HP
      4, -- Melee Skills
      12, -- Life Steal
      30 -- Flame Strike on Attack
    },
    minLevel = 70 -- Required Item Level to become Unique
  },
  [2] = {
    name = "Water Spirit",
    attributes = {
      2, -- Max MP
      3, -- Magic Level
      32, -- Ice Strike on Attack
      44 -- Regenerate Mana on Kill
    },
    minLevel = 70 -- Required Item Level to become Unique
  }
}
 
  • Like
Reactions: oco
OP
oen432

oen432

Intermediate OT User
Joined
Oct 3, 2014
Messages
390
Best answers
7
Reaction score
356
Location
Poland
Sorry guys, forgot about one small, important detail in Installation.
Step 16, please add target:registerEvent("UpgradeSystemDeath") to onTargetCombat.

Sorry again.
 

Ahilphino

Veteran OT User
Joined
Jun 5, 2013
Messages
1,394
Best answers
1
Reaction score
408
nice releases dude! but u should try find some work for some good ots and add these awesome things there
i hate seeing random good systems like this just being copying pasted into bad servers with no thought
 
OP
oen432

oen432

Intermediate OT User
Joined
Oct 3, 2014
Messages
390
Best answers
7
Reaction score
356
Location
Poland
nice releases dude! but u should try find some work for some good ots and add these awesome things there
i hate seeing random good systems like this just being copying pasted into bad servers with no thought
Why work for one server when I can share everything for everyone so both good and "bad" servers can use it?
 

gicu0770

Intermediate OT User
Joined
Feb 26, 2011
Messages
104
Best answers
0
Reaction score
15
Upgrade System
Tibia has flat, dull, boring and not fun items system, time to change it. Expand your server with a lot of possibilities to make grinding more satisfying. No more useless items laying around and being ignored by others, now every item can be powerful. Using special crystals, items can be upgraded with new stats and powerful attributes. New property - Item Level - which is based on player level, attributes and their values are based on that level.


New items

NameDescriptionHow to obtain
Upgrade CrystalCan be used on a piece of equipment for a chance to upgrade it.Crystal Fossil
Enchantment CrystalCan be used on a piece of equipment to add random attribute.Crystal Fossil
Alteration CrystalCan be used on a piece of equipment to remove last attribute.Crystal Fossil
Cleansing CrystalCan be used on a piece of equipment to remove all attributes.Crystal Fossil
Fortune CrystalCan be used on a piece of equipment to change value of last attribute.Crystal Fossil
Faith CrystalCan be used on a piece of equipment to change values of all attributes.Crystal Fossil
Upgrade CatalystPrevents item destroy on upgrade. Consumed on item upgrade.Custom - NPC, Quests etc.
Crystal FossilThere is unknown crystal inside, try to use crystal extractor.Randomly drops from monsters
Crystal ExtractorUsed to extract rare crystals from crystal fossil.Custom - NPC, Quests etc.
Scroll of IdentificationCan be used on unidentified item to reveal hidden attributes.Custom - NPC, Quests etc.

Attributes

  1. Max HP
  2. Max MP
  3. Magic Level
  4. Melee Skills (all in one)
  5. Fist Fighting
  6. Sword Fighting
  7. Axe Fighting
  8. Club Fighting
  9. Distance Fighting
  10. Shielding
  11. Mana Shield
  12. Life Steal
  13. Experience
  14. Physical Damage
  15. Physical Protection
  16. Energy Damage
  17. Energy Protection
  18. Earth Damage
  19. Earth Protection
  20. Fire Damage
  21. Fire Protection
  22. Ice Damage
  23. Ice Protection
  24. Holy Damage
  25. Holy Protection
  26. Death Damage
  27. Death Protection
  28. Elemental Damage (every element in one except physical)
  29. Elemental Protection (every element in one except physical)
  30. Cast Flame Strike on Attack
  31. Cast Flame Strike on Hit
  32. Cast Ice Strike on Attack
  33. Cast Ice Strike on Hit
  34. Cast Terra Strike on Attack
  35. Cast Terra Strike on Hit
  36. Cast Death Strike on Attack
  37. Cast Death Strike on Hit
  38. Cast Energy Strike on Attack
  39. Cast Energy Strike on Hit
  40. Cast Divine Missile on Attack
  41. Cast Divine Missile on Hit
  42. Explosion on Kill
  43. Regenerate Health on Kill
  44. Regenerate Mana on Kill
Unique Items
Items with predefined attributes that can't be altered, only their values can be changed. Unidentified items can become Unique.


Installation

  1. Open data/global.lua.
  2. Add somewhere on top
    Lua:
    dofile('data/upgrade_system_core.lua')
  3. Open data/events/events.xml.
  4. Make sure you have enabled
    XML:
    <event class="Creature" method="onTargetCombat" enabled="1" />
    
    <event class="Player" method="onLook" enabled="1" />
    <event class="Player" method="onMoveItem" enabled="1" />
    <event class="Player" method="onItemMoved" enabled="1" />
    <event class="Player" method="onGainExperience" enabled="1" />
  5. Open data/events/scripts/player.lua.
  6. Find Player:onLook.
  7. Add after local description = "You see " .. thing:getDescription(distance)
    Lua:
    description = onItemUpgradeLook(self, thing, position, distance, description)
  8. Find Player:onMoveItem.
  9. Add as first line
    Lua:
    onUpgradeMove(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
  10. Find Player:onItemMoved.
  11. Add inside
    Lua:
    onUpgradeMoved(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
  12. Find Player:onGainExperience.
  13. Add before return exp
    Lua:
    exp = us_onGainExperience(self, source, exp, rawExp)
  14. Open data/events/scripts/creature.lua.
  15. Find Creature:onTargetCombat.
  16. Add somewhere (the best place is after all events, before any event that calculates damage, like DPS Counter)
    Lua:
    target:registerEvent("UpgradeSystemHealth")
    target:registerEvent("UpgradeSystemDeath")
  17. Open data/actions/actions.xml.
  18. This is important part, you have to specify items ID for crystals, scroll of identification and crystal extractor. I have created custom items for myself and IDs are one after another so I'm using fromid and toid. I hope you can handle it.
    XML:
    <action fromid="26383" toid="26389" script="upgrade_system_actions.lua" /> <!-- Crystals and Scroll -->
    <action itemid="26391" script="upgrade_system_tool.lua" /> <!-- Crystal Extractor -->
  19. Open data/creaturescripts/creaturescripts.xml.
  20. Add
    XML:
    <event type="login" name="UpgradeSystemLogin" script="upgrade_system_cs.lua" />
    <event type="death" name="UpgradeSystemDeath" script="upgrade_system_cs.lua" />
    <event type="kill" name="UpgradeSystemKill" script="upgrade_system_cs.lua" />
    <event type="healthchange" name="UpgradeSystemHealth" script="upgrade_system_cs.lua" />
    <event type="manachange" name="UpgradeSystemMana" script="upgrade_system_cs.lua" />
  21. Download upgrade_system.rar from attachment at the bottom of this post.
  22. Extract and copy data into your data.
Configuration
Every configuration is inside data/upgrade_system_const.lua.
I have added some comments that should explain each property. There are however few special properties for attributes.
VALUES_PER_LEVEL - this indicates max value that can be rolled for given attribute, based on item level. For example if set to 3 then every Item Level adds +3 value, at Item Level 100, max value for this attribute can be 300 (still rolled from 1 to max value).
minLevel - this indicates what Item Level is required for this attribute to be rolled. Use it to balance some early and late game attributes. Mana Shield and Explosion on Kill uses this property.

Changelog
[1.1.0] - 2019-05-24
  • Added Unique type items, predefined attributes that can't be altered, only their values can be changed. Unidentified items can become Unique.
  • Corrected onLook for plural names
[1.0.0] - 2019-05-24
  • Release version
Your best ;)
 

Leesne

Member
Joined
Dec 4, 2017
Messages
90
Best answers
13
Reaction score
38
Error shows, reguarding
data/upgrade_system_const.lua:195: attempt to index global 'BONUS_TYPES' (a nil value)
Assuming this should be US_TYPES as per the rest of the script.
 
OP
oen432

oen432

Intermediate OT User
Joined
Oct 3, 2014
Messages
390
Best answers
7
Reaction score
356
Location
Poland
Error shows, reguarding

Assuming this should be US_TYPES as per the rest of the script.
Thank you! Yeah, I did copy some code from my Item Sets so there is that. Updated.

[1.1.1] - 2019-05-25
  • Fixed property naming
 

Klonera

Once upon a time.
Premium User
Joined
Jul 16, 2016
Messages
403
Best answers
1
Reaction score
52
Location
Sweden
This looks amazing, thanks for relizing this :#
 

Aeronx

Active Member
Joined
Dec 17, 2015
Messages
708
Best answers
9
Reaction score
91
You finally managed! Congrats sir! Really good system. Probably will add some features from this to mine! great work!
 
OP
oen432

oen432

Intermediate OT User
Joined
Oct 3, 2014
Messages
390
Best answers
7
Reaction score
356
Location
Poland
You finally managed! Congrats sir! Really good system. Probably will add some features from this to mine! great work!
Thanks! Now it's time for Alchemy System :p
 

Pedrook

Excellent OT User
Joined
May 24, 2009
Messages
351
Best answers
3
Reaction score
75
You're a god.
Thanks for sharing :)
 

Lucifer

Member
Joined
Dec 27, 2014
Messages
99
Best answers
0
Reaction score
20
Location
Sweden
OP
oen432

oen432

Intermediate OT User
Joined
Oct 3, 2014
Messages
390
Best answers
7
Reaction score
356
Location
Poland
Something like this?

Actually I wanted to make it simpler. Scrolls used as a recipe with list of ingredients needed to make given potion. Right-click on that scroll and if you have enough ingredients, potion will be made. NPC to sell recipes while players have to gather ingredients from quests, looting, NPCs or any other activity.
 

Lucifer

Member
Joined
Dec 27, 2014
Messages
99
Best answers
0
Reaction score
20
Location
Sweden
Actually I wanted to make it simpler. Scrolls used as a recipe with list of ingredients needed to make given potion. Right-click on that scroll and if you have enough ingredients, potion will be made. NPC to sell recipes while players have to gather ingredients from quests, looting, NPCs or gathering any other activity.
Nice, i love your systems/projects so go just keep going ;)
 

Stigma

Veteran OT User
Joined
Feb 14, 2015
Messages
4,700
Best answers
414
Reaction score
2,261
Why not use the new revscriptsys in master branch since you're releasing files for 1.3?
The setup would be 5x easier not having to throw scripts in separate files/interfaces & registering in different XML files.
 
OP
oen432

oen432

Intermediate OT User
Joined
Oct 3, 2014
Messages
390
Best answers
7
Reaction score
356
Location
Poland
Why not use the new revscriptsys in master branch since you're releasing files for 1.3?
The setup would be 5x easier not having to throw scripts in separate files/interfaces & registering in different XML files.
Not many people are using TFS 1.3, not to mention revscripts. It's too fresh.
 
Top