1. The mythological era has spawned some interesting characters around. Check them out and be sure to vote for them in the 30th Poll of the Texturing Contest.
    Dismiss Notice
  2. The 20th iteration of the Terraining Contest is upon us! Join and create exquisite Water Structures for it.
    Dismiss Notice
  3. Hivers united and created a bunch of 2v2 melee maps. Vote for the best in our Melee Mapping Contest #4 - Poll!
    Dismiss Notice
  4. Check out the Staff job openings thread.
    Dismiss Notice

(Solved)Simple knockback needed on a spell

Discussion in 'Requests' started by Edy, Apr 17, 2019.

  1. Edy

    Edy

    Joined:
    Nov 21, 2015
    Messages:
    91
    Resources:
    0
    Resources:
    0
    I have a skillshot spell that when it hits a unit a dummy will appear and cast thunder bolt on the unit (in the map it's called knockback caster with an ability named knockback).

    When cast it pushes the hit unit away (variable ammount) 150-300 range
    Keep in mind I need this in GUI, but gui "move instantly pauses the unit" sooo
    • [​IMG][​IMG]Custom script: call SetUnitX(GetEnumUnit(), GetLocationX(udg_TempPoint2))
    • [​IMG][​IMG]Custom script: call SetUnitY(GetEnumUnit(), GetLocationY(udg_TempPoint2))

      Scripts like these work for me, they don't pause the unit

      Thx in advance + rep
     

    Attached Files:

  2. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,286
    Resources:
    0
    Resources:
    0
  3. Edy

    Edy

    Joined:
    Nov 21, 2015
    Messages:
    91
    Resources:
    0
    Resources:
    0
    I wish I could, whenever I copy it and edit it warcraft runs for about 15 secs and crashes, I'm trash at triggering that's why I posted the actual spell (1 ability) that needs knockback to it...
    From dummy caster towards target unit to move it, it's simple to some but it's Gods work for me xD
     
  4. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,286
    Resources:
    0
    Resources:
    0
    The game doesn't just randomly crash, and a system such as the one I linked wouldn't be approved here if it was crash-prone. You must not have followed the instructions (in the system description on the resource page (I hope you actually looked at that...)) properly; to get that knockback system to work all you have to do is:
    And then set the bare minimum of four configuration variables:
    All the other variables are optional to set so you can ignore them.
    So learn. You'll get better, it will get easier, and eventually you won't have to ask for help with things like this. Learning how to download, implement, and use a resource from this forum is one of the most (maybe even the most) essential skills for wc3 mapmaking. If you can't or won't help yourself, you're not going to find there's a lot you can do.

    Also, when you say you tried something but it didn't work/crashed/produced some unexpected behavior, it's actually possible to help you if you post the trigger(s) you made. Then we can see and suggest. Without seeing that you're basically just saying "it didn't work, help me" with no other information. (To be fair I do see the map in your first post, but nothing in your second post where you say you tried to use KB2.5d.)
     
  5. Edy

    Edy

    Joined:
    Nov 21, 2015
    Messages:
    91
    Resources:
    0
    Resources:
    0
    I uploaded that map so it can be edited so I don't loose any more nerves xD. I simply can't find the line in the script which allows me to:

    Unit casts a spelll (thunderbolt = knockback unit spell)

    Condition (check if target is a hero) - knockbacks heroes only.

    Action run knockback GUI (Idk how to do this)

    Guess I'm stuck :p,

    As per the first part, i did look up multiple knockback systems - most in JASS unfortunately. I just didn't want a whole system for just one spell... I tested the system it's perfect but I can't manage to pull it off myself therefore the post.. Thx for replying
     
  6. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,286
    Resources:
    0
    Resources:
    0
    I personally send many of my thread replies from my mobile device where I don't have access to the WE; other users here may do the same, or reply from work devices that don't have wc3 installed, or in other OSes where wc3 doesn't run or... you see my point. While a map download is indubitably helpful, a map only (without triggers) may severely limit who is actually able to help you.
    GUI has categories to easily search through the different types of actions/conditions/events, which you can select in the top left corner of the actions window (by default it says All). If you select "unit" it shows everything unit-related. If you select "trigger" it shows everything trigger-related. Nearly every GUI line has a prefix that tells you what category it belongs to. So if you actually looked at the demo triggers in the 2.5d documentation (again: read the documentation, don't just gloss over it and assume you don't have to; most systems have simple demo/example code to easily show how to use the system) you would see these lines being used:
    • Set CenterPoint = (Position of DamageEventSource)
    • Set TargetPoint = (Position of DamageEventTarget)
    • Set Knockback2DAngle = (Angle from CenterPoint to TargetPoint)
    • Custom script: call RemoveLocation(udg_CenterPoint)
    • Custom script: call RemoveLocation(udg_TargetPoint)
    • Set Knockback2DTime = 0.90
    • Set Knockback2DDistance = 500.00
    • Set Knockback2DUnit = DamageEventTarget
    • -------- Set is for variable setting, it doesn't belong in a specific type of category --------
    • -------- all this does is set the 3 required variables for the kb system (as I highlighted in my previous post this is ALL you have to set for it to work) --------
    • Trigger - Run Knockback 2D <gen> (checking conditions)

    So the first 8 lines are just for setting the variables (and cleaning up the leaks), and the last line that actually runs is clearly part of the "trigger" category so... look there. I guarantee you'll find it. As for the other lines, only the condition is tricky; many conditions are found under the "boolean comparison" option where you might not think them to be found, but this is because GUI is stupid. Think about what kind of 'thing' the line is about (or read the prefix before the -) and look in that category. Your trigger should look like this:

    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equal to Thunderbolt
      • ((Target Unit of ability being cast) is a hero) equal to true //this one is the boolean check, not a unit check or a unit-type check
    • Actions
      • Set CenterPoint = (Position of (Triggering Unit))
      • Set TargetPoint = (Position of (Target unit of ability being cast))
      • Set Knockback2DAngle = (Angle from CenterPoint to TargetPoint)
      • Custom script: call RemoveLocation(udg_CenterPoint)
      • Custom script: call RemoveLocation(udg_TargetPoint)
      • Set Knockback2DTime = 0.90
      • Set Knockback2DDistance = 500.00
      • Set Knockback2DUnit = (Target Unit of ability being cast)
      • Trigger - Run Knockback 2D <gen> (checking conditions)
     
  7. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,286
    Resources:
    0
    Resources:
    0
    No you probably don't, but the time it takes to import the system is far less than the time it would take to write a knockback system yourself from scratch. And it probably does a better job than what you'd write. And has more features. And is more efficient. And... do you see where I'm going with this? There's a time and place to write your own X and there's a time and place to search for someone else's code to do X. Also what if in 2 weeks you want to add a second knockback to something else on your map? Or a third or fourth? Having the system in your map makes it trivially easy to add/change your knockbacks at will, at the cost of (maybe?) 2kb of extra map size. Having a bunch of variables and a few extra triggers is no harm to your map whatsoever.
     
  8. Edy

    Edy

    Joined:
    Nov 21, 2015
    Messages:
    91
    Resources:
    0
    Resources:
    0
    I will try this method in the evening, I'll tell you how it goes, but from what you've shown me it's seems quite simple. I must be braindead LOL