Page 1 of 1
Monster Health Does Not Increase
Posted: Mon Jul 11, 2016 10:07 pm
by Fabysk
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;
}
Re: Monster Health Does Not Increase
Posted: Tue Jul 12, 2016 3:42 am
by SwordGrunt
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.
Re: Monster Health Does Not Increase
Posted: Tue Jul 12, 2016 4:49 am
by Fabysk
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)
I am looking for more solutions to this problem. Additional help is welcomed
Re: Monster Health Does Not Increase
Posted: Tue Jul 12, 2016 5:33 am
by Catastrophe
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));
Re: Monster Health Does Not Increase
Posted: Tue Jul 12, 2016 12:34 pm
by ZZYZX
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)).