• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Only one per type of item system

Status
Not open for further replies.
Level 10
Joined
Feb 27, 2016
Messages
617
sorry i dont really know how to explain it in a title so i think i will explain it here:
so for example in an RPG you cant wear 2 chest plates or even your full invetory so what i wanna say if you have already one chest plate and you want to take two there comes a warning that you cant wear 2 chest plates and and that you cant wear 2 chest plates

sorry i really dont know how explain it
 
usually it's done using item level. For example all chest pieces will have item level 1, all boots will have level 2, etc.
When you pick up an item, you check if you don't already carry an item with same level. If you do, you drop the picked item and write an error message.

I don't know how big level an item can have, so there may be some limitations. The other option then would be to create for example an array or hashtable where you save each item and define its class and use that for checking stuff.
 
Status
Not open for further replies.
Back
Top