• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Disable defeat dialog or Trigger Melee Defeat for player

Level 2
Joined
Apr 24, 2024
Messages
4
Hello everyone!

When I use standart Game-Defeat, it creates this dialog menu with only one option - To leave.
I want a player to be able to spectate the game after his defeat, like if he lost in Melee game - there's another defeat dialog menu, where the player can choose to stay and spectate.

Ways to solve this problem I imagine:
1. Custom script line to trigger Melee Defeat instead of Regular Defeat (cause it would create the dialog menu where you can choose to stay and spectate the game, that's what I need)
2. Custom script lines to 1) Trigger Defeat to Triggering this event player, 2) Change player state to spectator state
3. Or maybe there's an option to trigger Regular Defeat and close or remove this defeat dialog, or maybe include spectate button in there..

Basically any way to defeat player and let him stay and watch the game as a spectator would work for me.

p.s. I know of custom script line: "call SetPlayerState(Player(0), PLAYER_STATE_OBSERVER" if that helps, and also this one: "call RemovePlayer(player)"
maybe it helps your thought process
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
How does your map work? Is it melee inspired? Is it completely custom? The best solution could vary based on that information.

Anyway, I attached two example maps that showcase a spectator system. Kill a player's hero to "defeat" them. They won't be kicked out of the game but will instead be switched to an Observer (spectator). I left some Actions in there for controlling other things like removing leftover units, removing resources, preventing other triggers from working for them, etc.

The second map has a Dialog menu for choosing to Quit/Spectate.
 

Attachments

  • Spectator Mode 2 with Dialog.w3m
    25.8 KB · Views: 2
  • Spectator Mode 1.w3m
    24.7 KB · Views: 2
Last edited:
Level 2
Joined
Apr 24, 2024
Messages
4
How does your map work? Is it melee inspired? Is it completely custom? The best solution could vary based on that information.

Anyway, I attached two example maps that showcase a spectator system. Kill a player's hero to "defeat" them. They won't be kicked out of the game but will instead be switched to an Observer (spectator). I left some Actions in there for controlling other things like removing leftover units, removing resources, preventing other triggers from working for them, etc.

The second map has a Dialog menu for choosing to Quit/Spectate.
Good stuff! Thank you for such good examples.

Yes, my map is melee inspired, it's my version of balance in the game, bunch of values tweaked to my liking. I also have custom rules to win - you need to destroy all the townhalls of player to eliminate him, instead of all the structures he has (buildings or whatever). You get a bonus gold for eliminating the player (destroying his last townhall) and etc.

I will study the attached maps in detail, and, for sure, I will choose one of the solutions for myself. But still, maybe it can be made a little simpler, for example, as in one of the points of my guesses about a possible implementation? For example, just trigger Melee Defeat Event or something similar? I would be very grateful for additional information in this direction!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Good stuff! Thank you for such good examples.
There is no "Continue playing" option outside of ladder games. By pressing "Continue Playing" in a ladder game you are basically put in a private match with only yourself. In other words, you've been disconnected from others.

The system I made in the 2nd map (with Dialog) is pretty straightforward. When the "defeat condition" is met the Dialog menu is displayed for the "defeated player" which is actually just a Player variable you would Set since we don't want to truly Defeat the Player until they've chosen one of the two options:

1) If they press the Quit game button -> It runs Defeat player on them, kicking them out of the game for good.

2) If they press the Spectate button -> It runs SetPlayerState() which sets them to an Observer and they remain in the game.

You may have some triggers that will need to be adjusted to account for Spectators. For example, maybe in your map you can type "-concede" to give up. But you don't want Spectators to be able to type this message, so you would need to add an extra Condition to check if the Player that typed the message is a Spectator or not.


Edit: I attached a simple map that is designed to work like you described here:
Yes, my map is melee inspired, it's my version of balance in the game, bunch of values tweaked to my liking. I also have custom rules to win - you need to destroy all the townhalls of player to eliminate him, instead of all the structures he has (buildings or whatever). You get a bonus gold for eliminating the player (destroying his last townhall) and etc.
 

Attachments

  • Spectator Mode Rain.w3m
    25.2 KB · Views: 1
Last edited:
Level 2
Joined
Apr 24, 2024
Messages
4
There is no "Continue playing" option outside of ladder games. By pressing "Continue Playing" in a ladder game you are basically put in a private match with only yourself. In other words, you've been disconnected from others.

The system I made in the 2nd map (with Dialog) is pretty straightforward. When the "defeat condition" is met the Dialog menu is displayed for the "defeated player" which is actually just a Player variable you would Set since we don't want to truly Defeat the Player until they've chosen one of the two options:

1) If they press the Quit game button -> It runs Defeat player on them, kicking them out of the game for good.

2) If they press the Spectate button -> It runs SetPlayerState() which sets them to an Observer and they remain in the game.

You may have some triggers that will need to be adjusted to account for Spectators. For example, maybe in your map you can type "-concede" to give up. But you don't want Spectators to be able to type this message, so you would need to add an extra Condition to check if the Player that typed the message is a Spectator or not.


Edit: I attached a simple map that is designed to work like you described here:
I checked your maps, Uncle, it helped, thank you!
Recomend everyone to check it out as well if you need assistance with the same topic.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- --

BUT, I still need help with only one thing:
In one of the triggers I have on my map I use the custom script command: "callSetPlayerState (udg_NameOfMyVariable, PLAYER_STATE_OBSERVER, 1). This is the one that makes your player become a spectator

It works fine, and I managed to export trigger data of this map, and then import to another 3 maps and it all went great as well. BUT, when I try to import this same trigger data to another map - compilation fails on saving the map on the line of this command, then all other triggers which use this one are getting disabled and nothing works until I delete this custom script or turn it off.

*Managed to copy trigger data to some new maps while I was replicating this error to make screenshots and sometimes it just works, sometimes it just not.. even on the same maps, very strange...
When this error happens it also says there's an error on other lines of custom scripts if I have any more in the same trigger, seems like some strange bug or exception to me.

p.s. I tried the following multiple times and it did not help:
1) Re-exporting TriggerData from the working map to another clear map
2) The working maps are 3 and 4 player maps, so I use different number of players maps and they all don't work, so it has nothing to do with that.
3) I turned off custom script and tried saving it different ways from different windows of the editor, and it kinda works sometimes, but most of the times still failing at the very end.

Bonus question: on picture 7 you can see a custom script line I use in the same trigger I get error in, what does this command exactly do? I feel that the error can also be conjucted with this line as well, cause sometimes you turn this one off or on, and it compiles normally and sometimes not.
 

Attachments

  • 7bonus.png
    7bonus.png
    4.2 KB · Views: 4
  • 6.png
    6.png
    5.4 KB · Views: 3
  • 5.png
    5.png
    1.5 KB · Views: 2
  • 4.png
    4.png
    3.2 KB · Views: 3
  • 3.png
    3.png
    6 KB · Views: 3
  • 2.5.png
    2.5.png
    5.8 KB · Views: 2
  • 2.png
    2.png
    3.6 KB · Views: 3
  • 1.png
    1.png
    11.2 KB · Views: 4

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
I might have commented this nugget before, but according to Kam it's actually an intentional decision because "using vJASS changes a map fundamentally and should be a choice" (discord quote).
Hmm, to that I say: It's still a choice regardless, and it's better when it's on by default since the only people that don't want to use it are the same people that actually know what it is for (and where to find it). Also, there was literally zero issues when it was on by default and now there's 5 posts a week, seems obvious which was better.
 
Last edited:
Top