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

CreatureEvent [TFS 1.3] Item Sets

Status
Not open for further replies.

oen432

Legendary OT User
Joined
Oct 3, 2014
Messages
1,900
Solutions
55
Reaction score
2,121
Location
Poland
GitHub
Oen44
Item Sets
Another addition known in lots of MMORPG games. By equipping items that are part of a set, bonuses are activated if more parts of the same set are equipped. You can use any item that can be equipped to be part of a set. There are 40 different bonuses that can be added. You can equip different parts of different sets and still get bonuses from all of them. Use command "!sets" to see list of all sets and their bonuses based on parts.​


Bonuses

  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. Life Steal (heal for % of dealt damage)
  12. Experience
  13. Physical Damage or Protection
  14. Energy Damage or Protection
  15. Earth Damage or Protection
  16. Fire Damage or Protection
  17. Ice Damage or Protection
  18. Holy Damage or Protection
  19. Death Damage or Protection
  20. Elemental Damage or Protection (every element in one except physical)
  21. Cast Flame Strike on Attack
  22. Cast Flame Strike on Hit
  23. Cast Ice Strike on Attack
  24. Cast Ice Strike on Hit
  25. Cast Terra Strike on Attack
  26. Cast Terra Strike on Hit
  27. Cast Death Strike on Attack
  28. Cast Death Strike on Hit
  29. Cast Energy Strike on Attack
  30. Cast Energy Strike on Hit
  31. Cast Divine Missile on Attack
  32. Cast Divine Missile on Hit
Installation

  1. Open data/global.lua.
  2. Add somewhere on top (2nd-3rd line)
    Lua:
    dofile('data/item_sets_const.lua')
  3. Under that add
    Lua:
    dofile('data/item_sets.lua')
  4. Open data/creaturescripts/creaturescripts.xml.
  5. Add
    XML:
    <event type="login" name="ItemSetsLogin" script="item_sets_core.lua" />
    <event type="healthchange" name="ItemSetsHealth" script="item_sets_core.lua" />
  6. Open data/events/events.xml.
  7. Enable onTargetCombat, onGainExperience, onItemMoved and onLook.
  8. Open data/events/scripts/creature.lua.
  9. Add target:registerEvent("ItemSetsHealth") inside Creature:onTargetCombat.
  10. Open data/events/scripts/player.lua.
  11. Find Player:onGainExperience and add onItemSetsGainExperience(self, source, exp, rawExp) at the end before return exp
  12. Find Player:onItemMoved and add onItemSetMoved(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder) inside.
  13. Find Player:onLook and under local description = "You see " .. thing:getDescription(distance) add
    Lua:
    description = onItemSetLook(self, thing, position, distance, description)
  14. Open data/talkactions/talkactions.xml and add <talkaction words="!sets" separator=" " script="sets_cmd.lua" />
  15. Download item_sets.rar from attachment at the bottom of this post.
  16. Copy item_sets_const.lua to data/item_sets_const.lua.
  17. Copy item_sets.lua to data/item_sets.lua.
  18. Copy item_sets_core.lua to data/creaturescripts/scripts/item_sets_core.lua.
  19. Copy sets_cmd.lua to data/talkactions/scripts/sets_cmd.lua.

Configuration
Every configuration in - data/item_sets.lua. If you were using version previous to v1.1, just move ITEM_SETS from data/creaturescripts/scripts/item_sets.lua to data/item_sets.lua.
Bonus types are located here - data/item_sets_const.lua.
ITEM_SETS - add sets here
Example
Lua:
ITEM_SETS = {
  [1] = { -- set id
    name = "Leather Set", -- name of this set
    parts = { -- items that are part of this set
      {slot = CONST_SLOT_HEAD, item = 2461}, -- slot is where this item can be equipped, item is item id
      {slot = CONST_SLOT_ARMOR, item = 2467},
      {slot = CONST_SLOT_LEGS, item = 2649},
      {slot = CONST_SLOT_FEET, item = 2643}
    },
    bonuses = { -- list of bonuses based on number of parts equipped
      [1] = { -- bonuses when 1 part is equipped
        {type = BONUS_TYPE_MELEE_SKILLS, value = 1}, -- add +1 to all melee skills
        {type = BONUS_TYPE_DISTANCE_FIGHTING, value = 1}, -- add +1 to distance fighting
        {type = BONUS_TYPE_SHIELDING, value = 1}, -- add +1 to shielding
        {type = BONUS_TYPE_MAXHP, value = 5} -- add +5% max HP
      },
      [2] = { -- bonuses when 2 parts are equipped
        {type = BONUS_TYPE_MELEE_SKILLS, value = 3}, -- add +3 to all melee skills
        {type = BONUS_TYPE_DISTANCE_FIGHTING, value = 3}, -- add +3 to distance fighting
        {type = BONUS_TYPE_SHIELDING, value = 3}, -- add +3 to shielding
        {type = BONUS_TYPE_MAXHP, value = 8} -- add +8% max HP
      },
      [3] = { -- bonuses when 3 parts are equipped
        {type = BONUS_TYPE_MELEE_SKILLS, value = 5},
        {type = BONUS_TYPE_DISTANCE_FIGHTING, value = 5},
        {type = BONUS_TYPE_SHIELDING, value = 5},
        {type = BONUS_TYPE_MAXHP, value = 12}
      },
      [4] = { -- bonuses when 4 parts are equipped
        {type = BONUS_TYPE_MELEE_SKILLS, value = 8}, -- add +8 to all melee skills
        {type = BONUS_TYPE_DISTANCE_FIGHTING, value = 8}, -- add +8 to distance fighting
        {type = BONUS_TYPE_SHIELDING, value = 8}, -- add +8 to shielding
        {type = BONUS_TYPE_MAXHP, value = 15}, -- add +15% max HP
        {type = BONUS_TYPE_FLAMESTRIKE_ON_ATTACK, min = 100, max = 150, chance = 40}, -- cast Flame Strike on Attack, 100-150 damage, 40% chance
        {type = BONUS_TYPE_FLAMESTRIKE_ON_HIT, min = 100, max = 150, chance = 40} -- cast Flame Strike on Hit, 100-150 damage, 40% chance
      }
    }
  }
}

Changelog
[1.1.1] - 2019-05-21
  • Fixed item moving
  • Added HP and MP regeneration when switching items
[1.1.0] - 2019-05-19
  • Improved code functionality
  • Moved ITEM_SETS table to separated file, so future core updates won't interfere with previously created sets
  • Added new bonus type - Trigger
  • Added 12 new bonuses - Cast on Attack and Cast on Hit: Flame Strike, Ice Strike, Terra Strike, Death Strike, Divine Missile, Energy Strike. Cast on Attack triggers when player attacks any creature (including players) while Cast on Hit triggers when player gets hit by any creature (including players).
[1.0.1] - 2019-03-29
  • Fixed bonuses refreshing when item was unequipped by dragging on a backpack item and not the container window.
[1.0.0] - 2019-03-24
  • Release version
 

Attachments

  • item_sets-1_1_1.rar
    4.9 KB · Views: 288 · VirusTotal
Last edited by a moderator:
Nice contributions you have made thank you all go to my server
 
Missing one fundamental feature:
· Applying storages as bonus.

Other than that, really good job.
 
Adding storages to sets mean that you can add any function to the sets.
If 2 parts, add storage (12345, 1) which will trigger an aura, or a random attack, or even go through a door or whatever you can imagine basically, there are like infinite things to do hehe
(at least is how my set system works and i gave it tons of functionality to it)
 
Adding storages to sets mean that you can add any function to the sets.
If 2 parts, add storage (12345, 1) which will trigger an aura, or a random attack or whatever you can imagine basically.
(at least is how my set system works and i gave it tons of functionality to it)
Yeah... You can do that without storage, just some new config fields, that's all. Storage really isn't necessary for something you don't want to save between login sessions.
 
Fixed bonuses refreshing when item was unequipped by dragging on a backpack item and not the container window.
Hi @oen432 nice script thanks. I'm having to re-watch for the attributes to work, when I throw a part of the set does not work if I do not clock. How i can change it?
 
Hi @oen432 nice script thanks. I'm having to re-watch for the attributes to work, when I throw a part of the set does not work if I do not clock. How i can change it?
I'm sorry but I don't understand anything of what you just said. Can you try to be more clear? Or show errors, images, anything?
 
Sorry, my English is terrible.

Well, When i drag any item from set this bonus no work. See the image below.

Sem título15.png

3 / 4
  • Combate corpo a corpo +5
  • Combate a Distancia +5
  • Defesa com Escudos +5
  • Vida Max. +12%
------------------------------------------------
4 / 4
  • Combate corpo a corpo +8
  • Combate a Distancia +8
  • Defesa com Escudos +8
  • Vida Max. +15%
If i relog work perfect.
 
This is weird, did you setup every script properly? I have tried to move 1 item using different ways and it always reduced stats from that set.
Make sure you have that part correctly
  1. Open data/events/scripts/player.lua.
  2. Find Player:onItemMoved and add onItemSetMoved(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder) inside.
Should look like this
Lua:
function Player:onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    onItemSetMoved(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
end
 
I think is it,

my player.lua have this
C++:
"Player:onMoveItem" ur is "Player:onItemMoved"


in the source events.cpp i have only this.

C++:
            } else if (methodName == "onMoveItem") {

                info.playerOnMoveItem = event;
 
I think is it,

my player.lua have this "Player:eek:nMoveItem" ur is "Player:eek:nItemMoved"


in the source events.cpp i have only this.

} else if (methodName == "onMoveItem") {
info.playerOnMoveItem = event;
Oh... Then it won't work on 1.2. Didn't know that this event is only in TFS 1.3. Sorry about that, I'll report this thread so mods can change 1.X to 1.3.
What you can do and what would be the best option is upgrading from 1.2 to 1.3.
 
Last edited:
Last edited:
a suggestion I do not know if it is pertinent, Ex. if i have Leather Set [3/4] then could put the text below [Leather Helmet, Leather Armor, Leather Legs]
if Set [2/4] [Leather Helmet, Leather Armor]...
This is to show what parts are needed, not which you are using. Mostly to reduce the need of using !sets command to check what you have to find next. But if you really want it to work this way then I can make it for you, just let me know.
 
Here, replace data\creaturescripts\scripts\item_sets.lua
 

Attachments

Status
Not open for further replies.
Back
Top