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
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top