ID:151397
 
Allo.

So ive been playing Aion recently to kill some time when one of the original aspects of my equipment system popped back into my head.. Although its a generic idea it still proves a nice addition to any game i reckon.

Which is Set Bonuses and Item Bonuses.

As it stands i currently have my equipment system setup that has a single list inside the items. Then when you want to add a bonus you simply add the corresponding player var directly as it would be in the player vars and its bonus. Then on equip it launches that stats datum proc for adding or subtracting stats.

Thats all good and works as it should as far as i know but now what i want to do is bring in "Set Bonuses" which is where lets say for the sake of example a Greek God Set, named Poseidon's Battlegear this consists of Leggings, Boots, Gloves and a Trident. Now lets say with 2 pieces they gain a bonus of 5 str and all 4 is 10 strength.

How would i go about this in the most effective manner?

As it stands i was thinking of doing it like this.

Inside every item it has a "set reference var" which is a link to the set it belongs to. the var is a link to a datum which contains all the different sets. so inside that datum it would hold a link to every single item that belongs to its set. (to be checked with that of what is currently equipped by the player) and handles all that.. So would this method work and be the effective approach or is there a better way?

quick reference. naturally its dodged and doesnt have any of the procs cause i havnt came up with how im gonna do them yet :D

items/equipment
var/setlink
possytrident
setlink = "itemsets/poseidonsbgear"

itemsets
poseidonsbgear
var/list/setitems = list("possytrident" = "items/possytrident", "possyboots" = "items/possyboots")


~Midget
I think it would be easier to give each set some SetID (unique identifier of set) and SetSize (number of items in this set). Then, whenever player equips item check how many items of same SetID he has equipped, if it's equal to SetSize you can apply set bonus.
In response to Ripiz
Ok i went to try and play with the SetBonuses idea. so i created my datum to handle all the sets.

so ive made the scrap mockup proc for the setbonuses to simply check for the pieces this is without going into adding bonuses and ensuring they dont double stack bonuses and what not

setbonuses
parent_type = /atom/movable

proc
check_pieces(mob/human/clicker, items/Equipment/eq)
world << "DBG 1. - check_pieces has been run by [clicker] -- [eq]"
var/setcount = 0
for(var/items/Equipment/a in setpieces)
world << "DBG 2. - Running for loop scanning for [a]"
if(a == clicker.equipment[a.eqslot])
world << "DBG 3. - Setpiece [a] matches with item in correct slot in [clicker]'s equipment"
setcount++
world << "DBG 4. - You have [setcount] pieces of the [setname] set"

var
list/setpieces
list/bonuses
setname

testset
setpieces = list(/items/Equipment/Weapons/Sword/TestSword, /items/Equipment/Clothing/Chest/TestChest1)
bonuses = list(1 = list("strength" = 5, "agility" = 2), 1 = list("strength" = 10, "agility" = 4))
setname = "Midget's Emporium"

check_pieces(mob/human/clicker)
world << "This should be displaying but well it doesn't (only for purpose of displaying on forums)"


so using the above code that should technically if it was working run the custom check pieces proc for testset. but it doesn't.

This is how it looks in the equipment sections.
items/Equipment/Clothing
icon_state = "inventory"
Chest
layer = LAYER_CHEST
eqslot = "chest"
TestChest1
icon = 'Iconz/Equipment/Suit.dmi'
setid = /setbonuses/testset //this is meant to link to the testset in the above code tags.
eqwear = /holders/Chest/TestChest1

//for reference sake does not directly relate to problem at hand..
holders
parent_type = /atom/movable
Chest
layer = LAYER_CHEST
TestChest1
icon = 'Iconz/Equipment/Suit.dmi'


//human equip proc
mob/human/proc
Equip(items/Equipment/O)
if(!O || !O.eqslot) return
if(equipment && equipment[O.eqslot])
Unequip(equipment[O.eqslot])
if(equipment && equipment[O.eqslot]) return
if(!equipment) equipment = new
equipment[O.eqslot] = O

if(O.setid) /***********LINK TO THE SETID***/
O.setid.check_pieces(src, O)
/**********Now this should be making it run the object in question's setid check pieces proc..
using the codes given it -should- be showing me the "This should not be shown" message..
instead it runs the default proc and naturally not to completion due to it not being right.
*********************/


Also furthermore when i run a simple debug text to show me what the equips "Setid" is it simply tells me its /setbonuses and not /setbonuses/testset as it is meant to be.

Maybe im missing something fundamental along the way


EDIT:: Also due to me not wiping my saves after editing that i left in some dif changes.. with the code supplied above it gives a runtime error.


EDIT2:::
In my equip proc i changed the..
        if(O.setid)  /***********LINK TO THE SETID***/
O.setid.check_pieces(src, O)

/***********TOOOOO*///////
if(O.setid)
var/setbonuses/sett = new O.setid()
sett.check_pieces(src, O)


which now successfully runs the required procs with the needed info