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

How can I disable share units? (Or at least get rid of the Allies button)

Level 24
Joined
Jun 26, 2020
Messages
1,852
Hello, in my map I wanna disable the posibility share units between players, but I tried everything I could found in the forum but nothing worked, even tried this:
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • Set VariableSet TempPlayer = (Picked player)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - For TempPlayer, turn Shared units Off toward (Picked player)
          • Player - For (Picked player), turn Shared units Off toward TempPlayer
          • Player - For TempPlayer, turn Full shared units Off toward (Picked player)
          • Player - For (Picked player), turn Full shared units Off toward TempPlayer
How can I do it?
Alternatively, I could just get rid of the Allies button by accessing to its frame, but destroying it would be a bad idea, I could hide it, but the command (F11) still works, so I also need to disable it, but open and exit a menu like the quests menu enable it again, so what can I do?
 
Level 19
Joined
Feb 27, 2019
Messages
591
If Shared Vision is disabled in Force Properties, Shared Units becomes disabled. It possibly disables Resource Trading too but it could maybe be turned on. I dont have a good way to test it.
  • Player - Set Alliance
  • Game - Set Map Flag
 
Level 12
Joined
Jan 10, 2023
Messages
191
What about relocating/ removing the checkbox frame?

AllyCheckbox[0-23] I think would be the one, might take some experimenting.

You would still have the resources menu, but I'm afraid to remove that window if players can still hit F11 and open a door to nothing.

Alternatively, if you're up for it, you could entirely repurpose this menu with frames.
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
Hide it and use OSKeys to overwrite it's hotkey (not sure if that works).
If you mean use triggers with OSKeys, it doesn't overwrite it, just add a new action.
That or try to disable the checkbox frames.
Can I?
Did you run that once a second, or faster? Because your code should undo the current unit sharing, it will not stop the sharing checkbox.
I run it with the event "0.00 seconds of game elapsed"
If Shared Vision is disabled in Force Properties, Shared Units becomes disabled. It possibly disables Resource Trading too but it could maybe be turned on. I dont have a good way to test it.
  • Player - Set Alliance
  • Game - Set Map Flag
Shared Vision is enabled, so should I disable it and just enable it with triggers to achieve what I want?
What about relocating/ removing the checkbox frame?

AllyCheckbox[0-23] I think would be the one, might take some experimenting.

You would still have the resources menu, but I'm afraid to remove that window if players can still hit F11 and open a door to nothing.

Alternatively, if you're up for it, you could entirely repurpose this menu with frames.
Yeah, but how?
 
Level 12
Joined
Jan 10, 2023
Messages
191
Yeah, but how?

It would require some Lua or JASS, and this very useful frame tutorial.

As far as Uncle's OSKey idea, you might try forcing [O] (as in 'OK'), [ENTER] or [ESC] whenever [F11] it pressed, and then do away with the button.
I forget if ENTER works and I think ESC doesn't but it's been a while

If you have no experience with Lua or JASS, maybe someone will help, this sounds like a small amount of code (just removing the boxes, not the whole rebuild menu idea) so I'll give it a shot in about 32 hours (next time I'll be on my PC).
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,852
It would require some Lua or JASS, and this very useful frame tutorial.
Ok, but again, how? The tutorial until I read while it says how to access to some origin frames, it doesn't says something about how to access to the Allies menu and much less how to access to its frames.
As far as Uncle's OSKey idea, you might try forcing [O] (as in 'OK'), [ENTER] or [ESC] whenever [F11] it pressed, and then do away with the button.
I forget if ENTER works and I think ESC doesn't but it's been a while
That idea could work, but forcing press a key always takes a delay and the people can still fast click to the share units button.
If Shared Vision is disabled in Force Properties, Shared Units becomes disabled. It possibly disables Resource Trading too but it could maybe be turned on. I dont have a good way to test it.
  • Player - Set Alliance
  • Game - Set Map Flag
At the end, this idea worked.
 
Last edited:
Level 12
Joined
Jan 10, 2023
Messages
191
That tutorial is very well organized and does indeed tell you how. Additionally, it will require work, effort, and knowledge of JASS or Lua, but it sounds like you have a solution.

If it's something you're still interested in after finding Duckfarter's solution, I'll make it somewhat educational when I do.

As far as 'how', I don't want to make you afraid to ask questions, but that's up to you, I'm guessing you just mean that you are totally unfamiliar with frames and don't know where to begin, but that is in that tutorial - I don't like asking for help, but I learned all I know from this website's tutorials and the links in my signature. But honestly from seeing your typical posts, it seems to me that you would be a quick learner for Lua or JASS and you would unlock a lot more potential for your maps if you just start converting your triggers to get a feel for it, then optimize them, then break free lol. I'm just weary of people not doing their homework...

To answer the basic question of 'how' at initialization, hide or move them off-screen upward or to the right.
This I'm guessing is where the difficulty is, in writing the code/ learning what functions to use.

Let me know if you want an example.
 
Level 12
Joined
Jan 10, 2023
Messages
191
I have no doubts that it will work, I only wondered about your interest.

I don't know why he didn't suggest it, I can't speak for him, but the reason I almost didn't and I guess the reason others didn't suggest it is because you're working with GUI and at the very least you would be calling custom scripts to affect frames.

When I said 'it may take experimenting', I mean finding what works best as far as relocating and also removing the top label. The names of the frames may also have child frames or associated frames that need some more work.
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
I have no doubts that it will work, I only wondered about your interest.

I don't know why he didn't suggest it, I can't speak for him, but the reason I almost didn't and I guess the reason others didn't suggest it is because you're working with GUI and at the very least you would be calling custom scripts to affect frames.

When I said 'it may take experimenting', I mean finding what works best as far as relocating and also removing the top label. The names of the frames may also have child frames or associated frames that need some more work.
Sorry I deleted the post, I think I found what do you meant, I just wanted that you were more specific and I tought that , this seems to work:
Lua:
for i = 0, 1 do
    BlzFrameSetVisible(BlzGetFrameByName("AllianceSlot", i), false)
end
Is just that every time I reopen the menu, it gets visible again, but that is not much of a problem.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Sorry I deleted the post, I think I found what do you meant, I just wanted that you were more specific and I tought that , this seems to work:
Lua:
for i = 0, 1 do
    BlzFrameSetVisible(BlzGetFrameByName("AllianceSlot", i), false)
end
Is just that every time I reopen the menu, it gets visible again, but that is not much of a problem.

In Tasyen's UI tutorial use Control + F to find what you're looking for. I typed "checkbox" and found these, the names are often self-explanatory:
Lua:
for i = 0, 23 do
    BlzFrameSetEnable(BlzGetFrameByName("VisionCheckBox", i), false)
end
I haven't tested it, but I doubt the game enables all of the checkbox frames every time you open a menu.
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
In Tasyen's UI tutorial use Control + F to find what you're looking for. I typed "checkbox" and found these, the names are often self-explanatory:
Lua:
for i = 0, 23 do
    BlzFrameSetEnable(BlzGetFrameByName("VisionCheckBox", i), false)
end
I haven't tested it, but I doubt the game enables all of the checkbox frames every time you open a menu.
What did you do? Because if I do that only appears me how to create checkbox, because everything is hidden, I found it because I remembered that exists the BlzGetFrameByName function that I barely use and the names are in a link in the tutorial, not in the tutorial by itself Default Names for BlzGetFrameByName
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Top