How to manually score (non-team) or end the level?

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

How to manually score (non-team) or end the level?

#1

Post by SwordGrunt » Wed Apr 20, 2016 1:55 am

There are scoring functions for team-based modes but I can't find anything regarding player score modifying (via Decorate/ACS). ScoreItem does not appear to work, nor does Team_Score do anything on said gamemodes.

I feel I'm missing something really obvious... or should be, since score is such a trivial thing and can be fully controlled via ACS on team games. Does anyone know a way?

I can get around this if there's a way to end/exit the current level that is not a classic exit function (those appear to do nothing if sv_noexit is true, even if called from a script). Of course, ConsoleCommand("nextmap") would do the trick but I'd rather not use that unless it's my last option...

User avatar
ZZYZX
Posts a lot
Posts: 742
Joined: Thu Jun 07, 2012 5:56 pm
Location: Ukraine
Clan: A3
Clan Tag: [A3]

Re: How to manually score (non-team) or end the level?

#2

Post by ZZYZX » Wed Apr 20, 2016 9:38 am

http://zdoom.org/wiki/Score
It can be manipulated from ACS with APROP_Score
P.S. you can also exit with sv_noexit if you reset activator to world, according to this function in ZDoom source code:

Code: Select all

// [RH] Check dmflags for noexit and respond accordingly
bool CheckIfExitIsGood (AActor *self, level_info_t *info)
{
	cluster_info_t *cluster;

	// The world can always exit itself.
	if (self == NULL) // <----------------------------------------------------------
		return true;

	// We must kill all monsters to exit the level.
	if ((dmflags2 & DF2_KILL_MONSTERS) && level.killed_monsters != level.total_monsters)
		return false;

	// Is this a deathmatch game and we're not allowed to exit?
	if ((deathmatch || alwaysapplydmflags) && (dmflags & DF_NO_EXIT))
	{
		P_DamageMobj (self, self, self, TELEFRAG_DAMAGE, NAME_Exit);
		return false;
	}
	// Is this a singleplayer game and the next map is part of the same hub and we're dead?
	if (self->health <= 0 &&
		!multiplayer &&
		info != NULL &&
		info->cluster == level.cluster &&
		(cluster = FindClusterInfo(level.cluster)) != NULL &&
		cluster->flags & CLUSTER_HUB)
	{
		return false;
	}
	if (deathmatch)
	{
		Printf ("%s exited the level.\n", self->player->userinfo.GetName());
	}
	return true;
}

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

Re: How to manually score (non-team) or end the level?

#3

Post by SwordGrunt » Wed Apr 20, 2016 1:45 pm

Changing the score property does not affect the player's score on Zandronum's point-based gamemodes, I tested that as well as ScoreItem. It seems the score property and player score in Zandronum are completely unrelated.

You're right, though, I should've suspected sv_noexit would only affect players. That takes care of a lot of things. Thank you!

User avatar
doomista
Forum Regular
Posts: 147
Joined: Sat Mar 07, 2015 6:58 pm
Location: I've been to hell. Twice

Re: How to manually score (non-team) or end the level?

#4

Post by doomista » Sun May 01, 2016 8:48 pm

SwordGrunt wrote:Changing the score property does not affect the player's score on Zandronum's point-based gamemodes, I tested that as well as ScoreItem. It seems the score property and player score in Zandronum are completely unrelated.

You're right, though, I should've suspected sv_noexit would only affect players. That takes care of a lot of things. Thank you!
It does, indeed. But what about non-team game? I cannot adjust player score directly, so I have to use a variable (or a dummy item, it doesn't matter since it is not displayed in the hud). But when I use Exit_Normal(0) then how can I alter intermission scoreboard screen to display my custom points? I know how for example ZanXP does that (in OPEN script with HudMessageBold) but that is not applicable since the execution of all scripts is terminated after calling Exit_Normal and intermission screen itself somehow does not start a new OPEN script (I wonder how it is even possible to alter it with the open script. I would expect from "pointlimit hit" event to terminate the open script and call unloading and then terminating it too and switching to intermission).

Catastrophe
Retired Staff / Community Team Member
Posts: 2569
Joined: Sat Jun 02, 2012 2:44 am

Re: How to manually score (non-team) or end the level?

#5

Post by Catastrophe » Sun May 01, 2016 10:23 pm

Friendly reminder that these tickets exist and you should support them:
http://zandronum.com/tracker/view.php?id=2046
http://zandronum.com/tracker/view.php?id=2575

If these get added, everything you guys are saying on this thread can be done.

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

Re: How to manually score (non-team) or end the level?

#6

Post by SwordGrunt » Sun May 01, 2016 10:59 pm

doomista wrote:
SwordGrunt wrote:Changing the score property does not affect the player's score on Zandronum's point-based gamemodes, I tested that as well as ScoreItem. It seems the score property and player score in Zandronum are completely unrelated.

You're right, though, I should've suspected sv_noexit would only affect players. That takes care of a lot of things. Thank you!
It does, indeed. But what about non-team game? I cannot adjust player score directly, so I have to use a variable (or a dummy item, it doesn't matter since it is not displayed in the hud). But when I use Exit_Normal(0) then how can I alter intermission scoreboard screen to display my custom points? I know how for example ZanXP does that (in OPEN script with HudMessageBold) but that is not applicable since the execution of all scripts is terminated after calling Exit_Normal and intermission screen itself somehow does not start a new OPEN script (I wonder how it is even possible to alter it with the open script. I would expect from "pointlimit hit" event to terminate the open script and call unloading and then terminating it too and switching to intermission).
Your best bet is to customize your own score display and intermission picture before actually ending the level (a la Shotgun Frenzy).

User avatar
doomista
Forum Regular
Posts: 147
Joined: Sat Mar 07, 2015 6:58 pm
Location: I've been to hell. Twice

Re: How to manually score (non-team) or end the level?

#7

Post by doomista » Mon May 02, 2016 5:12 am

Catastrophe wrote:Friendly reminder that these tickets exist and you should support them:
http://zandronum.com/tracker/view.php?id=2046
http://zandronum.com/tracker/view.php?id=2575

If these get added, everything you guys are saying on this thread can be done.
Some tickets regarding having the same account on tracker and forum would be nice too...

User avatar
doomista
Forum Regular
Posts: 147
Joined: Sat Mar 07, 2015 6:58 pm
Location: I've been to hell. Twice

Re: How to manually score (non-team) or end the level?

#8

Post by doomista » Mon May 02, 2016 5:38 am

SwordGrunt wrote: Your best bet is to customize your own score display and intermission picture before actually ending the level (a la Shotgun Frenzy).
Never played it and official download link seems to be down... But i guess you meant stuff from this picture [spoiler]Image[/spoiler]. I will probably have to forget about some of my ideas and pick the least annoying solution. I am confused right now, because somehow the LMS countdown before the match is either INRESULTSEQUENCE and COUNTDOWN. I dunno why, but both conditions in my scripts are executed during the countdown. I can display actual scores during these countdowns and when someone wins, delay the Exit_Normal by 10s (duration of the countdown).

Pros & Cons:
+ Players can play and see the scores at the same time. This way they will not get bored even if the scores are displayed for 10s
+ I can display scores before each round
- When somebody wins, there will be 10s long scoreboard (but players can still play) and then the game jumps to another intermission screen with totally inadequate results
- HUD mania. For the lower resolutions, the screen will get overpopulated by numbers and letters (but only during the countdowns)

The last problem, the messy HUD is not that much of an issue, though. Even four years old netbooks can run doom and namely this mod with slopes and 3D floors in a decent resolution of 1024x768, not to mention that cheapest today's computers should be able to run the game at HD resolution (but they should have a Windows and a 4GB ram).
But I guess there is no such thing as Exit_Silent which would act in the same manner as the silent teleport, only between levels with no intermission screen :biggrin:

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

Re: How to manually score (non-team) or end the level?

#9

Post by SwordGrunt » Mon May 02, 2016 4:27 pm

No I did not mean that, it displays a picture at round end with a victory or defeat message and some stats of the level if I recall correctly.

You can set players as invulnerable and totally frozen upon round end just like Zandronum usually does to avoid an inconsistent score on the intermission, and you can use the forcescaled property so the HUD always has the same resolution reagrdless of the user's own.

User avatar
doomista
Forum Regular
Posts: 147
Joined: Sat Mar 07, 2015 6:58 pm
Location: I've been to hell. Twice

Re: How to manually score (non-team) or end the level?

#10

Post by doomista » Mon May 02, 2016 5:38 pm

SwordGrunt wrote:No I did not mean that, it displays a picture at round end with a victory or defeat message and some stats of the level if I recall correctly.

You can set players as invulnerable and totally frozen upon round end just like Zandronum usually does to avoid an inconsistent score on the intermission, and you can use the forcescaled property so the HUD always has the same resolution reagrdless of the user's own.
Yeah, but how to skip the real intermission screen? I cannot find any practical cvar for this purpose.

Btw: How can I get a player name from a script in a multiplayer? GetCVarString("name") gives me the name of the player who runs the server. GetUserCvarString(PlayerNumber(), "name") gives me the string "prog1" regardless of the connected player (I am calling this from ENTER).

Catastrophe
Retired Staff / Community Team Member
Posts: 2569
Joined: Sat Jun 02, 2012 2:44 am

Re: How to manually score (non-team) or end the level?

#11

Post by Catastrophe » Mon May 02, 2016 5:58 pm

doomista wrote:
SwordGrunt wrote:No I did not mean that, it displays a picture at round end with a victory or defeat message and some stats of the level if I recall correctly.

You can set players as invulnerable and totally frozen upon round end just like Zandronum usually does to avoid an inconsistent score on the intermission, and you can use the forcescaled property so the HUD always has the same resolution reagrdless of the user's own.
Yeah, but how to skip the real intermission screen? I cannot find any practical cvar for this purpose.

Btw: How can I get a player name from a script in a multiplayer? GetCVarString("name") gives me the name of the player who runs the server. GetUserCvarString(PlayerNumber(), "name") gives me the string "prog1" regardless of the connected player (I am calling this from ENTER).
use strparam

User avatar
doomista
Forum Regular
Posts: 147
Joined: Sat Mar 07, 2015 6:58 pm
Location: I've been to hell. Twice

Re: How to manually score (non-team) or end the level?

#12

Post by doomista » Mon May 02, 2016 7:24 pm

Catastrophe wrote:
doomista wrote:
SwordGrunt wrote:No I did not mean that, it displays a picture at round end with a victory or defeat message and some stats of the level if I recall correctly.

You can set players as invulnerable and totally frozen upon round end just like Zandronum usually does to avoid an inconsistent score on the intermission, and you can use the forcescaled property so the HUD always has the same resolution reagrdless of the user's own.
Yeah, but how to skip the real intermission screen? I cannot find any practical cvar for this purpose.

Btw: How can I get a player name from a script in a multiplayer? GetCVarString("name") gives me the name of the player who runs the server. GetUserCvarString(PlayerNumber(), "name") gives me the string "prog1" regardless of the connected player (I am calling this from ENTER).
use strparam
I cannot see how it's supposed to help. But I just found out that not one but two different approaches to the subject work in Zan3.0, so it might be just a problem of 2.1.2. At the other hand, SetActorProperty(0, APROP_Health, 100); does not work in Zan3.0, so it's a lose-lose situation.

EDIT: It's not APROP_Health, it's the custom projectile with Damage (50). It always does only half of the damage. Last time I was trying reproduce this bug I failed, I'll maybe have more luck this time.

Catastrophe
Retired Staff / Community Team Member
Posts: 2569
Joined: Sat Jun 02, 2012 2:44 am

Re: How to manually score (non-team) or end the level?

#13

Post by Catastrophe » Mon May 02, 2016 9:49 pm

doomista wrote:
Catastrophe wrote:
doomista wrote:
SwordGrunt wrote:No I did not mean that, it displays a picture at round end with a victory or defeat message and some stats of the level if I recall correctly.

You can set players as invulnerable and totally frozen upon round end just like Zandronum usually does to avoid an inconsistent score on the intermission, and you can use the forcescaled property so the HUD always has the same resolution reagrdless of the user's own.
Yeah, but how to skip the real intermission screen? I cannot find any practical cvar for this purpose.

Btw: How can I get a player name from a script in a multiplayer? GetCVarString("name") gives me the name of the player who runs the server. GetUserCvarString(PlayerNumber(), "name") gives me the string "prog1" regardless of the connected player (I am calling this from ENTER).
use strparam
I cannot see how it's supposed to help. But I just found out that not one but two different approaches to the subject work in Zan3.0, so it might be just a problem of 2.1.2. At the other hand, SetActorProperty(0, APROP_Health, 100); does not work in Zan3.0, so it's a lose-lose situation.

EDIT: It's not APROP_Health, it's the custom projectile with Damage (50). It always does only half of the damage. Last time I was trying reproduce this bug I failed, I'll maybe have more luck this time.
int name = strParam(n:playernumber()+1);

Keep in mind strparam has its limits and it can't be used outside of the same tic it was made unless you are playing this on the latest dev-build, which in that case it lasts forever.

User avatar
doomista
Forum Regular
Posts: 147
Joined: Sat Mar 07, 2015 6:58 pm
Location: I've been to hell. Twice

Re: How to manually score (non-team) or end the level?

#14

Post by doomista » Mon May 02, 2016 10:12 pm

Catastrophe wrote: int name = strParam(n:playernumber()+1);

Keep in mind strparam has its limits and it can't be used outside of the same tic it was made unless you are playing this on the latest dev-build, which in that case it lasts forever.
Oh, the "n" cast type! Apparently I didn't do my homework when I completely disregarded the documentation page of print. I would never expect to have this kind of functionality implemented here. Thanks, I'll try to finish the job with this.

Catastrophe
Retired Staff / Community Team Member
Posts: 2569
Joined: Sat Jun 02, 2012 2:44 am

Re: How to manually score (non-team) or end the level?

#15

Post by Catastrophe » Mon May 02, 2016 10:17 pm

doomista wrote:
Catastrophe wrote: int name = strParam(n:playernumber()+1);

Keep in mind strparam has its limits and it can't be used outside of the same tic it was made unless you are playing this on the latest dev-build, which in that case it lasts forever.
Oh, the "n" cast type! Apparently I didn't do my homework when I completely disregarded the documentation page of print. I would never expect to have this kind of functionality implemented here. Thanks, I'll try to finish the job with this.
No prob, if you find strange anomalies that only happen online, please report it on the tracker.

User avatar
doomista
Forum Regular
Posts: 147
Joined: Sat Mar 07, 2015 6:58 pm
Location: I've been to hell. Twice

Re: How to manually score (non-team) or end the level?

#16

Post by doomista » Tue May 03, 2016 4:58 am

Catastrophe wrote:
doomista wrote:
Catastrophe wrote: int name = strParam(n:playernumber()+1);

Keep in mind strparam has its limits and it can't be used outside of the same tic it was made unless you are playing this on the latest dev-build, which in that case it lasts forever.
Oh, the "n" cast type! Apparently I didn't do my homework when I completely disregarded the documentation page of print. I would never expect to have this kind of functionality implemented here. Thanks, I'll try to finish the job with this.
No prob, if you find strange anomalies that only happen online, please report it on the tracker.
I already did, but it turned out I just didn't know about the relation of skill and damage reduction even in MP.

Post Reply