player.try_get_armor_ability

a.k.a. player.get_armor_ability

This function can be used to access a player's readied or holstered weapon.

When Bungie and 343i use this function, they often manually clear the object variable they are assigning to before calling the function. That functionality is automated in this Megalo dialect: calling the function with the name get_armor_ability will compile in an assignment to no_object before the call, while calling the function with the name try_get_armor_ability will not.

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

Example

--
-- Don't allow players to use Armor Lock:
--
for each player do
   global.object[0] = current_player.get_armor_ability()
   if global.object[0].is_of_type(armor_lock) and global.object[0].is_in_use() then
      global.object[0].delete()
      game.show_message_to(current_player, none, "nope")
   end
end

See also