Help with a knockback spell?

Tarivol

New Member
Reaction score
2
Trigger:
  • Combat Knife
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Com|cffffcc00b|rat Knife (Neutral Hostile)
    • Actions
      • Set KnockTo = ((Position of (Target unit of ability being cast)) offset by 500.00 towards (Angle from (Position of (Casting unit)) to (Position of (Target unit of ability being cast))) degrees)
      • For each (Integer A) from 1 to 100, do (Actions)
        • Loop - Actions
          • Set MoveTo = ((Target point of ability being cast) offset by 3.00 towards (Angle from (Position of (Target unit of issued order)) to KnockTo) degrees)
          • Wait 0.01 seconds
          • Unit - Move (Target unit of ability being cast) instantly to MoveTo


So, I'm a little confused by what's going on with this trigger; Notably, this isn't something I came up with, it's something I saw in a tutorial on youtube.

First off, I'm not entirely sure I understand what exactly is going on with the trigger; for example, why is knockto being set with a 500 offset? If anyone can explain the laymens terms happenings behind this trigger, that would be much appreciated..

And second off, the trigger isn't doing what I want it to. Basically, it's supposed to move the unit back, in a slide, 300 units; Instead, it seems like only the bash portion is reliable, as it's based on firebolt (neutral hostile). Is the base spell causing the problem? The cast range for the ability is 200, it has no cast time.. The above trigger seemed to work fine for the guy who posted the tutorial, but when I test it, it seems to sometimes teleport the unit it targets a small distance, and that's only sometimes.

Can anyone give me some insight?
 

Tarivol

New Member
Reaction score
2
Alright, so, after talking the trigger out to my wife, who tolerates my insanity, I've come up with the following logic;

When a unit finishes casting the spell,

set the variable knockto = a point, along a line drawn from the caster, to the target, 500 units behind it,

count from 1 to 100, and at each number along the way,

set moveto = 3 units behind where the unit currently is, towards knockto

wait for a hundredth of a second

move the unit there.

After some reviewing of the trigger on my own, I've edited it to look like this;

Trigger:
  • Combat Knife
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Com|cffffcc00b|rat Knife (Neutral Hostile)
    • Actions
      • Set KnockTo = ((Position of (Target unit of ability being cast)) offset by 500.00 towards (Angle from (Position of (Casting unit)) to (Position of (Target unit of ability being cast))) degrees)
      • For each (Integer A) from 1 to 100, do (Actions)
        • Loop - Actions
          • Set MoveTo = ((Position of (Target unit of ability being cast)) offset by 3.00 towards (Angle from (Position of (Target unit of ability being cast)) to KnockTo) degrees)
          • Wait 0.01 seconds
          • Unit - Move (Target unit of ability being cast) instantly to MoveTo


But it's still not doing what I want it to.
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
remove the wait action. And set the event to "Starts an effect of an ability".
It should work.
 

Tarivol

New Member
Reaction score
2
Three things, in response; well, four

first, thank you for replying ^^

Second, I thought we picked 'finishes casting a spell' in order to keep people from stopcast abusing trigger enhanced spells?

Third, do I have the logic of the spell more or less correct?

And four, why is the wait messing it up?
 

Ayanami

칼리
Reaction score
288
Nope, Starts an effect on an ability event triggers when the spell is actually cast. So it can't be spammed. "Begins casting an ability" is the event that can be spammed.

Okay about your trigger. Using waits inside loops are bad. It screws up all the same integer loops that are running in your map. Basically, what your trigger does is that it moves the unit by 3 distance every 0.01 seconds for 100 times. So it would finally result in 300 distance over 1 second.

My suggestion to you is that you don't use loops. Create a periodic trigger that moves the unit. If you need help with this, I'll be glad to help you out.
 

Tarivol

New Member
Reaction score
2
I would love it if you could present an idea about how to do so; I'm incredibly new to warcraft mapmaking, and while the triggers seem at least partially intuitive, I'm being halted by a lack of knowing what's available.

Also, why are loops in general bad? I'm currently using a loop setup to spawn the heroes the players control via a dialogue button at the beginning of the map; Do I need to consider changing that, as well?
 

Ayanami

칼리
Reaction score
288
Loops aren't bad. If you add a wait in the loop, then it's bad. Real bad.

Okay, so here's the general idea for the trigger.

Trigger:
  • Combat Knife
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Com|cffffcc00b|rat Knife (Neutral Hostile)
    • Actions
      • Set Caster = (Triggering unit)
      • Set Target = (Target unit of ability being cast)
      • Set CasterLoc = (Position of Caster)
      • Set TargetLoc = (Position of Target)
      • Set RealAngle = (Angle from CasterLoc to TargetLoc)
      • Custom script: call RemoveLocation(udg_CasterLoc)
      • Custom script: call RemoveLocation(udg_TargetLoc)
      • Trigger - Turn on Combat Knife Periodic <gen>
      • Wait 1.00 seconds
      • Trigger - Turn off Combat Knife Periodic <gen>


Trigger:
  • Combat Knife Periodic (Initially Off)
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Set TargetLoc = (Position of Target)
      • Set Offset = (TargetLoc offset by 12.00 towards RealAngle degrees)
      • Unit - Move Target instantly to Offset
      • Custom script: call RemoveLocation(udg_TargetLoc)
      • Custom script: call RemoveLocation(udg_Offset)


Variables:
Caster - Unit
Target - Unit
CasterLoc - Point
TargetLoc - Point
Offset - Point
RealAngle - Real

Okay, so here's whats happening. When you cast the spell, it basically gets the caster and unit locations. Then you get the angle you want, which is the angle which you're facing towards the target. Then, you turn on another trigger (Initially off) which moves the target by 12 distance every 0.04 seconds. After 1 second, the periodic trigger is turned off again. So the result would be that the target is knocked back by 300 distance (1.00/0.04 * 12) over 1 second. Note that if 2 units were to be knocked back simultaneously, the trigger would go haywire. Why? The variables would be overridden. If you want the trigger to fire simultaneously, it's a whole different trigger. You'll need to know MUI, which basically allows the spell to occur simultaneously without overriding each other. Hope this helped.

Note: If you're wondering what the "Custom Scripts" are for, they are to remove leaks. Certain variables such as Points and unit groups causes leaks. Thus you have to remove them before setting them into another variable. Leaks can lead to massive lag.
 

Tarivol

New Member
Reaction score
2
Not to be a bother, but I have no idea what MUI is, and unfortunately, since I'm creating a map in which up to ten players could all play the hero with this ability, I need to figure out how to make the spell not go hugely wrong when more than one person uses it. How advanced is what we're now talking about?\

Also, I've read a tiny bit about the leaking problem; How do I tell if a trigger will lag, or if something in a trigger will lag? I'm planning on this map being huge by the time I'm done, so, I don't want to end up with a 256x256 pile of lag when I'm done.

Side note; Would I be able to code ten versions of the same trigger, in order to make it so that each player would have their own set of variables, in case of everyone picking the same class? I know that's messy, but would that be a viable alternative to learning MUI, whatever that is?
 

Ayanami

칼리
Reaction score
288
MUI is basically using arrays to simultaneously allow the trigger to be run. There are only certain type of variables that leaks. There should be a tut on leaks in the forum. Try the search. As for the MUI knock back, here's a trigger.

Trigger:
  • Combat Knife
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Com|cffffcc00b|rat Knife (Neutral Hostile)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CustomValue Less than 100
        • Then - Actions
          • Set CustomValue = (CustomValue + 1)
        • Else - Actions
          • Set CustomValue = 1
      • Set Caster[CustomValue] = (Triggering unit)
      • Set Target[CustomValue] = (Target unit of ability being cast)
      • Set CasterLoc = (Position of (Triggering unit))
      • Set TargetLoc = (Position of (Target unit of ability being cast))
      • Set RealAngle[CustomValue] = (Angle from CasterLoc to TargetLoc)
      • Set RealTimer[CustomValue] = 1.00
      • Unit - Create 1 Hidden Dummy for (Owner of (Triggering unit)) at CasterLoc facing Default building facing degrees
      • Unit - Set the custom value of (Last created unit) to CustomValue
      • Unit Group - Add (Last created unit) to DummyGroup
      • Custom script: call RemoveLocation(udg_CasterLoc)
      • Custom script: call RemoveLocation(udg_TargetLoc)


Trigger:
  • Combat Knife Periodic
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
      • (DummyGroup is empty) Equal to False
    • Actions
      • Unit Group - Pick every unit in DummyGroup and do (Actions)
        • Loop - Actions
          • Set TempInt = (Custom value of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RealTimer[TempInt] Less than or equal to 0.00
            • Then - Actions
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
              • Set TargetLoc = (Position of Target[TempInt])
              • Set Offset = (TargetLoc offset by 12.00 towards RealAngle[TempInt] degrees)
              • Unit - Move Target[TempInt] instantly to Offset
              • Custom script: call RemoveLocation(udg_TargetLoc)
              • Custom script: call RemoveLocation(udg_Offset)
              • Set RealTimer[TempInt] = (RealTimer[TempInt] - 0.04)


Variables:
CustomValue - Integer
TempInt - Integer
CasterLoc - Point
TargetLoc - Point
Offset - Point
RealAngle - Real Array Size 100
RealTimer - Real Array Size 100
Caster - Unit Array Size 100
Target - Unit Array Size 100
Dummy Group - Unit Group

Note that all triggers are now Initially on. So that's an MUI version of it. It will work as much as 100 times per instance. There's also something called MPI which basically allows the same spell to fire at the same instance for different players. MUI allows the spell to be used at the same instance by anyone. If you have any questions on the trigger, feel free to ask.

Note: Hidden Dummy is a unit that has no model and doesn't show in the map. To create a hidden dummy, firstly, create a footman. Set attacks enabled to none and reduce food cost to 0. Go to the model path and set the path to ".mdl" without the quotations. Now go to normal abilities and add the ability "Locust", or simply press shit and double left-click on the normal abilities section and type in "Aloc" without the quotations. And there you have a hidden dummy.
 

Tarivol

New Member
Reaction score
2
Thank you incredibly much. So you know, I'm going to end up reviewing the triggers you posted bit by bit and attempting to decipher them, and I may end up PMing you if part or all of what I'm reading, I can't manage to decipher.
 

Ayanami

칼리
Reaction score
288
Thank you incredibly much. So you know, I'm going to end up reviewing the triggers you posted bit by bit and attempting to decipher them, and I may end up PMing you if part or all of what I'm reading, I can't manage to decipher.

Sure thing. Feel free to ask if you need help :thup:
 

Tarivol

New Member
Reaction score
2
Alright, so, since there isn't a way to directly copy what you posted to paste it into the trigger editor, I recreated them the best that I could, and came up with these;

Trigger:
  • Combat Knife
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Com|cffffcc00b|rat Knife Rifleman
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CustomValue Less than 100
        • Then - Actions
          • Set CustomValue = (CustomValue + 1)
        • Else - Actions
          • Set CustomValue = 1
      • Set Caster[CustomValue] = (Triggering unit)
      • Set Target[CustomValue] = (Target unit of ability being cast)
      • Set CasterLoc = (Position of (Triggering unit))
      • Set TargetLoc = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at CasterLoc facing Default building facing degrees
      • Unit - Set the custom value of (Last created unit) to CustomValue
      • Unit Group - Add (Last created unit) to DummyGroup
      • Custom script: call RemoveLocation(udg_CasterLoc)
      • Custom script: call RemoveLocation(udg_TargetLoc)


Trigger:
  • Combat Knife Periodic
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
      • (DummyGroup is empty) Equal to False
    • Actions
      • Unit Group - Pick every unit in DummyGroup and do (Actions)
        • Loop - Actions
          • Set TempInt = (Custom value of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RealTimer[TempInt] Less than or equal to 0.00
            • Then - Actions
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
              • Set TargetLoc = (Position of Target[TempInt])
              • Set Offset = (TargetLoc offset by 12.00 towards RealAngle[TempInt] degrees)
              • Unit - Move Target[TempInt] instantly to Offset
              • Custom script: call RemoveLocation(udg_TargetLoc)
              • Custom script: call RemoveLocation(udg_Offset)
              • Set RealTimer[TempInt] = (RealTimer[TempInt] - 0.04)


I created the variables you listed, and I already had a dummy unit created, so I used that as the dummy unit in the dummy unitgroup.. Am I doing something wrong?

Most notably, there are some icon differences;

For your combat knife Ability Being Cast condition line, the icon is a cog; for mine, it's a question mark.

for your combat knife CustomValue less than 100, again, yours is a cog, mine is a question mark.

for your combat knife periodic, the initial timer is a cog; for mine, it's a stopwatch.

for your combat knife periodic, the dummygroup is empty line is a cog, for mine it's a question mark.

for your combat knife periodic, the realtimer[tempint] less than or equal to 100 line is a cog, for mine it's a question mark.

Are those icons important, and any idea why it still might not be working?

Sorry to keep bothering you after you posted a complete pair of triggers. x.X
 

Ayanami

칼리
Reaction score
288
Nope, the icon is just a forum thing. You missed out 2 lines on the first trigger.

Trigger:
  • Actions
    • Set RealAngle[CustomValue] = (Angle from CasterLoc to TargetLoc)
    • Set RealTimer[CustomValue] = 1.00


Because, by default the RealTimer variable is set as 0.00. So basically you left it at 0.00. And my second trigger condition halts the knock back action when RealTimer becomes 0.00. By setting it to 1.00 like shown above, you're actually setting the time taken to knock back to 1 second. And every 0.04 seconds, 0.04 is deducted from the 1.00. So it's like a timer to stop the knock back after 1 second.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    Sticking with the desserts for now the latest recipe is Fried Apple Pies - https://www.thehelper.net/threads/recipe-fried-apple-pies.194297/
  • The Helper The Helper:
    Finally finding about some of the bots that are flooding the users online - bytespider apparently is a huge offender here - ignores robots.txt and comes in from a ton of different IPs
  • Monovertex Monovertex:
    @The Helper I'm really not seeing the "Signature" link in the sidebar on that page. Here's a screenshot:
  • The Helper The Helper:
    I have reported it - I was wondering why nobody I have given sigs to over the last few years have used them
  • The Helper The Helper:
    Ghan has said he has fixed this. Monovertex please confirm this fix. This was only a problem with people that had signatures in the upper levels like not the special members but the respected members.
  • The Helper The Helper:
    Here is a better place to manage this stuff https://www.thehelper.net/account/account-details which I think should be way more visible
  • The Helper The Helper:
    I am hoping that online user count drop is finally that TikTok bot banned
  • Ghan Ghan:
    I added the filter last night.
  • The Helper The Helper:
    They are still there

      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