lweapon#

Inherits: sprite

Weapons active on the screen from the hero. See Screen->LoadLWeapon() and Screen->CreateLWeapon().

Variables#

int

ID

int

Type

int

Family

int

Special

int

Max

int

Angle

int

Step

int

NumFrames

int

Frame

int

Power

int

Damage

bool

Angular

bool

Behind

int

ASpeed

int

FlashCSet

int

DeadState

bool

Flash

int

OriginalTile

int

OriginalCSet

const int

TotalDYOffset

bool

CollDetection

int

Parent

int

Level

int

Script

int

Weapon

int

Defense

untyped[]

InitD

int

Unblockable

int

Timeout

int

DegAngle

int

Vx

int

Vy

bool

AutoRotate

bool[]

Flags

int

DeathItem

int

DeathDropset

int

DeathItemPFlags

int

DeathSprite

int

DeathSFX

int

LiftLevel

int

LiftTime

int

LiftHeight

int[]

Sprites

int[]

BurnLightRadius

const int

UID deprecated

Functions#

int

Max() deprecated

void

Max(int value) deprecated

bool

isValid()

void

UseSprite(int spriteid)

void

Explode(int mode)

void

Remove()

bool

Switch(int effect)

bool

MakeAngular()

bool

MakeDirectional()

void

Own(bitmap b)

void

Own(paldata b)

void

Own(file b)

void

Own(directory b)

void

Own(stack b)

void

Own(randgen b)

void

OwnArray(untyped array)

void

OwnObject(untyped object)

Variable descriptions#

int ID ๐Ÿ”— Source

The weapon type of the weapon. Some types have hardcoded behaviors.


int Type ๐Ÿ”— Source

The weapon type of the weapon. Some types have hardcoded behaviors. Same as ID.


int Family ๐Ÿ”— Source

The weapon type of the weapon. Some types have hardcoded behaviors. Same as ID.


int Special ๐Ÿ”— Source

The special info for the lweapon.

Used by wind lweapons, instead of Level, to determine their effects.


int Max ๐Ÿ”— Source

Returns the max number of weapons currently allowed.


int Angle ๐Ÿ”— Source

The angle of the weapon, in radians for Angle or degrees for DegAngle. Has no real effect if the weapon is not Angular.


int Step ๐Ÿ”— Source

The movement speed of the weapon, in 100thโ€™s/pixel per frame.


int NumFrames ๐Ÿ”— Source

The number of frames in the weaponโ€™s animation.


int Frame ๐Ÿ”— Source

The current frame number that the animation is on.


int Power ๐Ÿ”— Source

The amount of damage the weapon deals.


int Damage ๐Ÿ”— Source

The amount of damage the weapon deals.


bool Angular ๐Ÿ”— Source

If the weapon is angular (instead of directional)


bool Behind ๐Ÿ”— Source

If true, the weaponโ€™s sprite will draw behind the Hero and enemies.


int ASpeed ๐Ÿ”— Source

The speed of the animation, in frames per frame.


int FlashCSet ๐Ÿ”— Source

The secondary CSet used for flashing.


int DeadState ๐Ÿ”— Source

The deadstate of the weapon, denoted by the WeaponDeadState (WDS_) constants.


bool Flash ๐Ÿ”— Source

If the weapon is flashing or not. When flashing, it changes between its CSet and FlashCSet.


int OriginalTile ๐Ÿ”— Source

The starting tile of the weaponโ€™s animation.


int OriginalCSet ๐Ÿ”— Source

The starting cset of the weapon.


const int TotalDYOffset ๐Ÿ”— Source

the weaponโ€™s total visual Y-offset.


bool CollDetection ๐Ÿ”— Source

If the weaponโ€™s collision is enabled. Set to false to disable collision entirely.


int Parent ๐Ÿ”— Source

The ID of the item that created this weapon.

Weapons created by script have a default Parent of -1 (lweapon) and <npc>-0.0001 (eweapon).

For lweapons, this value determines what item editor index to read item flags from.

Setting it to an item of a class that does not normally generate the given weapon type may have unexpected effects.


int Level ๐Ÿ”— Source

For lweapons, the level of the weapon.


int Script ๐Ÿ”— Source

The weapon script running on this weapon.


int Weapon ๐Ÿ”— Source

The UseWeapon property for this weapon.

If set to a value greater than 0, all collisions with npcs will use this as if it was the weaponโ€™s ID for calculating the defense value for it.

e.g., if a LW_MAGIC weapon is set to a Weapon of LW_BRANG, when it collides with an npc, the npc will use Defense:ref:LW_BRANG<libs_std_var_lw_brang> to resolve its effects.

Some weapons will also trigger map flags, and screen combos as if the natural weapon was the value set as ->Weapon.,

e.g. If you set a LW_BRANG weapon to a ->Weapon of LW_SWORD, it will cut bushes.


int Defense ๐Ÿ”— Source

The default defense value for this weapon.

If set greater than 0, then when this weapon collides with an npc, if that npc has its Defense``n`` value set to NONE for this weaponโ€™s type, it will resolve using this Defense value (e.g. Stun).


untyped[] InitD ๐Ÿ”— Source

The 8 InitD[] arguments for the weapon script.


int Unblockable ๐Ÿ”— Source

A bitwise flagset of unblockable flags, using the UNBLOCK_ constants.


int Timeout ๐Ÿ”— Source

If > 0, ticks down each frame. When ticking down to 0, kills the weapon.


int DegAngle ๐Ÿ”— Source

The angle of the weapon, in radians for Angle or degrees for DegAngle. Has no real effect if the weapon is not Angular.


int Vx ๐Ÿ”— Source

The velocity on the X or Y axis. Setting these will make the weapon Angular if it isnโ€™t already, and will adjust the weaponโ€™s Angle and Step speed.


int Vy ๐Ÿ”— Source

The velocity on the X or Y axis. Setting these will make the weapon Angular if it isnโ€™t already, and will adjust the weaponโ€™s Angle and Step speed.


bool AutoRotate ๐Ÿ”— Source

If true, the weaponโ€™s โ€˜Rotationโ€™ will be automatically set based on its Angle.


bool[] Flags ๐Ÿ”— Source

A set of weapon flags.

Valid indices: WeaponFlagIndex (WFLAG_).


int DeathItem ๐Ÿ”— Source

If > -1, this item will be spawned when the weapon dies.


int DeathDropset ๐Ÿ”— Source

If > -1, this item dropset will be rolled for a drop when the weapon dies.


int DeathItemPFlags ๐Ÿ”— Source

The itemsprite::Pickup to use for the item dropped via DeathItem or DeathDropset.


int DeathSprite ๐Ÿ”— Source

If > -1, display this Sprite Data sprite when the weapon dies.


int DeathSFX ๐Ÿ”— Source

If > 0, this SFX will be played when the weapon dies.


int LiftLevel ๐Ÿ”— Source


int LiftTime ๐Ÿ”— Source

The time it takes to lift this weapon via engine lifting.


int LiftHeight ๐Ÿ”— Source

The height to lift this weapon to via engine lifting.


int[] Sprites ๐Ÿ”— Source

Various sprites used by the weapon.


int[] BurnLightRadius ๐Ÿ”— Source

The burning light radii associated with sprites of the weapon.

Valid indices: WeaponSpriteIndex (WPN_SPRITE_).


const int UID ๐Ÿ”— Source

Warning

Deprecated!


Function descriptions#

int Max() ๐Ÿ”— Source

Returns the max number of weapons currently allowed.

Warning

Deprecated! Use Maxโ€™ instead!


void Max(int value) ๐Ÿ”— Source

Sets the max number of weapons allowed to a new value. Range 1-1024.

Warning

Deprecated! Use Maxโ€™ instead!


bool isValid() ๐Ÿ”— Source

Returns true if this pointer points to a valid weapon. If this returns false, using any other value of this pointer will error.


void UseSprite(int spriteid) ๐Ÿ”— Source

Loads the graphical information from the spritedata indicated by spriteid.


void Explode(int mode) ๐Ÿ”— Source

Creates an explosion particle effect in mode 0, 1, or 2 of the sprite.


void Remove() ๐Ÿ”— Source

Instantly deletes the weapon.


bool Switch(int effect) ๐Ÿ”— Source

Switch the Hero with this sprite.

Valid values for effect: SwitchEffect (SW_EFF_).


bool MakeAngular() ๐Ÿ”— Source

If the weapon is not Angular, makes it Angular, and sets its Angle based on its Dir.


bool MakeDirectional() ๐Ÿ”— Source

If the weapon is Angular, makes it not Angular, and sets its Dir based on its Angle.


void Own(bitmap b) ๐Ÿ”— Source

Grants โ€˜Ownershipโ€™ of the parameter object to the weapon.


void Own(paldata b) ๐Ÿ”— Source

Grants โ€˜Ownershipโ€™ of the parameter object to the weapon.


void Own(file b) ๐Ÿ”— Source

Grants โ€˜Ownershipโ€™ of the parameter object to the weapon.


void Own(directory b) ๐Ÿ”— Source

Grants โ€˜Ownershipโ€™ of the parameter object to the weapon.


void Own(stack b) ๐Ÿ”— Source

Grants โ€˜Ownershipโ€™ of the parameter object to the weapon.


void Own(randgen b) ๐Ÿ”— Source

Grants โ€˜Ownershipโ€™ of the parameter object to the weapon.


void OwnArray(untyped array) ๐Ÿ”— Source

Grants โ€˜Ownershipโ€™ of the parameter object to the weapon.


void OwnObject(untyped object) ๐Ÿ”— Source

Grants โ€˜Ownershipโ€™ of the parameter object to the weapon.