Monster Health Does Not Increase

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
Fabysk
Forum Regular
Posts: 469
Joined: Sat Sep 22, 2012 8:17 pm
Location: In a house...duhh

Monster Health Does Not Increase

#1

Post by Fabysk » Mon Jul 11, 2016 10:07 pm

Making my own wave progression code. During the process, the monster's health is not increasing after a new wave has begun. I replaced APROP_SpawnHealth with APROP_Health, but the monsters stopped spawning after wave 2. Any solutions to this?

Code: Select all

Int ZHealth = 100;
int RoundNumber = 0;
Script 333 (void)
{
	AmbientSound("ROUND/ROUND_ST", 127);
	RoundNumber ++;
	SpawnSpotForced("Slowzombie1",42, 100, 0);
	delay(20);
	SetActorProperty(100, APROP_SpawnHealth, ZHealth + 100);
}



Script 334 Enter
{
	While(True)
	{
	If (ThingCountName("SlowZombie1", 100) == 0)
	{
		Print(s:"Round Complete");
		AmbientSound("ROUND/ROUND_EN", 127);
		Delay(300);
		ACS_Execute(333,0,0,0,0);
		ACS_Execute(302,0,0,0,0);
		}
		delay(1);
}
}

script 302 enter//DISPLAY ROUND NUMBER
{
      SetFont("BIGFONT");
              HUDMessage(d:RoundNumber;
              HUDMSG_PLAIN, 99, CR_Red, 0.11, 0.94, 0);
			  DELAY(1);
			  RESTART;
}

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

Re: Monster Health Does Not Increase

#2

Post by SwordGrunt » Tue Jul 12, 2016 3:42 am

First of all, I would increase the 1 tic delay to at least 10 tics. Detecting the end of a wave isn't something that needs to be done instantly. I would also change the enter script to an open script and if you want to scale the spawned monsters off the amount of players, PlayerCount is a handy function.

Change script 302 to a closed script and call it only when the round ends, so the HudMessage also needs not be sent every single tic.

APROP_Health should work fine. I don't see why the monsters would stop spawning after wave 2. If you want the health to continuously increase every wave, you should increase the value of zhealth every wave as well, perhaps relative to the value of roundnumber to make it progressively harder.

User avatar
Fabysk
Forum Regular
Posts: 469
Joined: Sat Sep 22, 2012 8:17 pm
Location: In a house...duhh

Re: Monster Health Does Not Increase

#3

Post by Fabysk » Tue Jul 12, 2016 4:49 am

SwordGrunt wrote:First of all, I would increase the 1 tic delay to at least 10 tics. Detecting the end of a wave isn't something that needs to be done instantly. I would also change the enter script to an open script and if you want to scale the spawned monsters off the amount of players, PlayerCount is a handy function.

Change script 302 to a closed script and call it only when the round ends, so the HudMessage also needs not be sent every single tic.

APROP_Health should work fine. I don't see why the monsters would stop spawning after wave 2. If you want the health to continuously increase every wave, you should increase the value of zhealth every wave as well, perhaps relative to the value of roundnumber to make it progressively harder.
I recorded the affects before changing anything (APROP_SpawnHealth and APROP_Health)
phpBB [media]

I am looking for more solutions to this problem. Additional help is welcomed

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

Re: Monster Health Does Not Increase

#4

Post by Catastrophe » Tue Jul 12, 2016 5:33 am

Here is your problem. APROP_SPAWNHEALTH can only be used with players, not monsters. See here. Use APROP_HEALTH instead.

To check if this is working, print out the monsters health after you increase it by doing print(d:getactorproperty(100, aprop_health));

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

Re: Monster Health Does Not Increase

#5

Post by ZZYZX » Tue Jul 12, 2016 12:34 pm

SwordGrunt wrote:First of all, I would increase the 1 tic delay to at least 10 tics. Detecting the end of a wave isn't something that needs to be done instantly.
Rather something like this:

Code: Select all

int oldRoundNumber = -1;
while (true)
{
  if (RoundNumber != oldRoundNumber)
  {
    HudMessage(d:roundNumber; HUDMSG_PLAIN, 99, CR_RED, 0.11, 0.94, 2147483647);
    oldRoundNumber = RoundNumber;
  }
  
  Delay(1);
}
Welcome to serverside scripting. Never display hudmessages every tic, better use permanent hudmessages and replace them when needed. HudMessage packet is reliable.
Also, why do you call script 302 both as ENTER and when the round ends? (it probably doesn't work in the second case anyway, because the script is already running and ACS_Execute will have no effect)
Also, SetActorProperty(100, APROP_Health, ZHealth + 100 * (RoundNumber-1)).

Post Reply