Making this spell - MUI

PooBucket

New Member
Reaction score
12
Hey. This is a spell that is from Harry Potter which I've been mucking around with but I can't get it to be MUI (seems complex..:S lol). It's an aiming spell (that is, not homing like most of Warcraft spells - Storm Bolt, etc) which when comes close to a target, stuns and deals damage to it. When two are cast after each other, one goes straight through the target but the other does damage and stuns.

Code:
Stupefy
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Stupefy 
    Actions
        Set CasterPos = (Position of (Triggering unit))
        Set CastTargetPoint = (Target point of ability being cast)
        Unit - Create 1 Stupefy for (Owner of (Triggering unit)) at CasterPos facing CastTargetPoint
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Trigger - Add to Stupefy Hit 1 Copy <gen> the event (Unit - A unit comes within 80.00 of (Last created unit))
        Custom script:   call RemoveLocation (udg_CasterPos)
        Custom script:   call RemoveLocation (udg_CastTargetPoint)

Code:
Stupefy Hit 
    Events
    Conditions
        ((Triggering unit) belongs to an enemy of (Owner of (Last created unit))) Equal to True
    Actions
        Unit - Kill (Last created unit)
        Set StupefyHitPos = (Position of (Triggering unit))
        Unit - Create 1 Dummy Spellcaster for (Owner of (Last created unit)) at StupefyHitPos facing Default building facing degrees
        Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
        Unit - Add Stupefy (Stun) to (Last created unit)
        Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Triggering unit)
        Custom script:   call RemoveLocation (udg_StupefyHitPos)

Code:
Spell Movement
    Events
        Time - Every 0.04 seconds of game time
    Conditions
    Actions
        Set SpellMovementGroup = (Units in (Playable map area) matching (((Level of Spell ID  for (Matching unit)) Equal to 1) and (((Matching unit) is alive) Equal to True)))
        Unit Group - Pick every unit in SpellMovementGroup and do (Actions)
            Loop - Actions
                Set SpellMovementPos = (Position of (Picked unit))
                Unit - Move (Picked unit) instantly to (SpellMovementPos offset by 25.00 towards (Facing of (Picked unit)) degrees)
                Custom script:   call RemoveLocation (udg_SpellMovementPos)
                Custom script:   call DestroyGroup (udg_SpellMovementGroup)

Btw Spell ID is really just to identify the difference between a missile and a caster to simplify the Spell Movement Trigger. I use a dummy to cast the spell when the missile hits because it's much easier and simpler since the missile is moving too quickly to cast the spell.
Also, can I use these two variables,
Set CasterPos = (Position of (Triggering unit))
Set CastTargetPoint = (Target point of ability being cast)
for all my other spells as well (that are similar to this one)? Or do I need to make individual variables for each one? +Which condition should I use if I want the spell to be able to hit teammates as well + enemies but not myself?

Any helpers? :p. Thanks! :D
 

HeX.16

Isn't Trollin You Right Now
Reaction score
131
Can i do it in Jass?

Attached, did it in GUI, should be full MUI because of the use of indexing.
 

Attachments

  • Stupefy.w3x
    26.8 KB · Views: 232

PooBucket

New Member
Reaction score
12
Sorry to disappoint you, but I'm illiterate in JASS :p
It looks so complicated! D: I'll spend quite a while translating all that...
A few questions (and perhaps more later... cuz I'm not extremely great at this stuff...)

What's that imported dummy thingie?

Also, I don't understand how Stupefy3 works in conjunction with 1 and 2 in the Movement trigger (basically, the entire use of indexes...). Can you also please explain how the loop works? Because I've never really understood loops, (except the basic function of repeating something...).

And what's the purpose of the Preload trigger?
 

hgkjfhfdsj

Active Member
Reaction score
55
[link] explains the indexing method and each line

Stupefy3 is a (safe) changeable IntegerA/B. sometimes when looping through instances, you would want to reverse 1 step back so as to not miss any of the total at the time of removing an index from the list. how 1 instance may be missed is also explained in the link.

vexorians dummy model is an empty model containing the origin, chest and overhead attachment points/animation. its used for casting dummy spells and special effects. i suppose someone else can fill in what its good for as oppose to a normal unit with no model. (i think the bone extends the z angles limitation or something and other useful stuff.)

preloading the sfx/dummy/spells prevents lag on first appearance ingame. there might not be any visible lag with 1 lvl spells eg., but spells with 25+ levels on first cast/learnt spikes. preloading prevents this.
 

PooBucket

New Member
Reaction score
12
Do you mean by using the function For Each Integer Variable, it includes A and B together? Problem is I don't quite get what For Each Integer A/B means... :eek:
And so does that mean Stupefy3 does not have an initial value?

Btw I didn't find that link very helpful :eek:... probably cuz I don't understand the For Each Integer part... with the unset variable.
 

0WN3D

New Member
Reaction score
15
I can explain teh Loop Integer A part ^^.... Well lets see....
Lets say For each Integer A 1 to 10.. That means it will loop 10 times
(Say u add a creat unit action in the loop then 10 units will be created)
Then lets say... its the 1st loop so Integer A = 1
loop 2 Integer A = 2
so on and so forth
Also waits do not work in loops FYI
Summary
For each Integer A 1 to X will loop X times
In loop Y Integer A = Y
 

hgkjfhfdsj

Active Member
Reaction score
55
well, Stupefy3 is initialized with 0 as its value (i think all non-usercreated globals are at least initialized with a value..)

For Integer A/B are repeat loops as you say. 'Integer A' is the loop number it is currently in (as 0WN3D said)
the default 2 references worldeditor gives are Integer A and Integer B (in case you want to nest a loop in another). Stupefy3 is a custom made one and so as instanceIndex in the link. (in fact, Integer A/B when converted are functions that return an integer.)
 

PooBucket

New Member
Reaction score
12
I see. So obviously the loops are to go through each running instance of Stupefy, but how does Stupefy3 work as an index when it is changeable between A/B (I don't get that btw). And how can it refer back to the previous running instance if the indexes don't match up to Stupefy2... I mean, when the cast begins, everything is indexed as Stupefy 2, but then when the trigger moves the spell, it uses Stupefy3, don't really understand that :S. And is it possible to create a universal trigger for all spells that move like Stupefy3 so as to avoid lag :S.

The help is really useful too btw :D understand more now ^^.
 

HeX.16

Isn't Trollin You Right Now
Reaction score
131
Stupefy2 is just to save the current cast number. Which avoids the variables and what the are set too, too be overwritten. So it wont move the wrong units or bug.
Stupefy3 is just an integer, not an idex. This integer is used in the loop again so its current progress in the loop CANT be overwritten by the next cast. Using Integer A or B would make its current loop progress lost as Integer A or B is used again, causing bugs.
 
General chit-chat
Help Users

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top