• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Miscellanous / Other] Player Indexing

Status
Not open for further replies.
Level 4
Joined
May 24, 2017
Messages
93
I just had an idea that I wanted opinions on. Unit indexing is when each unit is given a custom value, but I had this player indexing idea for RPGs or maps where you control one hero/unit. Basically you create variables that have the same number of arrays as players in the the game and you save data using the player number.

So something like unit kills could be saved like this:
  • Set Unit_Kill(Owner of killing Unit) = [Unit_Kill(Owner of killing Unit) + 1]
That would eliminate the use of Unit Indexing in one hero/unit maps. Basically making the player the unit being controlled. I personally want to use this to keep track of resources and guild points. This would work with save/ load systems to because you would just pick every player and save the variables using the player numbers. When they are loaded you would have a variable that would be the new player number to save too.

Does this make sense and would it be efficient?
 
Level 8
Joined
Mar 19, 2017
Messages
248
Yes it makes sense and you can use the integer variable Player Number (returns a Jass function GetPlayerId(player)+1, starting at player Red and onwards). But even in RPGs there will be creeps, bosses, mobs, etc; should you need to store data on them (ie. get the amount of kills a creep had done) you will end up returning (or using your player indexing method in conjunction with) to a Unit Indexer or another massive way of storing data (ie. hashtable).
 
Status
Not open for further replies.
Top