Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: CarlHamilton on September 13, 2007, 12:09:44 pm

Title: Rooms
Post by: CarlHamilton on September 13, 2007, 12:09:44 pm
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
Code: [Select]
//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
Title: Re: Rooms
Post by: Corvis on September 13, 2007, 01:39:58 pm
thanks script but
 for j:= 1 to nrpairs do
?
Title: Re: Rooms
Post by: Ride on September 13, 2007, 02:31:08 pm
and can u place it in a zip file.. not rar please
Title: Re: Rooms
Post by: miketh2005 on September 13, 2007, 02:49:13 pm
ZIP SUX! RAR ROCKS!
Title: Re: Rooms
Post by: DorkeyDear on September 13, 2007, 03:37:00 pm
I prefer zip so I can not have that annoying window coming up with I open a file with winrar.
Title: Re: Rooms
Post by: KeFear on September 14, 2007, 10:30:40 am
just use wincommander.. you don't have to use winrar then.

By the way: nice script, hope to see some cool maps with it :)
Title: Re: Rooms
Post by: Dusty on September 20, 2007, 10:20:27 am
WinRAR rules.
Sounds very nice, but I'm kinda not-into-scripting-thingies so I'm too lazy to try it out.
Title: Re: Rooms
Post by: EnEsCe on September 20, 2007, 09:49:52 pm
So why post? Sheeesh.
Title: Re: Rooms
Post by: Kavukamari on September 25, 2007, 02:10:10 pm
I'm not really getting the scortcuts you use to do if GetPlayerStat(**,'Active') etc... if (active) then begin???

and I didn't find paira as a variable anywhere... and j k and i weren't there either, and I never figured out how to make my own procedures or functions...

I dunno, maybe I'm just out of date, I could use some scripting help...

why does everyone else stuff that I can't figure out how to use T_T
Title: Re: Rooms
Post by: Master Chief43 on September 30, 2007, 03:16:44 pm
This is a nice script for a Halo map... (you know... the teleporters...)