object.get_carrier
a.k.a. object.try_get_carrierWhen 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
If the context object doesn't exist, then this function returns no_player. It's safe to call this function without checking whether the object variable you're using is no_object.
The alternate name for this function,
try_get_carrier
, is deprecated and originates from the oldest versions of ReachVariantTool. In older versions, the two names existed as part of a precaution that reverse-engineering has established was not actually necessary.