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

Need help for making spells MUI/MPI

Status
Not open for further replies.
Level 3
Joined
Feb 3, 2009
Messages
33
Hello, I'm making a RPG map, and I have something like 70-100 spells, and I think they are MPI, but I would like to make them MUI and MPI to allow players to have the same hero...

Could someone take a look at my triggers and tell me how I can make them MUI&MPI ?

All the heroes' spells are in the Orc part in the custom abilities and all of them have a precise description if you need help understanding some of my triggers ^^

Here is a download link

Thanks for replying !
 
Level 7
Joined
Dec 8, 2008
Messages
243
You should upload your map onto THW, rather than linking to another site. People aren't fond of downloading unknown content. Do you have alpha/beta testers for your map?
 
Level 3
Joined
Feb 3, 2009
Messages
33
No I don't have any testers yet, I don't want people to play this until I have finished making everything working ^^ I still have tons of items to create, quests to add, and spells to fix until I let people play .. Thats also why I dont upload it on here ..
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Ohh, wow... I checked it out and you're really serious about this :D

I've got a few questions:
1) What do you prefer? GUI, JASS or vJASS?
2) If you prefer GUI, would you mind if the spells were in JASS? (If no: would you mind vJASS? Then you'd have to use JNGP and have to save before every test).
3) Can I create utilities in JASS? (The spells won't have to be in JASS, utilities are just to make the spells easier :D).


That'd be it.

Ohh, one more thing: since there are so many of them, I probably won't make them all MUI.


You should upload your map onto THW, rather than linking to another site. People aren't fond of downloading unknown content. Do you have alpha/beta testers for your map?
The maps section is for finished maps.
He asked for help, so that means the map isn't finished and may not be uploaded in the spells section.

The map development section is a completely different story though ^^
 
Level 3
Joined
Feb 3, 2009
Messages
33
Well, thanks for suggesting Jass and vJass, but I would like to do everything in pure and hard GUI .. Also, I only want to learn how to make them MUI + MPI, I don't want people to do it for me, or I won't be able to add more MUI/MPI spells by myself after that ^^

Is Jass the only way to make spells MUI??
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Ohh, no, not at all - I just find JASS easier (you also don't have to remove a lot of leaks with JASS because you can use coordinates more easily).
Additionally, JASS is faster so there really isn't a disadvantage

(Sorry for the long post by the way :D)

Either way, GUI it is:
To start with MUI, the most easy way is hashtables.

Hashtables are sort of double-arrayed variables.
The difference is that normal arrays range from 0 to 8191 (so Var[8191] would be the max, which is 2^13).

Hashtables don't have a maximum array number, so you can store everything in it.
Since all objects in warcraft have an ID which is unique to themselves (usually a number like 1053251 or something, too big for a regular array) you can store data which is specific to each object!

This may seem a bit strange, but think of it like this:

Hashtable["Damage"][Unit ID]
Hashtable["AoE"][Unit ID]

With this simple method, you can store the damage and AoE for a spell for each unit.
If you loop through a unit group with all units casting that spell, you can easily make a spell MUI


How to do it?
Quite easy.



Preparations:

You will need some variables first:
  • A hashtable variable, you don't really need one for each spell, as long as you name each key well enough, like "Key(Fireblast Damage)" it isn't a problem.
  • Variables for all values you want to save (NOTE: you only need 1 variable of each type for all spells you have created, so only 1 Damage-variable is needed for all spells etc)
  • A Unit Group variable (you must create a new variable for each spell you create).

First step: creating the hashtable

  • Hashtable Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set SpellTable = (Last created hashtable)
If something is wrong with your spell, double-check whether you've initialized it.
If you didn't do this, then no values will be saved and the entire spell will fail.

I hope I don't need to explain what this does...


Step two: casting the spell

  • WO I Init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Spell
    • Actions
      • Set Damage = 300.
      • Set AoE = 250.
      • Set Loc = location
      • Unit - Create 1 Spell Dummy for (Owner of (Triggering unit)) at Loc facing 0.00 degrees
      • Custom script: call RemoveLocation(udg_Loc)
      • ------------------ Important ------------------
      • Hashtable - Save Damage as (Key dmg) of (Key (Last created unit)) in SpellTable
      • Hashtable - Save AoE as (Key aoe) of (Key (Last created unit)) in SpellTable
      • Hashtable - Save 0.00 as (Key timer) of (Key (Last created unit)) in SpellTable
      • Hashtable - Save Handle Of(Triggering unit) as (Key caster) of (Key (Last created unit)) in SpellTable
      • Unit Group - Add (Last created unit) to SpellGroup
      • -----------------------------------------------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Spell loop Trigger <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Spell loop Trigger <gen>
        • Else - Actions
Important part:

Here you save all variables you wish to save, do not forget to put the unit (which you used to save all variables in) in the unit group!
Note that if you use a dummy to store all variables in (like I did), the same unit can cast the spell more than once.
If you save all variables for the caster, it is still MUI, but the spell will bug if the same unit casts it more than once.
I recommend using my method (with the dummy), unless you're absolutely positive that it's impossible for the spell to be cast more than once per unit.

At the end, I enable the trigger (if it is enabled all the time, it could slow down the game, which - with your 70+ spells - could be very bothersome.

Step 3:[b/] Looping the trigger

INITIALLY DISABLED:
  • WO I Missile
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in SpellGroup and do (Actions)
        • Loop - Actions
          • Set Timer = (Load (Key timer) of (Key (Picked unit)) from SpellTable) + 0.03
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Timer Greater than or equal to 20.00
            • Then - Actions
              • Unit - Cause (Load (Key caster) of (Key (Picked unit)) in SpellTable) to damage Some unit, dealing (Load (Key dmg) of (Key (Picked unit)) in SpellTable) damage of attack type Spells and damage type Normal
              • ------------------ Important ------------------
              • Unit Group - Remove (Picked unit) from SpellGroup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in SpellTable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in WOMissileGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
              • -----------------------------------------------
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
Important part:

This is similar to cleaning leaks.
You have to clear all values you saved, otherwise warcraft will keep remembering them (and like leaks, this can pile up as well and slow down the game).

At the end, I disable the trigger if no other unit is still casting the spell.
Again, this is so you don't unnecessarily slow down the game.


I believe this is all you need to know about how to use hashtables.
Of course, I made a really simple example, but it's for learning purposes.
If you follow this simple scheme, you should be able to recreate all your spells in MUI rather easily.


There is another method called "indexing", which is equally good as hashtables (some say it's better, some say it's worse... I don't care about all of that: they both work just as good and I haven't noticed any bugs with either of them).
This method is more complex, but it's part of the warcraft MUI tradition (old mappers only had this option to make spells MUI, since hashtables didn't exist in GUI).

Why is this more complex?
Well, because here you are limited to only 1 array in which you can't even save the unit's ID.
So you'll have to assign ID's to units, so the first unit to cast it gets array 0, the second one gets array 1 and so forth.
The hard part is the 'recycling': if the first unit is done casting the spell, then array 0 needs to be recycled so other units can use it - if the second one is done before the first, it needs to go directly to array 1 etc.

If you want to use this method, I highly recommend using this system.
(It also allows hashtable/indexing hybrids).
 
Level 3
Joined
Feb 3, 2009
Messages
33
Thanks a lot for this!! I never used hashtables because i didnt know what it was for^^
Im not getting everything of this, but it will come with practice i guess :D
thank you again!
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
aw nasty... hashtables. The only thing about hashtables that makes me sick is they are not compatable with indexing, either u index, or you hashtable.


I would recomend indexing because it is easier to a point. When you get to spells that use multiple dummy units, multiple targeted units, and multiple casters, then a hashtable is the easier way. But mostly indexing.

  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set Point[0] = that point
    • Set Point[1] = this point
    • Set Unit[0] = That unit
    • Set Unit[1] = this unit
    • Create 1 Unit[0] at Point[0]
    • Create 1 Unit[1] at Point[1]
    • Custom script: Call removelocation(udg_point[0])
    • Custom script: Call removelocation(udg_point[1])
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
aw nasty... hashtables. The only thing about hashtables that makes me sick is they are not compatable with indexing, either u index, or you hashtable.


I would recomend indexing because it is easier to a point. When you get to spells that use multiple dummy units, multiple targeted units, and multiple casters, then a hashtable is the easier way. But mostly indexing.

  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set Point[0] = that point
    • Set Point[1] = this point
    • Set Unit[0] = That unit
    • Set Unit[1] = this unit
    • Create 1 Unit[0] at Point[0]
    • Create 1 Unit[1] at Point[1]
    • Custom script: Call removelocation(udg_point[0])
    • Custom script: Call removelocation(udg_point[1])
Now use that trigger in a loop, with recycling the unused arrays :D

And hashtables are compatible with indexing (check hanky's indexing-hashtable hybrid).
 
Status
Not open for further replies.
Top