Storage system advice concerning talent system

Embrace_It

New Member
Reaction score
9
I'm making a sort of talent system for my project that will allow heroes to have talents that affect their abilities etc.

However, I was wondering what kind of system to use to store these details?
I considered using the native hastables so far.

Also, the structs containing the info will have array members so AIDS is not an option. This will be something only heroes can have.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Using an hashtable would be fine, link the handle unit as an integer with the rawcode of the affected ability, to store a struct index.
 

Embrace_It

New Member
Reaction score
9
Ok :) so simply use the hero has the parent argument and whatever suitable thing for child argument?
 

Embrace_It

New Member
Reaction score
9
For example:

call SaveInteger(myhashtable, myHero, ..., 'A001')

Sorry, but its my first time using hashtables, so I'm may seem a bit slow :p

If I don't want to limit this to 1 hero per player, what would be a good way to store each hashtable?

Wow! After reading this again, I realized how stupid it was. I've got it now I think, thanks! :)

Since this approach would use GetHandleId(...), would it be compatible with other indexing systems? (maybe if they didnt use SetUnitUserData?)
 

the Immortal

I know, I know...
Reaction score
51
Erm, this approach has nothing to do with Unit User Data. At all.

In order I'm right assuming your talents are similar to WoW's one for examples, to use it i'd say organise it in something like 'dat:
[ljass]call SaveInteger(ht, GetHandleId(<HERO>), StringHash(<NAME OF TALENT>), <LEVEL OF TALENT FOR HERO>)[/ljass]
Or, oh, simply saving rawcode of the ability affected (if no ability is affected by more than 1 talent) instead of StringHash(<name>).
You would need only one hashtable for all heroes / players, no matter how many.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Instead of StringHash, just use keys (new pseudo type of vJass, basically it's just a constant integer, but you don't need give it a value, and each key got an unique value)
 

Embrace_It

New Member
Reaction score
9
Thanks for the clarifications, and advice!

@ the Immortal: What I meant was that some indexing systems change a unit's game id, and that might complicate things with GetHandleId(...), but I'm not really sure though.

I'll get to coding right away! :thup:

EDIT: Another thing though :p, could I also store the struct's integer (since structs are integers) in a hashtable as well? I think I read somewhere that it doesnt work anymore though...
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
you could save struct data in hashtables cause my map uses it and works fine and a system of mine and works fine too.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top