Difference between revisions of "TMap.AddSpawnPoint"

From Soldat Community Wiki
Jump to: navigation, search
Line 1: Line 1:
  '''''function AddSpawnPoint(Spawn:TNewSpawnPoint):TActiveSpawnPoint'''''
+
  '''''function AddSpawnPoint(Spawn:[[TNewSpawnPoint]]):[[TActiveSpawnPoint]]'''''
 
   Spawn: new spawn to be created.
 
   Spawn: new spawn to be created.
 
   Result: activated spawn <br>
 
   Result: activated spawn <br>
Line 6: Line 6:
  
 
This function will add a new spawnpoint at position X,Y with target style. It will always be active.
 
This function will add a new spawnpoint at position X,Y with target style. It will always be active.
 
==Styles==
 
This is a list of Style types and their descriptions.
 
 
{| class="prettytable" width="30%"
 
! '''Style || Description
 
|-
 
| 0 || Player Spawn
 
|-
 
| 1 || Alpha Team
 
|-
 
| 2 || Bravo Team
 
|-
 
| 3 || Charlie Team
 
|-
 
| 4 || Delta Team
 
|-
 
| 5 || Alpha Flag
 
|-
 
| 6 || Bravo Flag
 
|-
 
| 7 || Grenade Kit
 
|-
 
| 8 || Medikit
 
|-
 
| 9 || Cluster Grenades
 
|-
 
| 10 || Vest
 
|-
 
| 11 || Flamer
 
|-
 
| 12 || Beserker
 
|-
 
| 13 || Predator
 
|-
 
| 14 || Point Match Flag
 
|-
 
| 15 || Rambo Bow
 
|-
 
| 16 || Stationary Gun
 
|}
 
  
 
==Example==
 
==Example==

Revision as of 17:57, 24 July 2013

function AddSpawnPoint(Spawn:TNewSpawnPoint):TActiveSpawnPoint
 Spawn: new spawn to be created.
 Result: activated spawn 

Description

This function will add a new spawnpoint at position X,Y with target style. It will always be active.

Example

The below example will check whether the player spawned somewhere far off of his team's spawnpoints. If he is too far away, he gets killed to spawn in the right place.

procedure onPlayerRespawn(ID:Byte);
var 
 i:Byte;
 Player_X,
 Player_Y:Single;
begin
 if Players[ID].Human then begin
  Player_X := Players[ID].X;
  Player_Y := Players[ID].Y;
  for i := 1 to 254 do
   if (Map.SpawnPoints[i].Style = Players[ID].Team) and
      (Distance(Map.SpawnPoints[i].X,Map.SpawnPoints[i].Y,Player_X,Player_Y) < 50) 
   then Exit;
 end;
 Players[ID].Damage(ID,200);
 Players[ID].writeConsole('You spawned too far away from your team''s spawnpoint.');
end;