Data/Abilities/Pawn

## Pawn

### Description

Ability that allows players to sell item units with the **Pawnable** flag at the unit with the ability

### Hint

* Typically used for shops
* The selling formula is: **Pawn Rate \* Cost of Item \* (Number of Charges currently on item / Maximum Number of Charges allowed on Item)**
* An item with a cost of 50, a max stack count of 100, and a starting charge count of 1 will normally be sold for 1 \* 50 \* (1 / 100) = 0.5 minerals.
* If you set the pawn rate to 100, that changes so 100 \* 50 \* (1/100) = 50. So selling 1 charge of the item will give a full refund
* The forumla isnt precise and may lead to slight discrepancies when selling items.
* Typically you only need to use one index of a pawnable ability, however if you use consumables with varying max and starting charges, youll want to setup special indexes for these items so the correct refund is given. Typically a refund fraction of 1 is given.
* Interact ability is used in Warcraft 3 to select which Hero is currently selling.
* When an Item is being sold, you can add an actor events related by using an **Ability** event / **Target** Sub name. Useful for putting a sound when selling.
* Using pawn as an effect target (with a command button) seems to gain the item pawn worth by default without killing it. You would click on an item to pawn it, it will stay, and still generate its sell cost to infinite extent.
* Disabling a single array of the pawn ability won't do. You have to disable all of them, or else, one other array will buy the item at no refund (if empty in the fields).
* There is the strangest bug that causes the ability not to add properly from triggers if the triggering unit or its "Revive Type" field link to a unit that doesn't own any ability ("none" is not accepted). If the revive type of the said unit corresponds to a unit that has an ability, it will then work.
* You can filter the player that can pawn, but do not forget to shut down all other arrays.

## Fields Description

### **Ability: Info**

In this section, we'll uncover only the uniquely related fields. Other cost fields are explained in abilities.

#### Index

* Index that will take over the previous ones if the requirement/filters/validators are not met. Remember that even empty indexes still work to pawn your items. They will refund nothing on it. One must disable them in order to control who can pawn, how or when.

#### Class Required

* The item type from the Item Classes data type that the item must be known as to be sold by the specific slot of the ability
* Useful for allowing certain classes to be level restricted before you can sell them

#### Classes Excluded

* Item classes from the Item Classes data type that if the item is known as it cannot be sold using the specific slot of the ability
* Useful for allowing certain classes to be level restricted before you can sell them

#### Refund Fraction

* The fraction of the Cost: Cost field from the Units data type given when selling each charge of the item

#### Target Filters

* Filters that determine which unit attributes the ability can target
* Allows selectivity as to which slot and associated refund rate can be used on item groupings

### Stats: Flags

* **Best Unit:** When a group of units is ordered to cast this ability, only the "best unit" (usually the closest one) will do so
* **Smart Command:** Allows the skill the be bound to and cast by right mouse click

### Stats: Range

* The distance from the shop unit at which items can be sold
* Max 255

## Related

Items

Inventory

Interact