• 🏆 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] Trigger is breaking my map

Status
Not open for further replies.
Level 2
Joined
Oct 16, 2013
Messages
18
Hey guys, I'm having a bit of trouble with the map. I've been working on a moba style map on and off for around 4 years, making small changes here and there. Recently I added some new triggers and content and after testing on battlenet, things were good. Then I added a few more, and all of the sudden I've got this gamebreaking bug and I have no idea what could be causing it.

Before I explain the bug, I should mention that the map has unit selection disabled and I use triggers to keep unit selection locked to each player's hero, as if they were playing a modern moba like League of Legends or Heroes of the Storm. However, I've never had a problem with those triggers in the past and the map has been that way for almost 2 years, so I don't think they're the cause.

My map also has items for heroes to buy, and since they'd be unable to click the shops due to the selection lock, I've made it so that the shops are added to your selection group as you approach and are removed from your selection group as you leave. This is relevant to the bug, as I'll explain below.

Here's what happens: after around 15-20 minutes of gameplay, players randomly become unable to cast abilities, issue orders, or learn new ranks of abilities. The only thing that works is right clicking to move or attack. Here's where it gets weird. The bug can be temporarily fixed by going back to your base and approaching a shop, selecting the shop in your selection group, and then selecting your hero again. After doing that, everything is fixed. Until you leave your base area, then everything breaks again. It doesn't affect all players at the same time, but in almost every circumstance it's affected every player eventually. It also doesn't seem to happen every game, which makes it even stranger.

I've gone through almost every trigger on my map (and there are a lot) and I can't figure out what could be causing it. I was thinking I'd see if anyone here had any experience with a similar issue or any insight on what could be causing something like this. Any ideas?

Thanks in advance!
 

~El

Level 17
Joined
Jun 13, 2016
Messages
556
This is most probably what is called Selection Bug. It's fairly rare, but the root cause is using the GUI "Get Player's Selected Units" action (or whatever it's name). The underlying cause is that these actions use the `SyncSelections()` native in their BJ implementation, which is prone to causing the aforementioned issue.

If you have any triggers that get a player's selection, you'll have to rewrite them to use the `GroupEnumUnitsSelected` native instead, which doesn't cause this bug. I don't even know what the purpose of `SyncSelections()` is, but it's always worked fine for me without it.
 
Level 2
Joined
Oct 16, 2013
Messages
18
This is most probably what is called Selection Bug. It's fairly rare, but the root cause is using the GUI "Get Player's Selected Units" action (or whatever it's name). The underlying cause is that these actions use the `SyncSelections()` native in their BJ implementation, which is prone to causing the aforementioned issue.

If you have any triggers that get a player's selection, you'll have to rewrite them to use the `GroupEnumUnitsSelected` native instead, which doesn't cause this bug. I don't even know what the purpose of `SyncSelections()` is, but it's always worked fine for me without it.

Thanks so much for the quick reply. That's exactly the kind of information I was hoping to find. Is this kind of trigger what you're talking about?


Unit - Set the custom value of (Random unit from (Units owned by (Owner of (Killing unit)) matching (((Matching unit) is selected by (Owner of (Killing unit))) Equal to True))) to 5

Or something like this?


RedClear
Events
Unit - A unit leaves Region 089 <gen>
Conditions
And - All (Conditions) are true
Conditions
((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to True
((Unit-type of (Triggering unit)) is A Hero) Equal to True
Actions
Selection - Select (Triggering unit) for Player 1 (Red)
 

~El

Level 17
Joined
Jun 13, 2016
Messages
556
Thanks so much for the quick reply. That's exactly the kind of information I was hoping to find. Is this kind of trigger what you're talking about?


Unit - Set the custom value of (Random unit from (Units owned by (Owner of (Killing unit)) matching (((Matching unit) is selected by (Owner of (Killing unit))) Equal to True))) to 5

Or something like this?


RedClear
Events
Unit - A unit leaves Region 089 <gen>
Conditions
And - All (Conditions) are true
Conditions
((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to True
((Unit-type of (Triggering unit)) is A Hero) Equal to True
Actions
Selection - Select (Triggering unit) for Player 1 (Red)

I've checked what both of these compile down to, but neither seems to be using the functions I described above. The kind of trigger action I was referring to would be:

Code:
Unit - Change color of (Random unit from (Units currently selected by Player 1 (Red))) to Red

There is a possibility that the culprit could lie elsewhere, but I wouldn't know where to look for it, sorry. This is the only run-in I had with this bug, though there might be other causes as well.
 
Level 2
Joined
Oct 16, 2013
Messages
18
I've checked what both of these compile down to, but neither seems to be using the functions I described above. The kind of trigger action I was referring to would be:

Code:
Unit - Change color of (Random unit from (Units currently selected by Player 1 (Red))) to Red

There is a possibility that the culprit could lie elsewhere, but I wouldn't know where to look for it, sorry. This is the only run-in I had with this bug, though there might be other causes as well.

Ahh so it has to specify a particular player rather than (owner of killing unit) like I have above?
 
Level 2
Joined
Oct 16, 2013
Messages
18
No, I meant the `Units currently selected by <>` part, which you don't seem to be using. The selection-related actions that you have to do not have the same bug.

Ohh I see what you mean. So using a unit group with "matching" is fine, just not the "currently selected by" prompt. I'll have to go through and make sure I haven't used "currently selected by" anywhere instead of "matching unit selected by".

If I can't find any then it may be related to something else.

Thanks for your help!
 

~El

Level 17
Joined
Jun 13, 2016
Messages
556
Ohh I see what you mean. So using a unit group with "matching" is fine, just not the "currently selected by" prompt. I'll have to go through and make sure I haven't used "currently selected by" anywhere instead of "matching unit selected by".

If I can't find any then it may be related to something else.

Thanks for your help!

You're welcome. I hope you find the root cause of this, good luck.
 
Level 10
Joined
Mar 25, 2008
Messages
339
Does "Selection - Select (Triggering unit) for Player 1 (Red)"\
cause the selection bug?
I'm having a similar issue in my map, but there's no use of "selected by" in my entire game.
And oddly it only happens when theres a lot of players in multiplayer, never when its single player.
 
Status
Not open for further replies.
Top