player.set_primary_respawn_object

This function appears to set a player's default respawn object, when co-op spawning is enabled.

Arguments

respawn

The object to use as a respawn point.

Example

--
-- Excerpt from Invasion:
--
for each object with label "inv_res_p1" do
   --
   -- Ensure that Phase 1 respawn zones cannot be picked up or destroyed:
   --
   current_object.set_spawn_location_permissions(no_one)
   current_object.set_invincibility(1)
   current_object.set_pickup_permissions(no_one)
   --
   if global.number[2] == 1 then -- current phase is Phase 1?
      --
      -- Control which fireteams are allowed to spawn at this respawn zone:
      --
      for each object with label "inv_res_p1" do
         if current_object.spawn_sequence == 0 then 
            current_object.set_spawn_location_fireteams(0)
         end
      end
      for each object with label "inv_res_p1" do
         if current_object.spawn_sequence == 1 then 
            current_object.set_spawn_location_fireteams(1)
         end
      end
      for each object with label "inv_res_p1" do
         if current_object.spawn_sequence == 2 then 
            current_object.set_spawn_location_fireteams(2)
         end
      end
      for each object with label "inv_res_p1" do
         if current_object.spawn_sequence > 2 then 
            current_object.set_spawn_location_fireteams(all)
         end
      end
      --
      -- Use the respawn zone's Spawn Sequence to determine which fireteam 
      -- should use it as their default spawn:
      --
      current_object.set_spawn_location_permissions(allies)
      for each player do
         if current_object.team == current_player.team then 
            global.number[8] = 0
            global.number[8] = current_player.get_fireteam()
            if current_object.spawn_sequence == global.number[8] then 
               current_player.set_primary_respawn_object(current_object)
            end
         end
      end
   end
end

See also