[EXAMPLE/TIPS] - HashTable Object. Forum Home > Construct Classic > Construct Classic Discussion > Your tutorials & example files |
Post Reply
|
| Author | |
Post Options
Quote Reply
Topic: [EXAMPLE/TIPS] - HashTable Object.Posted: 14 May 2012 at 2:32pm |
|
|
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 .cap Edited by Yaottabyte - 14 May 2012 at 4:10pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 17 May 2012 at 3:28am |
|
|
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)
|
|
|
|
![]() |
|
Post Options
Quote Reply
Posted: 17 May 2012 at 8:22pm |
|
|
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 |
|
![]() |
|
Post Options
Quote Reply
Posted: 21 May 2012 at 2:20pm |
|
|
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! ^_^ |
|
![]() |
|
Post Reply
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |