object.get_carrier

a.k.a. object.try_get_carrier

When called on a weapon or Armor Ability, this function returns the player carrying the item.

When Bungie and 343i use this function, they often manually clear the player variable they are assigning to before calling the function. However, reverse-engineering of the game engine suggests that this is not actually necessary; the game will always properly return a value when this function is called.

This function returns player. Calling this function without storing its return value in a variable is an error.

Example

for each object with label "awful_gun" do
   global.player[0] = current_object.get_carrier()
   if global.player[0] != no_player then
      global.player[0].kill(false)
   end
end

Notes

See also