Page 1 of 1
[SOLVED]Custom effects when a player leave the game
Posted: Fri Jun 26, 2015 12:27 pm
by fr blood
Hellow everyone, I would like to know what is the name of the actor that spawn red particles when a player disconnect or join spectator because I would like to replace him in my project, thanks for the help.
RE: Looking for an actor's name
Posted: Fri Jun 26, 2015 12:31 pm
by Ænima
Might be hard coded, I've never seen an actor name for it.
RE: Looking for an actor's name
Posted: Fri Jun 26, 2015 12:50 pm
by fr blood
I see, maybe that there is way with the scripts, actually I tried that:
Code: Select all
Script XXX (int none) DISCONNECT
{
int x = GetActorX(0);
int y = GetActorY(0);
int z = GetActorZ(0);
Spawn("LeavingTeleportFog",x,y,z,0,0);
}
It's suppose to spawn the custom teleport fog at the place where the play disconnect, but it doesn't work, the teleport fog spawn at the player's start spot.
Anyone go an idea to fix that ?

RE: Looking for an actor's name
Posted: Fri Jun 26, 2015 2:09 pm
by Ænima
Once a player disconnects, their xyz resets, I'm assuming. You'd have to run an Enter script on every player that updates 64-sized global arrays with each player's last XYZ every 6 tics or so. Then on disconnect, just pull that players's X Y and Z from those arrays and reset their values.
RE: Looking for an actor's name
Posted: Fri Jun 26, 2015 2:16 pm
by Watermelon
To confirm: Yes it's natively done, this is the function that is run:
https://bitbucket.org/Torr_Samaho/zandr ... ult#cl-962
RE: Looking for an actor's name
Posted: Fri Jun 26, 2015 3:04 pm
by fr blood
Ok thanks for the help, Aenima's option is the best I have.
EDIT:
Well I wanted to have the effect to spawn when player disconnect and join spect, so I tried that script but it doesn't work at all.
Code: Select all
bool InGame[64];
Script XXX ENTER
{
while(InGame[PlayerNumber()] == TRUE)
{
int x = GetActorX(0);
int y = GetActorY(0);
int z = GetActorZ(0);
delay(2);
}
Spawn("LeavingTeleportFog",x,y,z,0,0);
}
Script XXX (int id) DISCONNECT
{
InGame[PlayerNumber()] = FALSE;
}
So I tried another script, more simple, but this one make the effect only if the player leave the game, and not when he joins spectators.
Code: Select all
Script XXX ENTER
{
while(PlayerInGame(PlayerNumber()))
{
int x = GetActorX(0);
int y = GetActorY(0);
int z = GetActorZ(0);
delay(2);
}
Spawn("LeavingTeleportFog",x,y,z,0,0);
}
Any idea to make this works also when the player joins spectators ?
RE: Custom effects when a player leave the game
Posted: Fri Jun 26, 2015 3:58 pm
by Kaminsky
I believe that the function PlayerInGame() only applies for whether the player is in a multiplayer game or not, but doesn't account for spectators. You should go back to your original code and have it so that in the DISCONNECT script, the LeavingTeleportFog is spawned at whatever coordinates stored in an array correspond to the player's TID. Otherwise, the ENTER script is terminated when the player leaves.
RE: Custom effects when a player leave the game
Posted: Fri Jun 26, 2015 5:44 pm
by fr blood
I managed to make it works with the 1st script, but it makes the same problem, it works when a player leave the game, but not when he spects, I noticed that all in the disconnect script works but the change of the bool.
Code: Select all
bool InGame[64];
Script XX ENTER
{
InGame[PlayerNumber()] = TRUE;
while(InGame[PlayerNumber()] == TRUE)
{
int x = GetActorX(0);
int y = GetActorY(0);
int z = GetActorZ(0);
delay(2);
}
Spawn("LeavingTeleportFog",x,y,z,0,0);
}
Script XXX (int id) DISCONNECT
{
InGame[PlayerNumber()] = FALSE;
}
I guess that the problem is from Zandronum, because when I add something else in the disconnect script it works well when I spect, but the changing of the bool value doesn't.
RE: Custom effects when a player leave the game
Posted: Sat Jun 27, 2015 12:01 am
by Cruduxy
RE: Custom effects when a player leave the game
Posted: Sat Jun 27, 2015 7:37 am
by fr blood
Thanks, I totally forgot these commands from Zandronum, it works nice when I use Zandronum's compiler.
Code: Select all
Script XXX ENTER
{
while(PlayerInGame(PlayerNumber()) && PlayerIsSpectator(PlayerNumber()) == 0)
{
int x = GetActorX(0);
int y = GetActorY(0);
int z = GetActorZ(0);
delay(2);
}
Spawn("LeavingTeleportFog",x,y,z,0,0);
}
But, now I can say that I'll have to wait, because I'm using Zdoom compiler for a Zandronum mode, yeah suprisely it works but it will ignore Zand's funtion like "PlayerIsSpectator", so I guess that I'll have to wait for the update of Zandronum compiler, anyway the problem is solved.