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

[Trigger] Is this a warcraft bug?

Status
Not open for further replies.
Level 10
Joined
Feb 19, 2006
Messages
237
  • Net Trap
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Net Trap
    • Actions
      • Unit Group - Pick every unit in (Units within 200.00 of (Position of (Dying unit)) matching ((Owner of (Dying unit)) Not equal to (Owner of (Matching unit)))) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy Unit for (Owner of (Dying unit)) at (Position of (Dying unit)) facing Default building facing degrees
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Net to (Last created unit)
          • Unit - Order (Last created unit) to Orc Raider - Ensnare (Picked unit)
          • Unit - Add Slow (net) to (Last created unit)
          • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
For some reason, the dummy unit casts "slow" but not "net"

Things I've already tried:
-checked to make sure both abilities do not have tech tree requirements
-dummy has enough mana to cast both

What's wrong here? Thanks in advance.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Sorry, but the bug is probably between the computer and the chair.

There are many possibilities, including that your spells aren't be made to be truly instant, or/and the dummy unit by itself.
The requirements are not matched, out of mana ...
 
Something is most likely interfering with "last created unit".
Not true. It's because the ability 'net' takes time to cast. So even if you order the unit to cast it, before the unit even starts casting it, you've already given him the order to 'Slow' (triggers act almost simultaneously).
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Again it's possible to make a spell truly instant, but you have to make a valid dummy unit also, some fields in object editor must be edited.
Use the search.
Or the crappy way is to use 2 dummies units, one for each spell ...

Btw you could only use X dummies unit (for X players) for all the game, but that's not very fun in GUI.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
@madman9800 LEAKS LEAKS LEAKS >.< + efficiency.. -> make use of (Triggering unit) and (Triggering player).
Spells take time to cast. Using dummy with 0 cast points is nice/using 2 dummies is a bit inefficient. Thats why locals have been invented!

Fixes wait issue - sorry
  • Net Trap
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Net Trap
    • Actions
      • Set p = (Position of (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 200.00 of p matching (Triggering player) Not equal to (Owner of (Matching unit)))) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy Unit for (Triggering player) at p facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Net to (Last created unit)
          • Unit - Order (Last created unit) to Orc Raider - Ensnare (Picked unit)
          • Unit - Create 1 Dummy Unit for (Triggering player) at p facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Slow (net) to (Last created unit)
          • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
        • Custom script: call RemoveLocation(udg_p)
 
Last edited:
Level 12
Joined
Feb 22, 2010
Messages
1,115
You are using wait inside a unit group, also he won't even be able to read your code. :ogre_rage:

@madman9800, stop blaming warcraft 3 ffs.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
There is nothing wrong with TriggerSleepAction() inside function ForGroup if you use locals. And it's not the first time I'm helping madman - let it be his opinion which say: I can not read the code - not yours.

EDIT Ceday You were right about waits.
Unfortunately he will need to create 2 dummies.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
I don't recommend to use set bj_wantDestroyGroup = true, because with a particular GUI function "pick every unit of type" if i remember correctly, it will enum only units of Player(0) (red / Player(1) in GUI), and then will destroy the group.
It could also have leak(s), don't remember.

All can be explained about this "bug" by following the nasty call of calls of calls of BJ functions.

In short, just use the custom script DestroyGroup instead.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
What is wrong with bj_wantDestroyGroup? Give a code example(which is bj variable's fault not user's fault) or spinnaker is right.Also even there is a bug(don't think so) it won't happen with his last code.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
I was mistaken with Wait - yes, I haven't know about issue with ForGroup function (once again sorry). But for the first time I hear that 'bj_wantDestroyGroup = true' is incorrect is such simple trigger. There was ton of situations when I was creating/destroying group manually while some moderator/experienced member told me that using bj would make my life easier.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
As stated you have to follow the functions called by the GUI to understand the failed logic.
But to see the bug, just use it with "pick every unit of type" and you will see that it will enum only units of the first player and then the group will be destroyed.

I'm 100 % sure it bugs with a particular pick every unit.
If it's not with that one, then it's with an other one.

EDIT : Pharaoh_ get it, an other urban legend is dead, just one point more to jass, GUI : 0 , jass : 1337 :p
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Forgive me but, doesn't that apply only to group creation via units of type?
If so, whats wrong with bj if we aren't using such function, but instead of it GroupEnumUnitsInRage()?

To be honest i don't really care since i don't use GUI since years, it's just safer to use DestroyGroup, you can do that, even with GUI.

Now if you still prefer bj_wantDestroyGroup you still can test it by yourself if it bugs with an other pick every unit.

GroupEnumUnitsInRange should be less efficient and you have to make sure you are using an enough range.

Anyway i've clearly said all i know about this.
Make your choice, you are aware now.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
It seems you are right(you are my favourite hive user you can't be wrong hehehe), these 2 functions returning a group which must be destroyed manually with DestroyGroup().(I have never used them :D)

Pick every units of type
Random N units from group

But for other gui pick functions bj_wantDestroyGroup seems fine.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
It's great to know that fact, and I don't nagate anything you have said - furthermore I appreaciate that you have mentioned that issue.

I've moved to Jass some time ago, and since I never use that bj anymore I couldn't find out that bug. However, was scripting in GUI for years, and never met that issue. Meaby it's because I was mostly using GroupEnumUnitsInRange() or GroupEnumUnitsInRect() << for those bj_wantDestroyGroup works just fine.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
It's indeed quite useless in many cases, in fact i have never used it :p

Btw i'm not using DestroyGroup anymore since i recycle groups or just an unique static group, code inside the boolexpr of GroupEnum, and always returns false if i don't need the group more time than instantly (so the group keeps to be empty), but i have to make benchmarks about it now that i think about it.

I have to improve and benchmark my linked list which simulate a group too.
 
Status
Not open for further replies.
Top