Author Topic: Detect map end  (Read 1978 times)

0 Members and 1 Guest are viewing this topic.

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Detect map end
« on: October 26, 2014, 05:48:41 am »
I haven't done any scripting for over a year and now I'm trying to get back at it. I'm facing a problem of detecting the moment the current map ends. I know I can check for score or time limit being reached but what if map ends because of /nextmap command or via Map.Nextmap? There's OnBeforeMapChange event but from what I've seen it seems to be triggered after the server changes the map (or at least console text written in this event shows up after map's changed). I remember seeing somewhere something like OnRoundEnd but I think that never got implemented. So the question is: how can I check that current map is ending via /nextmap or Map.Nextmap?
I'm pretty sure I know the answer but hey... never hurts to ask.

Offline ExHunter

  • Inactive Soldat Developer
  • Soldier
  • ******
  • Posts: 154
  • Speedy go!
Re: Detect map end
« Reply #1 on: October 26, 2014, 05:45:15 pm »
procedure OnGameEnd(); in old scriptcore.

http://wiki.soldat.pl/index.php/TMap.OnBeforeMapChange is triggered before map change.

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: Detect map end
« Reply #2 on: October 26, 2014, 06:07:34 pm »
procedure OnGameEnd(); in old scriptcore.
Thanks, it's not listed on the wiki page.

http://wiki.soldat.pl/index.php/TMap.OnBeforeMapChange is triggered before map change.
I know what it says in the wiki but I've been testing it and if you write to console in that event it'll show after new map is loaded, not before.

Offline ExHunter

  • Inactive Soldat Developer
  • Soldier
  • ******
  • Posts: 154
  • Speedy go!
Re: Detect map end
« Reply #3 on: October 26, 2014, 06:11:50 pm »
Then it's a bug. OnGameEnd is executed at the same time as OnBeforeMapChange. :/

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: Detect map end
« Reply #4 on: October 26, 2014, 06:54:59 pm »
One more question. Can I combine SC2 and SC3 in one file? Cause when I added OnGameEnd to my SC3 .pas it wasn't triggered. What's the proper declaration?
Code: [Select]
procedure OnGameEnd();?

EDIT: Scratch that, I forgot to set Legacy=1. But still, OnGameEnd() is triggered after new map has been loaded.
« Last Edit: October 26, 2014, 06:59:15 pm by JotEmI »

Offline kicikici

  • Soldier
  • **
  • Posts: 180
Re: Detect map end
« Reply #5 on: October 26, 2014, 07:00:48 pm »
OnGameEnd is listed here
http://wiki.soldat.pl/index.php/Category:Beta_Server_Scripting

Can I combine SC2 and SC3 in one file?
Yep, add line
Code: [Select]
Legacy=1to config.ini
Classic banana

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: Detect map end
« Reply #6 on: October 27, 2014, 10:35:15 am »
OnGameEnd is listed here
http://wiki.soldat.pl/index.php/Category:Beta_Server_Scripting
Quote
procedure OnGameEnd();
 
 Parameter Info:
  None
 
 Description:
  This procedure will be called every time the current game ends via Time Limit or Score Limit.
Not what I was looking for. I need an event that's called when game ends via /nextmap or votemap or script. Besides that, OnGameEnd() is called after new map has been loaded.
I guess I need to post it in the SC suggestions.

Can I combine SC2 and SC3 in one file?
Yep, add line
Code: [Select]
Legacy=1to config.ini
Yeah, I know. Forgot about that.