Script Name: Rooms
Script Description: Adds the possibility to define static teleporters in maps
Original Author(s): CarlHamilton
Core Version: 2.6.2
Code: The move procedure
//checks player locations and moves when needed
procedure move();
begin
if (active) then begin
//player
for i:= 1 to 32 do begin
getplayerxy(i,x,y);
if (getplayerstat(i,'active')) then
//pair
for j:= 1 to nrpairs do
//location
for k:= 1 to 2 do
//it is a set coordinate {=not (0,0)}
if ((paira[j][k][1]<>0) or (paira[j][k][2]<>0)) then
//long enough since last move
if ((paused[i] = 0)
//shorter distance than radius
and (distance(x,y,paira[j][k][1],paira[j][k][2]) < paira[j][k][3])
//it isnt a oneway
and (paira[j][k][4] <> 1))
//right team, or any team allowed
and ((getplayerstat(i,'team') = paira[j][k][5]) or (paira[j][k][5] = 0))
//clear to move
then
begin
//destination is opposite from starting point
l:= iif(k=1,2,1);
moveplayer(i,paira[j][l][1],paira[j][l][2]);
//stop the player from warping again too soon
paused[i]:= pause;
end;
end;
end;
end;
Comments:
Go ahead and test it on ctf_laos which already has set coordinates (check the .ini file in coords)
Please go ahead and use this script if you're a mapper, I'm hoping it would add a new aspect to
maps in soldat
You might want to mark the warp zones on your map some way (doors, shiny ray, sign etc) since otherwise it's kind of hard to know where they are
Notes:
First map on server activation doesn't load its coordinates, after that it's done automatically
Use the /loadco command to manually load coordinates
Dont use the coordinate (0,0)
The script doesn't work on bots
The minimum time (in whole seconds) between warps is set with the 'pause' constant
The max number of pairs is set with the 'nrpairs' constant - this should be higher or equal to the highest number of pairs in a map
Saved maps and compiled maps have coordinates that differ (in PW at least) so use ones from the compiled map
Check the text file in the coords folder for more info on setting coords