Skip to content

Added a game_crash entity that allows mappers to crash the game and display a message#523

Draft
Wikot235 wants to merge 2 commits intomapbase-source:developfrom
Wikot235:game_crash
Draft

Added a game_crash entity that allows mappers to crash the game and display a message#523
Wikot235 wants to merge 2 commits intomapbase-source:developfrom
Wikot235:game_crash

Conversation

@Wikot235
Copy link
Copy Markdown

@Wikot235 Wikot235 commented Apr 3, 2026

game_crash

This PR adds a new game_crash entity to Mapbase, it allows mappers to crash the game and display a message.

Inputs

  • Crash

Keyvalues

  • title - text in the top bar of the message box
  • message - text in the message box
  • type - how the entity behaves when the crash input is fired, 0 - crashes without a message box, 1 - crashes with an engine error window, 2 - crashes with a message box

Now, you might be wondering, what is the difference between type 1 and type 2. There is one big problem with the Error() function used in type 1, you can't change the title of the window, as the function declaration is in tier0 (which we don't have access to).

Because of that, I created the type 2, it's using the MessageBoxA function from windows.h, but it's not perfect either, the first thing, is that I can't perfectly replicate the behavior of the Error() function. The Error() function makes the message box appear AFTER the game window is closed, but with MessageBoxA it shows the message box and only after clicking OK it closes the game window. Apart from that, it generates lots of "macro redefinition" warnings. It only works on Windows, on other OS it will fall back to Error(), but I have no idea how Error() behaves on Linux to be honest, so that might be unnecessary.


PR Checklist

  • My PR follows all guidelines in the CONTRIBUTING.md file
  • My PR targets a develop branch OR targets another branch with a specific goal in mind

@Wikot235 Wikot235 marked this pull request as draft April 3, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant