hechelion, sorry for the wait.
Here's respawn1.c to control player 1's respawn coords:
Code:
void main(){
void P = getplayerproperty(0, "entity");
int x = getindexedvar(0); //Get respawn x coordinate
int z = getindexedvar(1); //Get respawn z coordinate
int a = getindexedvar(2); //Get respawn a coordinate
int Flag = getindexedvar(3); //Get respawn flag
int XPos = openborvariant("xpos");
int Sx;
if(a == NULL()){
a = 0;
}
if(x && z){
if(Flag){
Sx = x;
} else {
Sx = XPos+x;
}
changeentityproperty(P, "position", Sx, z, a);
}
}
The script takes respawn coords defined in indexed variables 0,1,2 for x, z and y respectively
To define those, you can do it directly on level text like this:
Code:
spawn xxxx
@script
void main()
{
setindexedvar(0, 100); // respawn x
setindexedvar(1, 210); // respawn z
setindexedvar(2, 302); // respawn a
}
@end_script
coords 450 200
at 120
This script is entity independent so it can be declared on any entity, just make sure it's declared on correct scroll position. Ah yes, the most important part is the scroll position, in above example the respawn coords will be applied after the entity in example is spawned at 120
You can declare the script on a blank entity if you don't have any entities to declare on
You can declare another of this script to change previous respawn coords
Indexed variable 3 is for defining respawning type. Setting the variable to 1 will set strict respawn coords i.e player 1 will be respawned at defined coords regardless of current scroll position.
This is for player 1. For player 2,3 and 4, you might need to make similar respawn script using different set of indexed variables
I know that's long explanation but there's another important thing. Indexed variables are persistent and won't be cleared on its own therefore you'd need to created endlevel.c to clear values in indexed variables. Here's an example:
endlevel.c
Code:
void main()
{
setindexedvar(0, NULL());
setindexedvar(1, NULL());
setindexedvar(2, NULL());
setindexedvar(3, NULL());
}
Above system uses 4 indexed variables for one player. I have an idea on how to reduce number of used indexed variables, let me try it myself
BTW this thread should be in help section