UseInventory

Forces the activator to use the specified inventory item, if he has it. The return value is true if the item was used successfully, or false if not.

int UseInventory (str classname)

If the function is run with no activator (for example an OPEN script or removing an existing activator with SetActivator), it will run for and affect all active players in the game.

Examples

This example creates a hotkey based function that will use the most powerful healing item in the player's possesion.

script "BestHealing" (void) net
{
 If (UseInventory("UltimateHealingPotion"))
 {
    terminate;
 }
 If (UseInventory("MajorHealingPotion"))
 {
    terminate;
 }
 If (UseInventory("HealingPotion"))
 {
    terminate;
 }
 If (UseInventory("MinorHealingPotion"))
 {
    terminate;
 }
}

This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.