[EXAMPLE/TIPS] - HashTable Object.

Post your own tutorials, guides and demos.

Post » Mon May 14, 2012 2:32 pm

Hi There is a couple of examples and tips about usage of HashTable Object.

* Sometimes you asked, how to create dynamic vars or local vars, well there is a way to do that. Right with hashtable object.

The first you need will be an Function object, obviously from where to call your routines and where to put the local vars.

At start of your 'on function' condition, using the 'Checks if exist key' condition but negated, you ensure the new var or 'key' isn't being used, once this checks availability, then create the new var with 'insert key' action, giving name and initial value. Afterwards you may use your local as you desire.

At the end of the function, if you dont like save locals then use the 'delete all keys' action to clear the locals Hashtable.

Picture below shows how looks the event sheet.



This is useful when you don't desire to have a lot of globals.

* Other particular usage for hashtables what i recently applied is, when trying to do a techtree system. this is a cheaper techtree system what i designed, using hastable.

Well, first i do need is to clearify my concept about techtree. this is, techtree i could define it as a set of abilities or skills inside the game those player gets access when reached some requirements, lets see the example below:



In the picture you may notice my idea of a techtree, in that sense, we could say, experienced skill needs medium skill 1 at level 4 and medium skill 3 at level 2, in order to player gets access to that skill.

Well, we may define for each skill, item or key a 'key' inside the hashtable, in this case i called it 'Playerdata' the hashtable, too i stored a key with the name list of each skills this with access purpose later. We'll need too an extra 'key' for requirements for each skill 'key'

Next, we need a function to call for check the techtree, every time a new skill is granted we need to check for the techtree unlocks, lets see the event sheet to try better understanding.




I espect this be useful... any question post it
^_^

EDIT: After some fixing here is the .cap if you want give it a try... get fun.

The .capYaottabyte2012-05-14 16:10:01
B
4
S
1
G
1
Posts: 69
Reputation: 863

Post » Thu May 17, 2012 3:28 am

It's a shame, you don't get any comments. Not only is it a fine example of using the hashtable object, but also something, many people wanted to have an example for. (This and hashtable/array-based inventory)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu May 17, 2012 8:22 pm

Hey, thank you for that, looks really advanced
For the inventory array thing, I got a really cool array based example from the russian construct site. Looks like diablo inventory :P
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Mon May 21, 2012 2:20 pm

Hi guys @tulamide, @zyblade, thanks for comments, well I just want to share with community my examples, I have a lots still to share, this one is been used in my current project "Deep Space"... while this can be useful comments may lacks, but I'll thanks any comments... espect community appreciate this...

Thanks!
^_^
B
4
S
1
G
1
Posts: 69
Reputation: 863


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests