Difference between revisions of "TMap.AddSpawnPoint"

From Soldat Community Wiki
Jump to: navigation, search
(Example)
m (Example moved)
 
(5 intermediate revisions by 2 users not shown)
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>
  TScriptNewSpawnPoint = Record
 
  X,Y:Single;
 
  Style:Byte;
 
  Active:Boolean;
 
  end; <br>
 
  
 
==Description==
 
==Description==
  
 
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="20%"
 
! '''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==
 +
{{expand|Example showing AddSpawnPoint}}
  
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.
+
<syntaxhighlight lang="pascal">
  
<syntaxhighlight lang="pascal">
 
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;
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Category:TMap]]
 
[[Category:TMap]]

Latest revision as of 12:46, 22 August 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

Expand with: Example showing AddSpawnPoint