Best way to do weapons and armor with different attributes

squeeb

  • Posts: 1617
is there a kit or anything already made that has the logic to have a player with different stats.  attack defense ect.. and weapons and armor that can change the attributes to the players attack defense ect?
if not... whats the best practice to program this kind of logic?

Rimrook

  • Posts: 251
Oh geez its pretty complicated. I'd say look into Maps and create a sort of dictionary of items and attributes. Also, for weapons, that's a little different. I created a scene behavior that also acts like a dictionary of programmed actions for the player to go through depending on the weapon equipped. It's a lot of work but its worth it.

Inventory is yet another monster....

... but possible.

squeeb

  • Posts: 1617
cool! thank you for the response.. ill do a little reading..

t4u

  • Posts: 418
Tips:
- Keep player unequipped stats  seperate from equipped stats (this is actual variables you will use in fights)
- recalculate equipped stuff whenever you are putting on armors or leveling up.

Handling inventory:
- I would say give each item an index regardless of type. For example #0 - would be a normal shield #1 epic shield #2 - stick #3 -s word etc.
- As you get a sword form the world you add index of foudn item to the lsit representing your "Inventory"
- As you open your inventory you ask "InventoryHandler" what picture to put for each item in "Inventory"
- "Inventory Handler" is list of lists if you ask outer list for idnex #0 it will return "ItemDescription"
- "ItemDescription" holds actual stats and infos about tyour weapon

Example of "ItemDescription"
#0 type (0=sword, 1= shield, 2=armor)
#1 damage (cna be 0 for shields if 0 jsut dont display it)
#2 defence
#3 health bonus

Example:
- Player wants to put on armor by clicking actor which holds index
- Actor asks "InventoryHandler" for info about myself
- type == 2 so its ok to put on armor (we dont want to have armor put on in sword slot)
- since its ok update equipped stats:
       - attack = natural attack + sword attack bonus + armor atack bonus + shield attack bonus
      - defnece = smae as above
     - helath same as abve
 
USE PICTURES WHEN YOU ASK SOMETHING!
If I helped you be sure to mention it in your game.

Tutorials + downloads:
http://t4upl.blogspot.com/

squeeb

  • Posts: 1617
nice!! that should work out pretty well.. ill start on this soon :)