There's a lot wrong with this, which I will explain.
First of all, here's all the code you should use.
(might contain errors, I never really tested this)
Code: Select all
// Maximum player cap in Zandronum
#define MAX_PLAYERS 64
// Unique TID
#define PLAYER_TID 600
script 5 (void)
{
for (int i = 0; i < MAX_PLAYERS; ++i) {
if (playeringame(i)) {
SetActorProperty(i+PLAYER_TID, APROP_INVULNERABLE, TRUE);
}
}
SetPlayerProperty(TRUE, TRUE, PROP_TOTALLYFROZEN);
ChangeCamera(18, TRUE, 0);
delay(35);
ACS_Execute(6, 0, 0, 0, 0);
// *insert cutscene shit*
ChangeCamera(0, TRUE, 0);
for (i = 0; i < MAX_PLAYERS; ++i) {
if (playeringame(i)) {
SetActorProperty(i+PLAYER_TID, APROP_INVULNERABLE, FALSE);
}
}
SetPlayerProperty(TRUE, FALSE, PROP_TOTALLYFROZEN);
}
script 1 ENTER
{
// Give our player his own TID, so we can distinguish him from other stuff.
Thing_ChangeTid(0, PLAYER_TID + PlayerNumber());
}
script 2 RESPAWN
{
ACS_ExecuteAlways(1, 0);
}
script 3 DEATH
{
// Unsign our TID.
Thing_ChangeTid(0, 0);
}
It looks like a lot, but it's really simple once you understand the logic behind it.
Firstly, you need to teach yourself to always give a unique id to your player. It's what the last three scripts do.
In short, your player has a TID of his playernumber+600. This is given when he enters, and respawns.
For safety reasons, your TID is removed when you die. Because corpses can have TIDs.
Secondly, remember you need to use a loop for almost anything when it comes to targetting multiple players.
Only ChangeCamera() and SetPlayerProperty() in this case has a boolean which allows you to target everyone.
Although to be honest you should give ChangeCamera() a seperate 1-tic script because you can just spy out of camera's...
SetPlayerProperty() is for players only. If you look on the wiki you notice it has a "who" argument, which is because it doesn't care about monsters or all that.
SetActorProperty() on the other hand allows you to set stuff on monsters and stuff aswell. The wiki also gives it an "tid" argument, hence the whole TID story.