lweapon#

Inherits: sprite

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

Variables#

int

Type

int

Level

int

Special

int

Max

int

Angle

int

Step

int

NumFrames

int

Frame

int

Power

bool

Angular

bool

Behind

int

ASpeed

int

FlashCSet

int

DeadState

bool

Flash

int

OriginalTile

int

OriginalCSet

const int

TotalDYOffset

bool

CollDetection

int

Parent

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

int

ID deprecated

int

Family deprecated

Functions#

void

Max(int value) deprecated

bool

isValid()

void

UseSprite(int sprite_id)

void

Explode(int mode)

void

Remove()

bool

Switch(int effect)

bool

MakeAngular()

bool

MakeDirectional()

Enumerations#

enum LWeaponType: πŸ”— Source

Player weapon types. Used with Screen->CreateLWeapon().

LWeaponType LW_SWORD = 1

This cannot be created.

LWeaponType LW_WAND = 12

This cannot be created.

LWeaponType LW_CANDLE = 12

This cannot be created.

LWeaponType LW_HAMMER = 19

This cannot be created.

LWeaponType LW_HOOKSHOT = 20

This cannot be created.

LWeaponType LW_CANEOFBYRNA = 27

This cannot be created.

LWeaponType LW_BUGNET = 52

This cannot be created.

LWeaponType LW_ARROW = 8

LWeaponType LW_BEAM = 2

Sword beam.

LWeaponType LW_BRANG = 3

LWeaponType LW_BOMB = 6

LWeaponType LW_BOMBBLAST = 4

Bomb explosion.

LWeaponType LW_SBOMB = 7

LWeaponType LW_SBOMBBLAST = 5

Super Bomb explosion.

LWeaponType LW_FIRE = 9

LWeaponType LW_WHISTLE = 10

Whistle music - kills Digdogger.

LWeaponType LW_BAIT = 11

LWeaponType LW_MAGIC = 13

Wand magic.

LWeaponType LW_WIND = 15

Whistle whirlwind.

LWeaponType LW_REFMAGIC = 16

Reflected wand magic.

LWeaponType LW_REFFIREBALL = 17

Reflected fireball.

LWeaponType LW_REFROCK = 18

Reflected rock.

LWeaponType LW_REFBEAM = 28

Reflected sword beam.

LWeaponType LW_SPARKLE = 23

LWeaponType LW_FIRESPARKLE = 24

Damages enemies.

LWeaponType LW_SCRIPT1 = 31

Dummy weapon, for use with scripts.

LWeaponType LW_SCRIPT2 = 32

LWeaponType LW_SCRIPT3 = 33

LWeaponType LW_SCRIPT4 = 34

LWeaponType LW_SCRIPT5 = 35

LWeaponType LW_SCRIPT6 = 36

LWeaponType LW_SCRIPT7 = 37

LWeaponType LW_SCRIPT8 = 38

LWeaponType LW_SCRIPT9 = 39

LWeaponType LW_SCRIPT10 = 40

LWeaponType LW_ICE = 41

Unimplemented.

LWeaponType LW_THROWN = 44

LWeaponType LW_REFARROW = 53

LWeaponType LW_REFFIRE = 54

LWeaponType LW_REFFIRE2 = 55


Variable descriptions#

int Type πŸ”— Source

value LWeaponType (LW_)

The weapon type. Some types have hardcoded behaviors.


int Level πŸ”— Source

For lweapons, the level of the weapon.


int Special πŸ”— Source

The special info for the lweapon.

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


int Max πŸ”— Source

deprecated_getter SPRITEMAXLWPN

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

alias Damage

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

value WeaponDeadState (WDS_)


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 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<globals_enum_member_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 Defensen 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

value UnblockableBitflags (UNBLOCK_)

Unblockable bitflags.


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

index WeaponFlag (WFLAG_)

A set of weapon flags.


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

index WeaponSpriteIndex (WPN_SPRITE_)

The burning light radii associated with sprites of the weapon.


const int UID πŸ”— Source

Deprecated:

  • This is now just the internal engine ID, which is the same as doing <int>some_sprite.


int ID πŸ”— Source

value LWeaponType (LW_)

Deprecated: Exactly the same as Type, use that instead.


int Family πŸ”— Source

value LWeaponType (LW_)

Deprecated: Exactly the same as Type, use that instead.


Function descriptions#

void Max(int value) πŸ”— Source

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

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 sprite_id) πŸ”— Source

Loads the graphical information from the spritedata indicated by sprite_id.


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_) (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.