Skip to content

Field manual / Level editor

item — Items and weapons

Items and weapons. Where Classic writes "this", OG Script writes host.

Summary

item::NewCreates an item of this class.
item::NewWeaponCreates a weapon of this class.
item::AnimationPlays 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::SetPosMoves the item to world coordinates.
item::SetAngleSets the item's rotation angle in radians.
item::SetNameIDSets the item's classic_id (name/type identifier).
item::GetNameIDReturns the item's classic_id, or -1 if the object does not exist or is not an item.
item::SetPlaceSets 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::GetPlaceReturns the item's place (0 = ground), or -1 if the object does not exist or is not an item.
item::SetVisibleShows (1) or hides (0) the item.
item::SetFuncIDSets the item's action: the name of an Action rules row ("Close", "walk", "none") or its number (its action field).
object::ActionIdOpenGorky 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::GetTypeReturns 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::EnableWalkCircleMakes .wm cells within the item's walk_block_radius walkable (in background pixels, if at least 2).
item::DisableWalkCircleCloses .wm cells within the item's walk_block_radius (in background pixels, if at least 2).
item::HasAmmoTrue 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

Classic: Item_New

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

Classic: Weapon_New

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

Classic: 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(string, float, float, float) → int

Classic: Item_SetPos

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

Classic: Item_SetAngle

Sets the item's rotation angle in radians.

item::SetNameID(string, int) → int

Classic: Item_SetNameID

Sets the item's classic_id (name/type identifier).

item::GetNameID(string) → int

Classic: Item_GetNameID

Returns the item's classic_id, or -1 if the object does not exist or is not an item.

item::SetPlace(string, int) → int

Classic: 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(string) → int

Classic: Item_GetPlace

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

Classic: Item_SetVisible

Shows (1) or hides (0) the item.

item::SetFuncID(string, any) → int

Classic: 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(string) → int

Classic: 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(string) → int

Classic: 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(string) → int

Classic: Item_EnableWalkCircle

Makes .wm cells within the item's walk_block_radius walkable (in background pixels, if at least 2).

item::DisableWalkCircle(string) → int

Classic: Item_DisableWalkCircle

Closes .wm cells within the item's walk_block_radius (in background pixels, if at least 2).

item::HasAmmo(string, string) → bool

Classic: Actor_HaveAmmoForWeapon

True if the actor has an item whose classic_id equals the weapon's ammo and whose count is above 0.