Discuss all aspects related to modding Zandronum here.
-
ForrestMarkX
- Forum Regular
- Posts: 132
- Joined: Sat Jun 16, 2012 2:04 am
- Location: Texas
#1
Post
by ForrestMarkX » Thu Jun 27, 2013 9:57 pm
I'm trying to fix Zomb-8's Versus ACS to where it stops the game when the last zombie quits and subtracts 1 from the numberofinfected int value but my way doesn't seem to work
Here is the part of the code I added
Code: Select all
script 8 (int gone) DISCONNECT
{
If(GameStarted == True)
{
if(CheckActorInventory(0,"MakeMeAZombie"))
{
NumberOfInfected --;
}
if(NumberOfInfected < 1)
{
SetFont("BigFont");
HudMessageBold(s:"The last zombie ragequit!"; HUDMSG_PLAIN, 1, CR_RED, 0.5,0.3,5.0);
SetPlayerProperty(1,1,4);
Delay(35*5);
SetPlayerProperty(1,0,4);
Exit_Normal(0);
}
}
}
Here is the rest of the code
http://pastebin.com/fzSxMR2E
Last edited by
ForrestMarkX on Thu Jun 27, 2013 10:02 pm, edited 1 time in total.

[url=steam://friends/add/'.76561197997881512.']

[/url]
-
HexaDoken
- Forum Regular
- Posts: 352
- Joined: Wed Jul 04, 2012 8:27 am
- Location: Void. Russian Void.
#2
Post
by HexaDoken » Sun Jun 30, 2013 6:21 pm
Eh.
You're checking the actor inventory of the activator of the script, which is not the disconnecting player. Instead, when a DISCONNECT script is called, the game passes his player number to the first variable of the script. In our case this is int Gone. Therefore, instead of using 0 as activator of script, you should use the TID of the player, calculated by gone+500.
tl;dr - replace if(CheckActorInventory(0,"MakeMeAZombie")) with if(CheckActorInventory(gone+500,"MakeMeAZombie"))
-
ZzZombo
- Forum Regular
- Posts: 323
- Joined: Mon Jun 11, 2012 12:11 pm
- Location: Ravenholm
#3
Post
by ZzZombo » Tue Jul 02, 2013 12:50 pm
But by that time he is already gone, so you can't check his inventory.
-
ibm5155
- Addicted to Zandronum
- Posts: 1641
- Joined: Tue Jun 05, 2012 9:32 pm
- Location: Somewhere, over the rainbow
#4
Post
by ibm5155 » Tue Jul 02, 2013 1:07 pm
hmm check every player ingame and update the situation of variables?
-
ForrestMarkX
- Forum Regular
- Posts: 132
- Joined: Sat Jun 16, 2012 2:04 am
- Location: Texas
#5
Post
by ForrestMarkX » Wed Jul 03, 2013 4:49 pm
What if I used GetTeamProperty(1, TPROP_NumPlayers);?

[url=steam://friends/add/'.76561197997881512.']

[/url]
-
Watermelon
- Zandrone
- Posts: 1244
- Joined: Thu Jun 28, 2012 9:07 pm
- Location: Rwanda
#6
Post
by Watermelon » Mon Jul 08, 2013 9:29 pm
You're probably best to just spam a script in a loop like so:
Code: Select all
#define MAXPLAYERS 64
#define TID_START 500 // Or whatever you start your TID's at for players
// Run me when a zombie is chosen or theres at least one infected
Script 8 (void)
{
int infectedCount = 0;
int playersAlive = 0;
// Continue looping forever until there's not enough zombies
while (true)
{
// Always start at zero and add zombies
infectedCount = 0;
playersAlive = 0;
// Check each player
for (int p = 0; p < MAXPLAYERS; p++)
{
// Check each player TID for zombie stuff
if (CheckActorInventory(p + TID_START, "MakeMeAZombie") > 0)
{
infectedCount++;
}
// If they're alive, increment the number
if (GetActorProperty (p + TID_START, APROP_HEALTH) > 0)
{
playersAlive++;
}
}
// If it counted no zombies, we won (or if there's zero players we win anyways); or everyone's a zombie
if (infectedCount <= 0 || playersAlive <= infectedCount)
{
break;
}
// Prevent runaway
delay(1);
}
// ...end game code here
}
Script does not take into account if there's a zombie left.
Put brackets in for clarity
EDIT: Forgot the delay, my bad
Last edited by
Watermelon on Mon Jul 08, 2013 9:34 pm, edited 1 time in total.