[ACS] Survival ACS Last Life Execute is buggy

Discuss all aspects related to modding Zandronum here.
Post Reply
TaporGamingBugReport
 
Posts: 49
Joined: Mon Apr 30, 2018 9:00 am
Clan: DoomBreakerMadness
Clan Tag: doombreakermdnss

[ACS] Survival ACS Last Life Execute is buggy

#1

Post by TaporGamingBugReport » Thu Aug 29, 2019 11:16 pm

I have so long to wait about fix it.

Thanks to TDRR for this code

Code: Select all

int DeadPlayers; //This is a script-scope variable.

Script "Suvival_Death" DEATH
{
     if(PlayerIsSpectator(PlayerNumber()) == 2); //This checks if the player ran out of lives
     {
          DeadPlayers++;
     }
     if(DeadPlayers >= PlayerCount()); //This checks if all players are dead.
     {
          //do whatever you need to do here
     }
}
After so i added ; on 2 ) but it's buggy. TDRR can you fix this?

User avatar
Fused
Contributor
Posts: 658
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Contact:

[ACS] Re: Survival ACS Last Life Execute is buggy

#2

Post by Fused » Sat Aug 31, 2019 3:57 pm

Then why did you add it?

Your if statement will no longer execute the code inside now, because the semicolon indicates the end of the action. I'm suprised this even compiled at all.
Removing those semicolons it will fix it.
My mods
Image Image

My socials
Image Image

TaporGamingBugReport
 
Posts: 49
Joined: Mon Apr 30, 2018 9:00 am
Clan: DoomBreakerMadness
Clan Tag: doombreakermdnss

[ACS] Re: Survival ACS Last Life Execute is buggy

#3

Post by TaporGamingBugReport » Sat Aug 31, 2019 5:32 pm

Fixed. but... only 2 players died. they executed the script to goes there instead of all players are dead


Could someone to fix this?

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

[ACS] Re: Survival ACS Last Life Execute is buggy

#4

Post by Empyre » Tue Sep 03, 2019 7:06 pm

Did you remove the semicolon after both of the If statements? The semicolon after the if statement will cause it to execute an empty command block if the condition is true, and then it will always execute the following command block unconditionally.

Also, you have the DeadPlayers variable declared outside of the script, so it is not a script-scope variable despite what the comment says. Every time the script is executed, it will add more to that variable, instead of starting at 0, so it becomes >= PlayerCount() too soon. To fix that, move the variable declaration inside the script, after the first { and before the first if.
"For the world is hollow, and I have touched the sky."

TaporGamingBugReport
 
Posts: 49
Joined: Mon Apr 30, 2018 9:00 am
Clan: DoomBreakerMadness
Clan Tag: doombreakermdnss

[ACS] Re: Survival ACS Last Life Execute is buggy

#5

Post by TaporGamingBugReport » Wed Sep 04, 2019 2:21 am

Ok i see... Only 3 or 2 player died to execute the final results but 1 player in server and lost all lives to execute the final results is not compatiable yet.
If someone disconnected the game. Add a requirement to execute round lost.Who need to add it?

Code: Select all

int DeadPlayers; //This is a script-scope variable.

Script "SuvivalDeath" DEATH //Only Compatiable 3 Players in the game
{
     if(!GetCvar("survival")) terminate;
	 	
	 if(!GetPlayerLivesLeft(PlayerNumber()))
	 {
     if(PlayerIsSpectator(PlayerNumber()) == 8);
     {
          DeadPlayers++;
		  Log(n:0, s:" \cgis out!");
     }
     if(DeadPlayers > PlayerCount()) //Not Executed if is one player in the server and died
     {
	      Log(s:"\cgMission Failed!");
	 }
   }
}
but it kinda more buggy if after exiting the map and survived yet

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

[ACS] Re: Survival ACS Last Life Execute is buggy

#6

Post by Empyre » Wed Sep 04, 2019 4:50 pm

What you need is a loop. This code is not tested, but it should, at most, need some minor tweaking.

Code: Select all

#define MaxPlayers 50;
script "SurvivalDeath" DEATH
{
     if (!GetCvar("survival")) terminate;
     int DeadPlayers;
     for (int I = 0; I < MaxPlayers; I++)
     {
          if (PlayerInGame(I))
               if (PlayerIsSpectator(I) == 8)
               {
                    DeadPlayers++;
                    If (PlayerNumber() == I)
                        Log(n:0, s:" \cgis out!");
               }
     }
     if(DeadPlayers >= PlayerCount())
     {
	      Log(s:"\cgMission Failed!");
     }
}
"For the world is hollow, and I have touched the sky."

TaporGamingBugReport
 
Posts: 49
Joined: Mon Apr 30, 2018 9:00 am
Clan: DoomBreakerMadness
Clan Tag: doombreakermdnss

[ACS] Re: Survival ACS Last Life Execute is buggy

#7

Post by TaporGamingBugReport » Sun Sep 08, 2019 8:36 am

Empyre wrote:
Wed Sep 04, 2019 4:50 pm
What you need is a loop. This code is not tested, but it should, at most, need some minor tweaking.

Code: Select all

#define MaxPlayers 50;
script "SurvivalDeath" DEATH
{
     if (!GetCvar("survival")) terminate;
     int DeadPlayers;
     for (int I = 0; I < MaxPlayers; I++)
     {
          if (PlayerInGame(I))
               if (PlayerIsSpectator(I) == 8)
               {
                    DeadPlayers++;
                    If (PlayerNumber() == I)
                        Log(n:0, s:" \cgis out!");
               }
     }
     if(DeadPlayers >= PlayerCount())
     {
	      Log(s:"\cgMission Failed!");
     }
}
I tested out but... wont work. Semicolon is too buggy to risk the script should you add the semicolons?

User avatar
Fused
Contributor
Posts: 658
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Contact:

[ACS] Re: Survival ACS Last Life Execute is buggy

#8

Post by Fused » Mon Sep 09, 2019 6:27 pm

I think you should slow down a bit and try something easier, because this type of code is still a little advanced for you. There's no need for any extra stray semicolons, and a script like this isn't too hard at all. Even if you get a working script, you will quickly have a problem with including new features since you have no clue what each block of code does. Perhaps you should try and make something a little more simple first?
My mods
Image Image

My socials
Image Image

Post Reply