• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

(Solved)Simple knockback needed on a spell

Status
Not open for further replies.

Edy

Edy

Level 9
Joined
Nov 21, 2015
Messages
226
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
  • join.gif
    page.gif
    Custom script: call SetUnitX(GetEnumUnit(), GetLocationX(udg_TempPoint2))
  • join.gif
    page.gif
    Custom script: call SetUnitY(GetEnumUnit(), GetLocationY(udg_TempPoint2))

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

    Thx in advance + rep
 

Attachments

  • Watershot.w3x
    39.9 KB · Views: 29

Edy

Edy

Level 9
Joined
Nov 21, 2015
Messages
226
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
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
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:
KB 2.5d documentation said:
1. Copy the Unit Indexer and Knockback 2D triggers into your map.
2.There is one dummy created in the Config trigger that is a simple Undead Ghoul. It could just as well be a Peasant or Peon. Just make sure that the unit type created has the harvest ability and doesn't have some passive effects like Phoenix fire or immolation.
And then set the bare minimum of four configuration variables:
KB 2.5d documentation said:
-------- 1. Knockback2DAngle -------- this is the direction angle the unit is knocked back (in degrees) --------
-------- 2. Knockback2DTime -------- this is how long the unit will be knocked back (in seconds) --------
-------- 3. Knockback2DDistance -------- this is how far the unit will be knocked back --------
-------- 4. Knockback2DUnit -------- this is the unit being knocked back --------
All the other variables are optional to set so you can ignore them.
I'm trash at triggering
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.)
 

Edy

Edy

Level 9
Joined
Nov 21, 2015
Messages
226
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.)

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
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
I uploaded that map so it can be edited so I don't loose any more nerves xD.
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.
I simply can't find the line in the script which allows me to:
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)
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
I just didn't want a whole system for just one spell...
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.
 

Edy

Edy

Level 9
Joined
Nov 21, 2015
Messages
226
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.

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
 
Status
Not open for further replies.
Top