• 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.

How to get GUI hashtables to work in Jass New Gen Pack?

Status
Not open for further replies.
Level 6
Joined
Jun 18, 2011
Messages
168
Is there a way to save my map with both hashtable and JASS triggers?

Hashtables were patched in, but I need to use NewGen to save my JASS spells.

Edit: Someone changed my title for me to help make my question more clear.
Perhaps it was Maker that edited it and then poseted, I don't know.
 
Last edited:
Level 13
Joined
Mar 16, 2008
Messages
941
I'm not sure what your problem is?
When the natives were released I had problems too as the NewGen had those GUI functions missing. However, I can use vJass, Jass, GUI including hashtables and everything at ones since these were added later.

EDIT: A true, those keys are buggy. Somehow I'm sure I had a solution, wait some time.
Unable to find it atm, but I'm sure there was something :x
 
Last edited:
Level 6
Joined
Jun 18, 2011
Messages
168
@Justify

I think you seem to understand. I don't know what natives are. I'll try to explain better. I'm trying to save my map in the NewGen Editor because it has Jass triggers. However, I cannot save my hashtable triggers because I am using vers. 1.21b to use NewGen which does not have hastables.

@Maker

Unfortunately, I am not any good with hastables, custom script (other than leak cleaning), or JASS. So, to remake the trigger in that way may be more trouble than its worth. I'll post the trigger in next post.

Anyone have another solution?

Holy crap, Maker is actually the maker of this spell Lightning Speed Lacerations. I call it Flurry in my map. You can see it in action here at 3:00 min. I downloaded it from thehelper.net

  • Init LSL
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- -------------------------------------------------- --------
      • -------- Create hashtable to store all data --------
      • -------- -------------------------------------------------- --------
      • Hashtable - Create a hashtable
      • Set MH_Hash = (Last created hashtable)
      • -------- -------------------------------------------------- --------
      • -------- Abilities --------
      • -------- -------------------------------------------------- --------
      • -------- Lightning Speed Laceration --------
      • Set MH_Ability[0] = Flurry
      • -------- LSL Dummy --------
      • Set MH_Ability[1] = Soul Burn
      • -------- Disable Attack --------
      • Set MH_Ability[2] = Disable Attack
      • -------- -------------------------------------------------- --------
      • -------- Effects --------
      • -------- -------------------------------------------------- --------
      • -------- The effect to be attached on attacking units --------
      • Set MH_Effect[0] = Abilities\Weapons\FaerieDragonMissile\FaerieDragonMissile.mdl
      • -------- The effect to be attached on target on hit --------
      • Set MH_Effect[1] = Abilities\Weapons\GyroCopter\GyroCopterImpact.mdl
      • -------- -------------------------------------------------- --------
      • -------- The attachment point for the effect on the attacker --------
      • -------- -------------------------------------------------- --------
      • Set MH_Attach_Point = weapon
      • -------- -------------------------------------------------- --------
      • -------- Unit type of the dummy --------
      • -------- -------------------------------------------------- --------
      • Set MH_Dummy_Type = Paladin Dummy
      • -------- -------------------------------------------------- --------
      • -------- How many attack animations are you using --------
      • -------- -------------------------------------------------- --------
      • Set MH_Animation_Indexes[0] = 2
      • -------- -------------------------------------------------- --------
      • -------- The animation indexes of your attack animations --------
      • -------- -------------------------------------------------- --------
      • Set MH_Animation_Indexes[1] = 3
      • Set MH_Animation_Indexes[2] = 4
      • -------- -------------------------------------------------- --------
      • -------- -------------------------------------------------- --------
      • -------- Attack duration --------
      • Set MH_Reals[0] = 1.50
      • -------- -------------------------------------------------- --------
      • -------- First Dummy Creation Delay --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[1] = 0.21
      • -------- -------------------------------------------------- --------
      • -------- Dummy Creation Interval --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[2] = 0.12
      • -------- -------------------------------------------------- --------
      • -------- Dummy Visibility Time --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[3] = 1.00
      • -------- -------------------------------------------------- --------
      • -------- Base damage --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[4] = (Real(arthur_attck_dmg))
      • -------- -------------------------------------------------- --------
      • -------- Bonus damage per level --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[5] = 15.00
      • -------- -------------------------------------------------- --------
      • -------- Dummy transparency --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[6] = 50.00
      • -------- -------------------------------------------------- --------
      • -------- Damage delay --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[7] = 0.30
      • -------- -------------------------------------------------- --------
      • -------- Cast delay --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[8] = 0.48
      • -------- -------------------------------------------------- --------
      • -------- Does the spell stun --------
      • -------- -------------------------------------------------- --------
      • Set MH_Booleans[0] = True
      • -------- -------------------------------------------------- --------
  • MH Begin Attack
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to MH_Ability[0]
    • Actions
      • Set MH_u1 = (Triggering unit)
      • Set MH_u2 = (Target unit of ability being cast)
      • -------- -------------------------------------------------- --------
      • -------- The unit handle for hashtable key --------
      • -------- -------------------------------------------------- --------
      • Custom script: set udg_MH_i1 = GetHandleId(udg_MH_u1)
      • -------- -------------------------------------------------- --------
      • -------- Removes the attack ability from the caster, so he does not attack on his own --------
      • -------- -------------------------------------------------- --------
      • Unit - Add MH_Ability[2] to MH_u1
      • -------- -------------------------------------------------- --------
      • -------- Randomizes an attack animation --------
      • -------- -------------------------------------------------- --------
      • Set MH_i2 = MH_Animation_Indexes[(Random integer number between 1 and MH_Animation_Indexes[0])]
      • -------- -------------------------------------------------- --------
      • Custom script: call SaveInteger( udg_MH_Hash, udg_MH_i1 , StringHash( "index") , udg_MH_i2)
      • Custom script: call SaveInteger( udg_MH_Hash, udg_MH_i1 , StringHash( "level") , GetUnitAbilityLevel( udg_MH_u1 , udg_MH_Ability[0] - 1 ) )
      • Custom script: call SaveReal( udg_MH_Hash, udg_MH_i1 , StringHash("x") , GetUnitX(udg_MH_u1) )
      • Custom script: call SaveReal( udg_MH_Hash, udg_MH_i1 , StringHash("y") , GetUnitY(udg_MH_u1) )
      • Custom script: call SaveUnitHandle( udg_MH_Hash , udg_MH_i1, StringHash("target") , udg_MH_u2 )
      • -------- -------------------------------------------------- --------
      • -------- Attach a special effect on the unit and save it --------
      • -------- -------------------------------------------------- --------
      • Custom script: call SaveEffectHandle( udg_MH_Hash, udg_MH_i1 , StringHash("effect1") , AddSpecialEffectTarget( udg_MH_Effect[0] , udg_MH_u1 , udg_MH_Attach_Point ) )
      • -------- -------------------------------------------------- --------
      • Unit Group - Add MH_u1 to MH_Caster_Execute
      • Unit Group - Add MH_u1 to MH_Caster_Stop
      • Unit Group - Add MH_u2 to MH_Images
      • -------- -------------------------------------------------- --------
      • Trigger - Turn on MH Clear Images <gen>
      • Trigger - Turn on MH Start Effect <gen>
      • Trigger - Turn on MH Create <gen>
  • MH Start Effect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to MH_Ability[0]
    • Actions
      • Trigger - Turn on MH Delay Order <gen>
  • MH Start Effect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to MH_Ability[0]
    • Actions
      • Trigger - Turn on MH Delay Order <gen>
  • MH Create
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in MH_Caster_Execute and do (Actions)
        • Loop - Actions
          • Set MH_u1 = (Picked unit)
          • -------- -------------------------------------------------- --------
          • Custom script: set udg_MH_i1 = GetHandleId(udg_MH_u1)
          • Custom script: set udg_MH_r1 = LoadReal( udg_MH_Hash , udg_MH_i1 , StringHash("time") )
          • Custom script: set udg_MH_u2 = LoadUnitHandle( udg_MH_Hash, udg_MH_i1, StringHash("target"))
          • -------- -------------------------------------------------- --------
          • Custom script: set udg_MH_r2 = GetUnitX(udg_MH_u1)
          • Custom script: set udg_MH_r3 = GetUnitY(udg_MH_u1)
          • -------- -------------------------------------------------- --------
          • Custom script: set udg_MH_r4 = LoadReal( udg_MH_Hash , udg_MH_i1 , StringHash("x") )
          • Custom script: set udg_MH_r5 = LoadReal( udg_MH_Hash , udg_MH_i1 , StringHash("y") )
          • -------- -------------------------------------------------- --------
          • -------- Check that the spell timer isn't over and that the caster and target are still alive --------
          • -------- Also check that the unit hasn't moved, thus is still casting --------
          • -------- -------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (MH_u1 is alive) Equal to True
              • (MH_u2 is alive) Equal to True
              • MH_r1 Less than MH_Reals[0]
              • MH_r4 Equal to MH_r2
              • MH_r5 Equal to MH_r3
            • Then - Actions
              • -------- -------------------------------------------------- --------
              • -------- The following values are the delays for creating a dummy --------
              • -------- -------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • MH_r1 Equal to (MH_Reals[8] - MH_Reals[2])
                      • MH_r1 Equal to (MH_Reals[8] + MH_Reals[2])
                      • MH_r1 Equal to (MH_Reals[8] - (2.00 x MH_Reals[2]))
                      • MH_r1 Equal to (MH_Reals[8] + (2.00 x MH_Reals[2]))
                • Then - Actions
                  • -------- -------------------------------------------------- --------
                  • -------- Tracks how many dummies there are --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: set udg_MH_i2 = 1 + LoadInteger( udg_MH_Hash , udg_MH_i1 , StringHash("dummies") )
                  • -------- -------------------------------------------------- --------
                  • -------- Create a dummy attacker --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: set udg_MH_u3 = CreateUnit(Player(15) , udg_MH_Dummy_Type, udg_MH_r2 , udg_MH_r3 , GetUnitFacing(udg_MH_u1) )
                  • -------- -------------------------------------------------- --------
                  • Custom script: call SaveInteger( udg_MH_Hash , udg_MH_i1 , StringHash("dummies") , udg_MH_i2)
                  • -------- -------------------------------------------------- --------
                  • -------- Link the dummy to caster --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: call SaveUnitHandle( udg_MH_Hash , udg_MH_i1 , udg_MH_i2 , udg_MH_u3 )
                  • -------- -------------------------------------------------- --------
                  • -------- Create and attach a special effect on the dummy --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: set bj_lastCreatedEffect = AddSpecialEffectTarget( udg_MH_Effect[0] , udg_MH_u3 , udg_MH_Attach_Point )
                  • Custom script: call SaveEffectHandle( udg_MH_Hash, GetHandleId(udg_MH_u3) , StringHash("effect1") , bj_lastCreatedEffect)
                  • -------- -------------------------------------------------- --------
                  • -------- Make the dummy partially transparent --------
                  • -------- -------------------------------------------------- --------
                  • Animation - Change MH_u3's vertex coloring to (100.00%, 100.00%, 100.00%) with MH_Reals[6]% transparency
                  • Unit - Change color of MH_u3 to (Color of (Owner of MH_u1))
                  • -------- -------------------------------------------------- --------
                  • -------- Limit the life time of the dummy --------
                  • -------- -------------------------------------------------- --------
                  • Unit - Add a MH_Reals[3] second Generic expiration timer to MH_u3
                  • -------- -------------------------------------------------- --------
                  • -------- Adjust stats of the dummy to affect attack speed --------
                  • -------- -------------------------------------------------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (MH_u1 is A Hero) Equal to True
                    • Then - Actions
                      • Hero - Set MH_u3 Hero-level to (Hero level of MH_u1), Hide level-up graphics
                    • Else - Actions
                  • -------- -------------------------------------------------- --------
                  • -------- Retrieve the attack anmation for the caster and play it --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: call SetUnitAnimationByIndex(udg_MH_u3, LoadInteger( udg_MH_Hash, udg_MH_i1, StringHash("index") ) )
                • Else - Actions
              • -------- -------------------------------------------------- --------
              • -------- Reduce the spell timer --------
              • -------- -------------------------------------------------- --------
              • Custom script: call SaveReal( udg_MH_Hash, udg_MH_i1 , StringHash("time") , udg_MH_r1 + 0.03)
              • -------- -------------------------------------------------- --------
              • -------- Check whether damage should be applied or not --------
              • -------- -------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • MH_r1 Equal to (MH_Reals[8] + MH_Reals[7])
                      • MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] + MH_Reals[2]))
                      • MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] + (2.00 x MH_Reals[2])))
                      • MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] - MH_Reals[2]))
                      • MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] - (2.00 x MH_Reals[2])))
                • Then - Actions
                  • -------- -------------------------------------------------- --------
                  • -------- Apply damage --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: call UnitDamageTarget( udg_MH_u1 , udg_MH_u2 , ( udg_MH_Reals[4] + ( udg_MH_Reals[5] * LoadInteger( udg_MH_Hash , udg_MH_i1 , StringHash("level") ) ) ) , true , false , ATTACK_TYPE_NORMAL , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_METAL_HEAVY_BASH )
                  • -------- -------------------------------------------------- --------
                  • -------- Create effect on the target --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_MH_Effect[1] , udg_MH_u2 , "chest" ) )
                  • -------- -------------------------------------------------- --------
                  • -------- If the original caster applies damage, create a dummy and make it cast stunning spell (burning spell for my game) on the target --------
                  • -------- -------------------------------------------------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MH_Booleans[0] Equal to True
                      • MH_r1 Equal to (MH_Reals[7] + MH_Reals[8])
                    • Then - Actions
                      • Custom script: set udg_MH_u1 = CreateUnit(Player(15) , udg_MH_Dummy_Type, GetUnitX(udg_MH_u2) , GetUnitY(udg_MH_u2) , GetUnitFacing(udg_MH_u2) )
                      • -------- -------------------------------------------------- --------
                      • Animation - Change MH_u1's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
                      • -------- -------------------------------------------------- --------
                      • Unit - Add MH_Ability[1] to MH_u1
                      • Unit - Order MH_u1 to Neutral Fire Lord - Soul Burn MH_u2
                      • Unit - Add a MH_Reals[3] second Generic expiration timer to MH_u1
                      • -------- -------------------------------------------------- --------
                    • Else - Actions
                • Else - Actions
            • Else - Actions
              • -------- -------------------------------------------------- --------
              • -------- Spell over, destroy the effect on the caster --------
              • -------- -------------------------------------------------- --------
              • Custom script: call DestroyEffect(LoadEffectHandle( udg_MH_Hash, udg_MH_i1,StringHash("effect1") ) )
              • -------- -------------------------------------------------- --------
              • Unit Group - Remove MH_u1 from MH_Caster_Execute
              • -------- -------------------------------------------------- --------
              • Unit - Remove MH_Ability[2] from MH_u1
              • -------- -------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • MH_r4 Equal to MH_r2
                  • MH_r5 Equal to MH_r3
                • Then - Actions
                  • Unit - Order MH_u1 to Stop
                • Else - Actions
                  • -------- -------------------------------------------------- --------
                  • -------- Kill dummies --------
                  • -------- -------------------------------------------------- --------
                  • For each (Integer loopA) from 1 to (Load (Key dummies) of (Key (Picked unit)) from MH_Hash), do (Actions)
                    • Loop - Actions
                      • Unit - Remove (Load loopA of MH_i1 in MH_Hash) from the game
              • -------- -------------------------------------------------- --------
              • Custom script: call FlushChildHashtable( udg_MH_Hash, udg_MH_i1 )
              • -------- -------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (MH_Caster_Execute is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
  • MH Clear Images
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to MH_Dummy_Type
    • Actions
      • -------- -------------------------------------------------- --------
      • -------- This trigger handles the dummy units --------
      • -------- -------------------------------------------------- --------
      • Set MH_u1 = (Triggering unit)
      • -------- -------------------------------------------------- --------
      • Custom script: set udg_MH_i1 = GetHandleId(udg_MH_u1)
      • -------- -------------------------------------------------- --------
      • Custom script: call DestroyEffect(LoadEffectHandle( udg_MH_Hash, udg_MH_i1,StringHash("effect1") ) )
      • -------- -------------------------------------------------- --------
      • Custom script: call FlushChildHashtable( udg_MH_Hash, udg_MH_i1 )
      • -------- -------------------------------------------------- --------
      • Unit Group - Remove MH_u1 from MH_Images
      • -------- -------------------------------------------------- --------
      • Unit - Remove MH_u1 from the game
      • -------- -------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (MH_Images is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Last edited by a moderator:
Level 6
Joined
Jun 18, 2011
Messages
168
Ok thanks, I guess I'll try to rewrite it with handles. I hope I get lucky and it works.

Maker, did you ever make that spell in JASS, so I can just use it? Any flurry stacks on the hive?
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Ok thanks, I guess I'll try to rewrite it with handles. I hope I get lucky and it works.

Why do you need to rewrite it?

Maker, did you ever make that spell in JASS, so I can just use it? Any flurry stacks on the hive?

I'm going to write it in vJASS, since I'm going to use it in my Powerslave map :)
 
Last edited:
Level 6
Joined
Jun 18, 2011
Messages
168
@ Maker

I thought I would have to change the type of indexing, I didn't realize you understood my problem and were trying to give me the answer all along. I'll see what I can do with this...

... All one needs to do is to save the desired parent key into an integer variable with GetHandleId() using custom script, and use the variable in the GUI action.

You can use custom scripts, like


  • Custom script: call SaveInteger(hash, parentKey, childKey, value)

@SanKaKU

Is that what you're trying to tell me, also?

@Maker

Please, let me know if you get the vJASS version finished. I'd really love to use it in my map. I won't be finalizing my map anytime soon, so it may just be easier for me to use the vJASS version when the time comes.
 
Last edited:
Level 6
Joined
Jun 18, 2011
Messages
168
@Justify

Damn that was a quick reply. I was reading over the thread, realized my mistake, and completely changed/edited that post. However, what you just said might be the quickest or perhaps only solution to getting this trigger working. I just need to get NewGen to save hastables. So...

Edit: Ok, I found those .j files in my NewGen folder. I'm going to google updated blizzard.j and common.j files.

Edit 2: I read they are in the war3.mpq.

Edit 3: Found them in the scripts folder.

Edit 4: I replaced them, I haven't tried putting custom text for the hastable stuff of spell yet
 
Last edited:
Level 13
Joined
May 11, 2008
Messages
1,198
no, you have to find the blizzard.j file in War3Patch.mpq and put it in the jngp\jasshelper folder. then, for custom text/jass, you'll need to put it in jngp\tesh\includes folder as well. i just put it in the tesh\includes and now the functions are listed, finally. i figured this out thanks to Tyrulan from thehelper.net

fyi: custom text looks like this:
148604-albums4808-picture50408.jpg

incidently, i believe i may have found a bug...anyway i think the bug might be related to the cjass bug i discovered awhile ago regarding the /* */ comments.
well, it's somewhat irrelevant at the moment.

custom script is just what jass is. the thing is you can use one liner custom script actions in gui if you like...so...basically when you use custom script in gui, you're really using jass while using gui.

so, custom script is custom text except that it's only a single line of custom text in an otherwise gui trigger.
custom text is jass triggers. a jass trigger can be written from scratch, or converted from an entire gui trigger to jass and then edited further, if desired.

using custom script is like writing just a tiny part of a jass trigger into a gui trigger.

edit: well now that can't be right or i did something stupid because now i'm getting 100 errors.
edit2: i guess at some point i forgot to quit editor and start it back up...silly me
 
Last edited:
Status
Not open for further replies.
Top