• 🏆 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!

Math formula to make npc let hero pass by

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Not sure if you wanted something like this. It's a fairly simple system that allows you to push "NPCs" out of the way. This system is designed around the idea that the NPCs will eventually return to their original positions after being "pushed" away.

How to use the system:
With the Paladin selected, right click a Knight to push it out of your way. Your Paladin must be within a certain range of the Knight to do this.

How to import:
You have to import the Phasing ability, Phasing buff, and the triggers. Also, this uses Bribe's Unit Indexer, so that may cause problems if you were using Custom Value for something else.

Also, make sure to configure the "Setup NPC Move System" trigger. The main thing that you have to worry about is adding units to the correct Unit Groups.
For NPCs: Add them to NM_NpcUG
For Units that can Push NPCs: Add them to NM_PlayerUG

---------

Here's a simplified trigger that might work better for you. You can mess with the conditions to suit your needs:
  • Push Simple Example
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • (Unit-type of (Target unit of issued order)) Equal to Some NPC Unit
      • (Unit-type of (Ordered unit)) Equal to Some Player Unit
    • Actions
      • Set PlayerUnit = (Ordered unit)
      • Set NpcUnit = (Target unit of issued order)
      • Set TempPoint1 = (Position of PlayerUnit)
      • Set TempPoint2 = (Position of NpcUnit)
      • Set Distance = (Distance between TempPoint1 and TempPoint2)
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Distance Less than or equal to 200.00
        • Then - Actions
          • Set Angle = (Angle from TempPoint1 to TempPoint2)
          • Set TempPoint3 = ((Position of NpcUnit) offset by 200.00 towards Angle degrees)
          • Unit - Order NpcUnit to Move To TempPoint3
          • Custom script: call RemoveLocation(udg_TempPoint3)
        • Else - Actions
      • -------- - --------
      • Custom script: call RemoveLocation(udg_TempPoint1)
      • Custom script: call RemoveLocation(udg_TempPoint2)

EDIT: Attached map in post below.
 
Last edited:
Level 9
Joined
May 24, 2016
Messages
298
Not sure if you wanted something like this. It's a fairly simple system that allows you to push "NPCs" out of the way.

With the Paladin selected, right click a Knight to push it out of your way. You must be within a certain range of the Knight to do this.

There's a bunch of options you have to configure in the "Setup NPC Move System" trigger. If you want to use this exact system then make sure to import everything properly. You have to import the 1 ability, 1 buff, and triggers. Also, this uses Bribe's Unit Indexer, so that may cause conflicts with your map if you were using Custom Value for something else.
No, Bribe begged me for leave custom value unchanged, so he will be credited in incredible map. If you didn't get it, don't worry, it's a joke that only a few people could understand (not really).
Thx you a lot, I'll try it and soon give you a feedback.
 
Level 9
Joined
May 24, 2016
Messages
298
Not sure if you wanted something like this. It's a fairly simple system that allows you to push "NPCs" out of the way. This system is designed around the idea that the NPCs will eventually return to their original positions after being "pushed" away.

How to use the system:
With the Paladin selected, right click a Knight to push it out of your way. Your Paladin must be within a certain range of the Knight to do this.

How to import:
You have to import the Phasing ability, Phasing buff, and the triggers. Also, this uses Bribe's Unit Indexer, so that may cause problems if you were using Custom Value for something else.

Also, make sure to configure the "Setup NPC Move System" trigger. The main thing that you have to worry about is adding units to the correct Unit Groups.
For NPCs: Add them to NM_NpcUG
For Units that can Push NPCs: Add them to NM_PlayerUG

---------

I realize that this System isn't exactly what you wanted but I think that you can at least get some good ideas from it.

Here's a simplified trigger that might work better for you. You can mess with the conditions to suit your needs:
  • Push Simple Example
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • (Unit-type of (Target unit of issued order)) Equal to NPC Unit
      • (Unit-type of (Ordered unit)) Equal to Player Unit
    • Actions
      • Set TempUnit = (Target unit of issued order)
      • -------- - --------
      • Set TempPoint1 = (Position of (Ordered unit))
      • Set TempPoint2 = (Position of TempUnit)
      • Set Distance = (Distance between TempPoint1 and TempPoint2)
      • -------- - --------
      • Custom script: call RemoveLocation(udg_TempPoint1)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Distance Less than or equal to 200.00
        • Then - Actions
          • Set TempPoint1 = (Position of (Ordered unit))
          • Set TempPoint2 = (Position of TempUnit)
          • Set Angle = (Angle from TempPoint1 to TempPoint2)
          • -------- - --------
          • Custom script: call RemoveLocation(udg_TempPoint1)
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • -------- - --------
          • Set TempPoint1 = ((Position of TempUnit) offset by 200.00 towards Angle degrees)
          • Unit - Order TempUnit to Move To TempPoint1
          • -------- - --------
          • Custom script: call RemoveLocation(udg_TempPoint1)
        • Else - Actions

EDIT: Added v.2. I added a trigger to automatically remove Dying units from the Npc/Player Unit Groups. If your NPCs don't die and the Players are mostly controlled by Revivable Heroes then you probably don't need to use this new version. Otherwise, if the NPCs can die, this new version will prevent some Leaks.
Feel like you helped me a lot, yes, its something different from what I asked (checking for Paladin is moving and then pushing away all npcs around), but maybe I can change it in my own. But even at a current state this system solves much problems. I'll test it when I get back to my pc.
 
Level 9
Joined
May 24, 2016
Messages
298
Not sure if you wanted something like this. It's a fairly simple system that allows you to push "NPCs" out of the way. This system is designed around the idea that the NPCs will eventually return to their original positions after being "pushed" away.

How to use the system:
With the Paladin selected, right click a Knight to push it out of your way. Your Paladin must be within a certain range of the Knight to do this.

How to import:
You have to import the Phasing ability, Phasing buff, and the triggers. Also, this uses Bribe's Unit Indexer, so that may cause problems if you were using Custom Value for something else.

Also, make sure to configure the "Setup NPC Move System" trigger. The main thing that you have to worry about is adding units to the correct Unit Groups.
For NPCs: Add them to NM_NpcUG
For Units that can Push NPCs: Add them to NM_PlayerUG

---------

I realize that this System isn't exactly what you wanted but I think that you can at least get some good ideas from it.

Here's a simplified trigger that might work better for you. You can mess with the conditions to suit your needs:
  • Push Simple Example
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • (Unit-type of (Target unit of issued order)) Equal to NPC Unit
      • (Unit-type of (Ordered unit)) Equal to Player Unit
    • Actions
      • Set TempUnit = (Target unit of issued order)
      • -------- - --------
      • Set TempPoint1 = (Position of (Ordered unit))
      • Set TempPoint2 = (Position of TempUnit)
      • Set Distance = (Distance between TempPoint1 and TempPoint2)
      • -------- - --------
      • Custom script: call RemoveLocation(udg_TempPoint1)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Distance Less than or equal to 200.00
        • Then - Actions
          • Set TempPoint1 = (Position of (Ordered unit))
          • Set TempPoint2 = (Position of TempUnit)
          • Set Angle = (Angle from TempPoint1 to TempPoint2)
          • -------- - --------
          • Custom script: call RemoveLocation(udg_TempPoint1)
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • -------- - --------
          • Set TempPoint1 = ((Position of TempUnit) offset by 200.00 towards Angle degrees)
          • Unit - Order TempUnit to Move To TempPoint1
          • -------- - --------
          • Custom script: call RemoveLocation(udg_TempPoint1)
        • Else - Actions

EDIT: Added v.2. I added a trigger to automatically remove Dying units from the Npc/Player Unit Groups. If your NPCs don't die and the Players are mostly controlled by Revivable Heroes then you probably don't need to use this new version. Otherwise, if the NPCs can die, this new version will prevent some Leaks.
iT'S BAD. v2 and v1 cannot be opened due "unit memory is invalid"
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Are you on the latest patch?

You'll need to update to use it. If you're worried about problems then make backups of your maps, although I think at this point you should be safe.

Anyway, you can just use that trigger I posted if you don't need the entire System.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Yes, you should update. But be warned, you may experience some problems after updating. Maybe create backups of your maps just in case.

And IF you run into problems like low fps or something then I think this thread will help. The person in this thread updated from an old patch to 1.31 and ended up with issues but they figured out how to fix it. Their solution is at the very bottom of page 2.
Help import JASS skill

Also, if you do update, use the new version of the system that I attached below.
 

Attachments

  • NPC Move System v.3.w3x
    33.6 KB · Views: 39
Last edited:
Level 9
Joined
May 24, 2016
Messages
298
Yes, you should update. But be warned, you may experience some problems after updating. Maybe create backups of your maps just in case.

And IF you run into problems like low fps or something then I think this thread will help. The person in this thread updated from an old patch to 1.31 and ended up with issues but they figured out how to fix it. Their solution is at the very bottom of page 2.
Help import JASS skill

Also, if you do update, use the new version of the system that I attached below.
Really thx you.
 
Status
Not open for further replies.
Top