• 🏆 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!

Hashtable MUI Question

Status
Not open for further replies.
Level 9
Joined
Nov 28, 2008
Messages
704
If you could rephrase it would be great, but as I have it translated:

"If I make my spell MUI with hashtables and I use the same trigger twice (copied), and I save all of the values in a different hashtable in each one, will it have any problems?"

If that is your question, using a different hashtable or not makes no difference in MUI, because the hashtable key is usually based on a timer or some sort of unit. In this case, you can use the SAME hashtable and it wont matter.

However, if you're trying to save values to one hashtable and get them from a different one, there is no way in hell it will work. You have to get your values from the same hasthable you saved them to.
 
Level 10
Joined
Feb 20, 2008
Messages
448
If you could rephrase it would be great, but as I have it translated:

"If I make my spell MUI with hashtables and I use the same trigger twice (copied), and I save all of the values in a different hashtable in each one, will it have any problems?"

If that is your question, using a different hashtable or not makes no difference in MUI, because the hashtable key is usually based on a timer or some sort of unit. In this case, you can use the SAME hashtable and it wont matter.

However, if you're trying to save values to one hashtable and get them from a different one, there is no way in hell it will work. You have to get your values from the same hasthable you saved them to.


yes my questiion was : "If I make my spell MUI with hashtables and I use the same trigger twice (copied), and I save all of the values in a different hashtable in each one & i use same global variable, will it have any problems?"

but if i use same global variable in those 2 trigger(copied) and saving value in different hashtable it wont glitch ?
 
Level 9
Joined
Nov 28, 2008
Messages
704
DON'T use global variables if you're using hashtables. Hashtables are global variables, in a sense.

What sort of global variables are you using? As far as I can tell, theres no reason you should be using ANY at all, except for one global hashtable.
 
Level 10
Joined
Feb 20, 2008
Messages
448
DON'T use global variables if you're using hashtables. Hashtables are global variables, in a sense.

What sort of global variables are you using? As far as I can tell, theres no reason you should be using ANY at all, except for one global hashtable.

exemple of spell, i know few poeple told me to add variable to make spell cleaner!!
  • KnockbackTarget
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Knockback Single
    • Actions
      • -------- Just for configuration/readability --------
      • Set KnockBackTrig = (Triggering unit)
      • Set KB_POINT[1] = (Position of KnockBackTrig)
      • Set KnockBackTarget = (Target unit of ability being cast)
      • Set KB_POINT[2] = (Position of KnockBackTarget)
      • Set KnockbackAngle = (Angle from KB_POINT[1] to KB_POINT[2])
      • -------- Distance unit is knocked back per second --------
      • -------- .04 is how often the units are moved, so we multiply the distance by .04 --------
      • Set KnockbackDistance = (400.00 x 0.04)
      • -------- How long the unit is knocked back for --------
      • Set KBS_SpellDuration = 2.00
      • -------- Store the values --------
      • Hashtable - Save Handle OfKnockBackTarget as (Key target) of (Key (Target unit of ability being cast)) in KnockBackSingle
      • Hashtable - Save Handle OfKnockBackTrig as (Key unit) of (Key (Target unit of ability being cast)) in KnockBackSingle
      • Hashtable - Save KnockbackDistance as (Key distance) of (Key (Target unit of ability being cast)) in KnockBackSingle
      • Hashtable - Save KnockbackAngle as (Key angle) of (Key (Target unit of ability being cast)) in KnockBackSingle
      • Hashtable - Save KBS_SpellDuration as (Key time) of (Key (Target unit of ability being cast)) in KnockBackSingle
      • Unit Group - Add (Target unit of ability being cast) to KnockbackUnits
      • If ((KnockbackUnits <gen> is on) Equal to False) then do (Trigger - Turn on KnockbackUnits <gen>) else do (-------- do nothing comment,>.> 2 lazy --------)
      • Custom script: call RemoveLocation(udg_KB_Point[1])
      • Custom script: call RemoveLocation(udg_KB_Point[2)
 
Level 10
Joined
Feb 20, 2008
Messages
448
Using globals like that is fine since you aren't accessing those globals at a later time. Once you throw in some sort of time between setting the global and accessing it (wait, timer, etc.) you can run into problems from multiple triggers using the same globals.

i know that using a wait would break MUI but hows about Making a timer hashtable isnt it possible ?!!

thanks for the info and maybe in the hashtable tutorial u should show how to pick in AOE, took me some time to figure it out lol but anyway ^^ Thx for the info :) i mostly use LOOp i dont need timer o_O i never really used timer!

and im thinking we can store location, group, and lot other thing, what they are for ?
 
Level 9
Joined
Nov 28, 2008
Messages
704
A location is a coordinate - x/y point. 0, 0 is in most cases the middle of your map.

And in that knockback example, I would use a timer. o>O

Groups are Unit Groups. They store a collection of units for easy access.
 
Level 10
Joined
Feb 20, 2008
Messages
448
A location is a coordinate - x/y point. 0, 0 is in most cases the middle of your map.

And in that knockback example, I would use a timer. o>O

Groups are Unit Groups. They store a collection of units for easy access.

in that exemple i use a Loop that run evry 0,03 sec!!

i know what a location is but i was talking bout hashtable location!!!

how can u make this with a timer and Being MUI, thats why i use loop
since wyrmLord say timer is more tricky and can be buggy i wont risk myself if my current system work good ^^
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
and im thinking we can store location, group, and lot other thing, what they are for ?
Locations/unit groups/... in a hashtable are still used for the same purposes as in normal variables, or what did you actually ask?

how can u make this with a timer and Being MUI, thats why i use loop
Well, first you need to define a key: in your case "Target Unit of Ability Being Cast".
You store that unit in a unit group (not a hashtable), then you loop a trigger (ever 0.03 sec, as you have said before).
As action, use "Pick every unit in Unit Group - Multiple Actions" and then load all variables inside the hashtable with the key "Picked Unit".
Change the variables if needed (e.g.: change the distance or something) and then save the variables in the hashtable again.
Once a condition is fulfilled (e.g.: final area has been reached), clear the child hashtable with the key "Picked Unit".
You will now have a spell which is time-based.

Timers are tricky indeed, the old spells often used this (and that's why old spells in GUI are rarely MUI).

If you need an example of a spell where 2 child hashtables have been used in 1 hashtable, I have attached a map to this post.
You will notice that I have used "Set GrenadeValues[1] = (Load 0 of (Key (Load 6 of (Key (Picked unit)) in GrenadeTable)) from GrenadeTable)"
The 2 keys here are: "Picked Unit" (the one you can see) and "Caster" (you cannot see this, it is the value "6 of (Key (Picked unit)" that refers to the casting unit).

I have used waits inside the init spell and it works perfectly fine...
Maybe I could've done it otherwise, but I can't see how.
 

Attachments

  • FPS Shooter Game.w3x
    110.9 KB · Views: 85
Status
Not open for further replies.
Top