Field manual / Level editor
item — Items and weapons
Items and weapons. Where Classic writes "this", OG Script writes host.
Summary
item::New | Creates an item of this class. |
item::NewWeapon | Creates a weapon of this class. |
item::Animation | Plays an animation of the item's model once and holds the last frame; reverse 1 plays it backwards (a box closes with "box" reversed). |
item::SetPos | Moves the item to world coordinates. |
item::SetAngle | Sets the item's rotation angle in radians. |
item::SetNameID | Sets the item's classic_id (name/type identifier). |
item::GetNameID | Returns the item's classic_id, or -1 if the object does not exist or is not an item. |
item::SetPlace | Sets the item's place; 0 (ground) for an owned item removes the owner, and a hero holding it in hand is left without a weapon. |
item::GetPlace | Returns the item's place (0 = ground), or -1 if the object does not exist or is not an item. |
item::SetVisible | Shows (1) or hides (0) the item. |
item::SetFuncID | Sets the item's action: the name of an Action rules row ("Close", "walk", "none") or its number (its action field). |
object::ActionId | OpenGorky only (the original exe has no such function), for comparing the action field: the action number by Action row name ("walk" −1, "none" 0), 0 if there is no such row. |
item::GetType | Returns the item's kind (kind; for a weapon, damage_kind, as in the exe), or -1 if the object does not exist or is not an item. |
item::EnableWalkCircle | Makes .wm cells within the item's walk_block_radius walkable (in background pixels, if at least 2). |
item::DisableWalkCircle | Closes .wm cells within the item's walk_block_radius (in background pixels, if at least 2). |
item::HasAmmo | True if the actor has an item whose classic_id equals the weapon's ammo and whose count is above 0. |
Functions
item::New(string, string, ?string, ?int) → int
Creates an item of this class. A string third argument is the owner, a number is the count; the fourth argument, if present, is the count (for example, the number of rounds).
item::NewWeapon(string, string, ?string, ?int) → int
Creates a weapon of this class. A string third argument is the owner, a number is the count; the fourth argument, if present, is the count.
item::Animation(string, string, int) → int
Plays an animation of the item's model once and holds the last frame; reverse 1 plays it backwards (a box closes with "box" reversed).
item::SetPos(string, float, float, float) → int
Moves the item to world coordinates. Another form (item, "area", point, z): places it at a point of the zone's polygon (-1 = the control point) on the floor, raised by z.
item::SetAngle(string, float) → int
Sets the item's rotation angle in radians.
item::SetNameID(string, int) → int
Sets the item's classic_id (name/type identifier).
item::GetNameID(string) → int
Returns the item's classic_id, or -1 if the object does not exist or is not an item.
item::SetPlace(string, int) → int
Sets the item's place; 0 (ground) for an owned item removes the owner, and a hero holding it in hand is left without a weapon.
item::GetPlace(string) → int
Returns the item's place (0 = ground), or -1 if the object does not exist or is not an item.
item::SetVisible(string, int) → int
Shows (1) or hides (0) the item.
item::SetFuncID(string, any) → int
Sets the item's action: the name of an Action rules row ("Close", "walk", "none") or its number (its action field).
object::ActionId(string) → int
OpenGorky only (the original exe has no such function), for comparing the action field: the action number by Action row name ("walk" −1, "none" 0), 0 if there is no such row.
item::GetType(string) → int
Returns the item's kind (kind; for a weapon, damage_kind, as in the exe), or -1 if the object does not exist or is not an item.
item::EnableWalkCircle(string) → int
Makes .wm cells within the item's walk_block_radius walkable (in background pixels, if at least 2).
item::DisableWalkCircle(string) → int
Closes .wm cells within the item's walk_block_radius (in background pixels, if at least 2).
item::HasAmmo(string, string) → bool
True if the actor has an item whose classic_id equals the weapon's ammo and whose count is above 0.