Tutorial Making MUI spells in GUI

Flare

Stops copies me!
Reaction score
662
ah, cohadar, you and your caveman planes :S

before you say "omg go learn jass" and all the rest (as you do), the tutorial is for people who are either a) too lazy or b) dont have the time to learn JASS, not so much for my own usage (would be pretty dumb to write a whole tutorial so i could do something i already knew).

well, unless anyone has a suggestion on something that should be added to the tutorial, its pretty much complete i think.
 

Sil3nt

SUP?
Reaction score
134
Yeh people like me =]
Ill re read the tutorial tommorow or something and see if anything could be added or changed although i think you pretty much got everything done.
 

wewso

New Member
Reaction score
11
Very usefull and well written. Also organised and good for selective reading. I easily extracted what I needed from the text.

++Rep to Flare :)
 

dannyboydude

Ultra Cool Member
Reaction score
33
lovely now i get what making a spell mui means i would +rep u but im in debt with rep so lol


this post helped me understand how to make my spellls all mui and no waits


so thx again flare


~Dbd~
 

black.sheep

Active Member
Reaction score
24
THNXS ALOT, ive been trying to make a spell mui for days, trouble is i didnt know where to start and its made it pretty wierd (50) instances of it end up running >.> but now i should be able to fix it.
+rep
 

Prediter[BuB

Well-Known Member
Reaction score
35
a quick question do i have to make a new custom value for every spell like for the first one use custom value then customvalue2 for the next spell ect?
 

Flare

Stops copies me!
Reaction score
662
You can use the same variable if you want, but it does limit the maximum number of instances for each spell, even though you can just increase the limit here
Code:
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                CV2 Less than [B]1000[/B]
            Then - Actions
                Set CV2 = (CV2 + 1)
            Else - Actions
                Set CV2 = 1
(change the 1000, and you've changed the maximum instance limit)

1000 is, in my opinion, perfectly safe for a bundle of spells (you could get 10 spells, assuming they weren't going to be spammed) - it's very unlikely to get 1000 spell casts with 10 spells, unless you had 100 units per spell OR the spells lasted for a lengthy duration
 

Fluffball

Well-Known Member
Reaction score
35
Why don't you change the Big If/Then/Else with this

Code:
If (MUIFix Less than 1000) then do (Set MUIFix = (MUIFix + 1)) else do (Set MUIFix = 0)

Saves a bit of space
 

Flare

Stops copies me!
Reaction score
662
(1) I have no reason to do so, it's the same effect in the end
(2) I prefer having it like that (it's more readable than placing everything into a single line)
(3) If you don't like using the If (Multiple Conditions), then just use the single line If, there isn't anything stopping you...
(4) Your casting trigger is either going to be relatively short (setting variables, adding dummy to group) or relatively long (doing something other than setting variables), and saving a bit of space won't change that
 

looneygr

New Member
Reaction score
0
Why not adding a "Cleaning Up Leaks" part in this tut?
My question is:
Should i use
Code:
custom script: call DestroyGroup (udg_DummyGroup)
somewhere in the code or it isn't necessary? Talking about the unit group that has all dummy units.
 

ChaosWarlock

New Member
Reaction score
7
First - This is AWESOME! Thanks so much for sharing this I will get a TON of use out of it. :thup:

I didn't read through all of the replys so I'm sorry if this has been said before. In the first example, can you eliminate having to use the variables that have to do with the duration of the spell (CurrentDuration & MaxDuration) by adding an expiration timer to the dummy unit?
 

Jolly chap*

New Member
Reaction score
34
Excellent tutorial. I've only learned MPI and all but MUI is nice to learn. Though, I don't think I'll need MUI on a project I'm working on, but thanks for the tutorial anyway.

It's a bit hard to read sometimes because there are gargantuan blocks of text in some parts of the tutorial. Indentation could be nice and maybe some more Bold text and Underlined text. But I've learned a lot from this anyway even w/o that. +rep to you. :D
 

Sungazer

New Member
Reaction score
0
Great job, Flare! This tutorial and the technique you came up with are quite impressive.

That being said, I don't understand it 100%, and I'm struggling with applying it to my first-ever custom ability (quite new to the scene.)

Now I have the ability "working" in single-player mode, but due to the Wait's I designed it with, it's not MUI. I say "working" because when I realized I had to start re-working the spell to be MUI, the single-player-friendly version would "randomly" lock-up at the end of the cast.

Anyway, here's the Trigger as it exists currently:

Code:
Phoenix Storm Level 1
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Unknown (A000)
        (Level of Unknown (A000) for (Triggering unit)) Equal to 1
    Actions
        -------- Storm Begins --------
        Set CastingUnit = (Casting unit)
        -------- ** Pause CasterUnit ** Give CasterUnit Crow Form ** Turn CasterUnit ** Shake Camera ** Lift CasterUnit ** Slow CasterUnit Animation to 85% ** --------
        Unit - Add Crow Form to CastingUnit
        Unit - Make CastingUnit face 250.00 over 0.50 seconds
        [b]Wait 0.50 seconds[/b]
        Camera - Shake the camera for Player 1 (Red) with magnitude 4.00
        Animation - Change CastingUnit flying height to 250.00 at 375.00
        Animation - Change CastingUnit's animation speed to 85.00% of its original speed
        -------- Summon 5 Phoenix every (Index x 72) Degrees --------
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                Set PhSummonIndex = (Real((Integer A)))
                Animation - Play CastingUnit's death animation
                [b]Wait 0.30 seconds[/b]
                Unit - Create 1 PhoenixRain for Player 1 (Red) at ((Position of CastingUnit) offset by 325.00 towards ((PhSummonIndex - 1.00) x 72.00) degrees) facing Default building facing degrees
        -------- Order the 5 summoned Phoenix to move to the caster and explode --------
        Animation - Play CastingUnit's stand animation
        Unit Group - Pick every unit in (Units of type PhoenixRain) and do (Unit Group - Order (Units of type PhoenixRain) to Move To (Position of CastingUnit))
        [b]Wait 0.40 seconds[/b]
        Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type PhoenixRain) and do (Unit - Explode (Picked unit))
        -------- Cause Damage - Create 5 Flamestrikes where the Phoenix exploded --------
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                Set PhStormIndex = (Real((Integer A)))
                Special Effect - Create a special effect at ((Position of CastingUnit) offset by 155.00 towards ((PhStormIndex - 1.00) x 72.00) degrees) using Abilities\Spells\Human\FlameStrike\FlameStrike1.mdl
                Unit Group - Pick every unit in (Units within 300.00 of (Position of CastingUnit) matching (((Matching unit) belongs to an enemy of (Owner of CastingUnit)) Equal to True)) and do (Unit - Cause CastingUnit to damage (Picked unit), dealing 60.00 damage of attack type Spells and damage type Fire)
        [b]Wait 1.00 seconds[/b]
        -------- Undo all changes to CasterUnit --------
        Animation - Change CastingUnit's animation speed to 100.00% of its original speed
        Animation - Change CastingUnit flying height to 0.00 at 420.00
        Unit - Remove Crow Form from CastingUnit
        Unit - Set CastingUnit movement speed to (Default movement speed of CastingUnit)
        Camera - Stop swaying/shaking the camera for Player 1 (Red)
        -------- Storm Ends --------

If anyone would be willing to give me a hand engineering the conversion, I'd greatly appreciate it. In the meantime, I'm going to continue picking this tutorial apart and try to construct the logic/pseudo-code for how to apply the system to my spell and update my progress here. (not looking to have my hand held)

Obstacles atm:

* I have four different waits in the spell, one of which is inside a loop. The waits were "necessary" in the original design to allow for animations like the caster turning, interrupting the caster's dying animation to catch that sweet lightning ripple, etc.

In the example AoE spell, the two "waits" are the Impact Delay and Spawn Interval. Will I need four different Real arrays for each wait?

* The spell is designed to summon the Phoenix in a pentagon around the caster using 72 degree angles. I was creating these angles by using the index of the loop they were in which went up to 5. Am I going to have to create another integer array with max size 5 and use TempIntegers to keep track of which element I'm in?

Thanks,

- Sungazer
 

Sungazer

New Member
Reaction score
0
Well I got so frustrated with this thing I decided to go ahead and start teaching myself some JASS to see if I could make any sense of it, and I realize why I was getting so confused.

Here you have:

Code:
Unit Group - Pick every unit in DummyGroup and do (Actions)
    Loop - Actions
        ...

I was getting hung up on this Loop because I couldn't figure out when it ended. Then I looked at this section of code in JASS, and it comes out like this:

JASS:
call ForGroupBJ( udg_DummyGroup, function Trig_Meteor_Shower_Periodic_Func002A )


So it's a For loop that runs until there are no more units to process in DummyGroup right? That's what I thought originally, but what's confusing me now, is why does this spell keep going after only a single cast?

The "Meteor Shower Cast" Trigger only adds 1 Dummy Unit to DummyGroup once the effect of the ability begins. So in my mind it goes like this:

When CV1 = 0
* User hits "Meteor Shower"
* Set CV1 = 1
* Caster[1] = Triggering Unit, CasterLoc[1] = Pos. of Trigg. Unit
* DummyUnit created
* DummyUnit added to DummyGroup (# of units in DummyGroup = 1)

Now comes "Meteor Shower Periodic":

* For every unit in DummyGroup (1), do actions

Now unless I'm mistaken, there is only ONE DummyUnit in DummyGroup, but this spell goes off TWENTY-SIX times! Where the hell is the 26 coming from?

Then I thought about it a little longer and realized that if you don't interrupt the spell by moving (can't be turned off?), it stays in "cast mode" so it would fire "Meteor Shower Cast" repeatedly until interrupted, right? But that's not the case either! It always stops at the "seemingly random" 26!

What gives? Is this an infinite loop that the World Editor cuts off after 26 iterations? Why doesn't it do this for other infinite loops?

+Rep to anyone who can clear this up for me.


EDIT: LOL, I just saw this while reading over one of Vexorian's awesome JASS tutorials:

An if may have as many elseif as you want, I think there is a limit but it was something like 26.

There's no way that's a coincidence. 26 elseif 's, eh? But I don't see any elseif 's anywhere in the code, in the GUI or JASS version. Does that rule extend to more than just elseif 's? And if this is somehow the answer to where the 26 is coming from, how then would you make this loop infinitely?
 

vypur85

Hibernate
Reaction score
803
The group thing is only needed for GUI because it helps to make something MUI (not in all cases, but possible for all cases...depending on how you do it). Using JASS wouldn't require you to utilise the unit group. It's more direct and less complicated.

For your wait thing, you just need localise an integer and implement Flare's tutorial.
Code:
Example
Event
Condition
Actions
 Custom script:  local integer udg_LocalInteger
 If Integer < 1000 then
   Set Integer = Integer +1
 Else
   Set Integer = 0
 Set Local_Integer = Integer
 ---------------------------------------------------
 Set Unit[Local_Integer] = YourUnit
 ---other actions---
 Wait 4.00 seconds
 ---other actions---
 Wait 4.00 seconds
 ---other actions---
 Unit - Kill Unit[Local_Integer]

The above is MUI.
 

Sungazer

New Member
Reaction score
0
Hmm, I apologize, but I realized I don't understand your example. You declared:

"udg_LocalInteger" and then Set a different variable called "Local_Integer" using a GUI Action that only works on Global variables in the first place.

Still confused about that darn 26 that popped up in Flare's Meteor example too ;\
 

Flare

Stops copies me!
Reaction score
662
All global variables declared in the Variable Editor are prefixed with udg_ (you just never see it in GUI actions). vypur's method is just taking advantage of the fact that local integers take precedence over global variables of the same name, so if you declare a global variable called "MyString", and then declare a local variable called "udg_MyString", any actions within that trigger that use MyString (unless in a separate function, like unit group loops, or If conditions) will use the local variable, allowing the variable to maintain it's value past waits (unlike globals, which are liable to be overwritten).

In effect - if you declare a local variable in a trigger with the same name as a global variable (without forgetting the udg_ prefix for the local), any actions that aren't part of If conditions, or Unit Group loops, will use the local variable if they try to reference the global e.g.
Trigger:
  • Actions:
    • Custom script: local integer udg_MyIntVar
    • Set MyIntVar = Random integer between 1 and 100
    • Display to All Players the text: &quot;Before wait - &quot; + Int2String (MyIntVar)
    • Wait 15.00 seconds
    • Display to All Players the text &quot;After wait - &quot; + Int2String (MyIntVar)


If you fire that trigger multiple times, you will see corresponding values in the messages i.e. if the first "Before wait" message displays 72, the first "After wait" message will also display 72. If you didn't use a local variable, the numbers wouldn't correspond to each other

And what 26 in my Meteor example?
 

Sungazer

New Member
Reaction score
0
When use Meteor Shower, 26 "meteors" fall before the loop ends. To me, the loop should only go once (1 Dummy Unit), or infinitely because the Dummy Unit is added repeatedly.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top