npc#

Inherits: sprite

Variables#

const int

ID

int

Type

int

Family

int

Frame

int

Max

int

SlideClock

int

Fading

int

Rate

int

Homing

int

Step

int

ASpeed

int

Halt

int

MoveStatus

int

Haltrate

int

Random

int

HP

int

Damage

int

WeaponDamage

int

OriginalTile

int

Weapon

int

ItemSet

int

Dropset

int

BossPal

int

SFX

const int

TotalDYOffset

untyped[]

InitD

untyped[]

Attributes

int

MiscFlags

bool

CollDetection

int

Stun

bool

Core

int[]

Defense

untyped[]

HitBy

int

Hunger

int

WeaponSprite

int

WeaponSFX

int[]

ScriptDefense

int

InvFrames

int

Invincible

bool

Ringleader

bool

HasItem

bool[]

Shield

bool[]

BFlags

int

HitDir

int

Script

bool

Immortal

bool

NoSlide

bool

NoScriptKnockback

int

SlideSpeed

int

SpawnSprite

int

DeathSprite

bool

InvFlicker

int

FlickerColor

int

FlickerTransparencyPasses

const int

FlashingCSet

int

Frozen

int

FrozenTile

int

FrozenCSet

const int

UID deprecated

int

ParentUID deprecated

Functions#

int

Max() deprecated

void

Max(int value) deprecated

bool

isValid()

void

Explode(int mode)

bool

Submerged()

void

GetName(char32[] buffer)

void

BreakShield()

void

RepairShield()

bool

isDead()

bool

CanSlide()

bool

Slide()

void

Remove()

void

StopBGSFX()

void

Attack()

void

NewDir(int arr)

void

ConstantWalk(int arr)

void

ConstantWalk8(int arr)

void

VariableWalk(int arr)

void

VariableWalk8(int arr)

void

HaltingWalk(int arr)

void

HaltingWalk8(int arr)

void

FloatingWalk(int arr)

void

BreathAttack(bool seeklink = false)

void

NewDir8(int arr)

bool

Collision(int obj_type, untyped obj_pointer)

int

LinedUp(int range, bool dir8 = false)

bool

LinkInRange(int dist_in_pixels)

bool

CanMove(int array)

bool

SimulateHit(int array)

npc

Create(int array)

bool

Knockback(int time, int dir, int speed = 4)

bool

Switch(int effect)

bool

MovePaused()

bool

Move(int dir, int pxamnt, int special = 0)

bool

MoveAtAngle(int degrees, int pxamnt, int special = 0)

bool

MoveXY(int dx, int dy, int special = 0)

bool

CanMove(int dir, int pxamnt, int special = 0)

bool

CanMoveAtAngle(int degrees, int pxamnt, int special = 0)

bool

CanMoveXY(int dx, int dy, int special = 0)

bool

CanPlace(int nx, int ny, int special = SPW_NONE, bool knockback = false, int nw = -1, int nh = -1)

bool

isFlickerFrame()

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)

Enumerations#

enum NPCID: πŸ”— Source

Enemy IDs. Used with Screen->CreateNPC().

NPCID NPC_ABEI = 1

NPCID NPC_AMA = 2

NPCID NPC_MERCHANT = 3

NPCID NPC_MOBLIN = 4

NPCID NPC_FIRE = 5

NPCID NPC_FAIRY = 6

NPCID NPC_GORIYA = 7

NPCID NPC_ZELDA = 8

NPCID NPC_ABEI2 = 9

NPCID NPC_AQUAMENTUSL = 93

NPCID NPC_AQUAMENTUSR = 58

NPCID NPC_ARMOS = 37

NPCID NPC_BAT = 106

NPCID NPC_BOMBCHU = 160

NPCID NPC_BOULDER = 135

NPCID NPC_BUBBLEITEMP = 118

Permanently jinxes.

NPCID NPC_BUBBLEITEMR = 119

Restores item usage.

NPCID NPC_BUBBLEITEMT = 117

NPCID NPC_BUBBLESWORDP = 81

Permanently jinxes.

NPCID NPC_BUBBLESWORDR = 82

Restores sword usage.

NPCID NPC_BUBBLESWORDT = 51

NPCID NPC_CEILINGMASTER = 101

This enemy isn’t implemented.

NPCID NPC_DARKNUT1 = 49

NPCID NPC_DARKNUT2 = 50

NPCID NPC_DARKNUT3 = 92

Splits when killed.

NPCID NPC_DARKNUT4 = 172

This enemy isn’t implemented.

NPCID NPC_DARKNUT5 = 87

Sword beams.

NPCID NPC_DIGDOGGER1 = 66

Splits into 1.

NPCID NPC_DIGDOGGER3 = 67

Splits into 3.

NPCID NPC_DIGKID1 = 68

Spawned by NPC_DIGDOGGER1.

NPCID NPC_DIGKID2 = 69

Spawned by NPC_DIGDOGGER3.

NPCID NPC_DIGKID3 = 70

Spawned by NPC_DIGDOGGER3.

NPCID NPC_DIGKID4 = 71

Spawned by NPC_DIGDOGGER3.

NPCID NPC_DODONGO = 60

Uses one tile when walking vertically.

NPCID NPC_DODONGOBS = 114

Uses two tiles when walking vertically.

NPCID NPC_DODONGOFIRE = 115

This enemy isn’t implemented.

NPCID NPC_ENEMYFIRE = 85

The Fire enemy in Princess Zelda’s screen.

NPCID NPC_FLOORMASTER = 102

This enemy isn’t implemented.

NPCID NPC_GANON = 78

NPCID NPC_GEL = 42

NPCID NPC_GELFIRE = 161

NPCID NPC_GELFIRETRIB = 163

NPCID NPC_GELTRIB = 88

NPCID NPC_GHINI1 = 35

NPCID NPC_GHINI2 = 36

NPCID NPC_GHINIMGC = 173

This enemy isn’t implemented.

NPCID NPC_GIBDO = 54

NPCID NPC_GLEEOK1 = 62

NPCID NPC_GLEEOK1FIRE = 109

NPCID NPC_GLEEOK2 = 63

NPCID NPC_GLEEOK2FIRE = 110

NPCID NPC_GLEEOK3 = 64

NPCID NPC_GLEEOK3FIRE = 111

NPCID NPC_GLEEOK4 = 65

NPCID NPC_GLEEOK4FIRE = 112

NPCID NPC_GOHMA1 = 72

NPCID NPC_GOHMA2 = 73

NPCID NPC_GOHMA3 = 121

NPCID NPC_GOHMAFIRE = 122

NPCID NPC_GORIYA1 = 45

NPCID NPC_GORIYA2 = 46

NPCID NPC_GORIYA3 = 136

NPCID NPC_GRAPBUGHP = 174

This enemy isn’t implemented.

NPCID NPC_GRAPBUGMP = 175

This enemy isn’t implemented.

NPCID NPC_ITEMFAIRY = 84

NPCID NPC_KEESE1 = 38

NPCID NPC_KEESE2 = 39

NPCID NPC_KEESE3 = 40

NPCID NPC_KEESETRIB = 90

NPCID NPC_LANMOLA1 = 74

NPCID NPC_LANMOLA2 = 75

NPCID NPC_LEEVER1 = 26

NPCID NPC_LEEVER2 = 27

NPCID NPC_LEEVER3 = 137

NPCID NPC_LIKELIKE = 53

NPCID NPC_LYNEL1 = 30

NPCID NPC_LYNEL2 = 31

NPCID NPC_LYNEL3 = 168

NPCID NPC_MANHANDLA = 61

NPCID NPC_MANHANDLA2 = 94

NPCID NPC_MOBLIN1 = 28

NPCID NPC_MOBLIN2 = 29

NPCID NPC_MOLDORM = 59

NPCID NPC_OCTOROCK1F = 22

NPCID NPC_OCTOROCK1S = 20

NPCID NPC_OCTOROCK2F = 23

NPCID NPC_OCTOROCK2S = 21

NPCID NPC_OCTOROCKBOMBF = 141

NPCID NPC_OCTOROCKBOMBS = 140

NPCID NPC_OCTOROCKFIREF = 139

NPCID NPC_OCTOROCKFIRES = 138

NPCID NPC_OCTOROCKMGC = 86

NPCID NPC_PATRA1 = 76

NPCID NPC_PATRA2 = 104

NPCID NPC_PATRA3 = 105

NPCID NPC_PATRABS = 103

NPCID NPC_PATRAOVAL = 77

NPCID NPC_PEAHAT = 32

NPCID NPC_PEAHATFIRE = 169

This enemy isn’t implemented.

NPCID NPC_POLSVOICE = 55

NPCID NPC_POLSVOICEBS = 171

This enemy isn’t implemented.

NPCID NPC_POLSVOICEMGC = 170

NPCID NPC_ROCK = 34

NPCID NPC_ROPE1 = 44

NPCID NPC_ROPE2 = 80

NPCID NPC_SHOOTFBALL = 83

NPCID NPC_SHOOTFLAME = 158

NPCID NPC_SHOOTFLAME2 = 159

NPCID NPC_SHOOTMAGIC = 154

NPCID NPC_SHOOTROCK = 155

NPCID NPC_SHOOTSPEAR = 156

NPCID NPC_SHOOTSWORD = 157

NPCID NPC_SPINTILE = 166

NPCID NPC_SPINTILERND = 167

Random spin tile.

NPCID NPC_STALFOS1 = 41

NPCID NPC_STALFOS2 = 79

NPCID NPC_STALFOS3 = 120

NPCID NPC_TEKTITE1 = 24

NPCID NPC_TEKTITE2 = 25

NPCID NPC_TEKTITE3 = 165

This enemy isn’t implemented.

NPCID NPC_TRAP = 47

NPCID NPC_TRAP8WAY = 142

This enemy isn’t implemented.

NPCID NPC_TRAPBACKSLASHC = 146

This enemy isn’t implemented.

NPCID NPC_TRAPBACKSLASHLOS = 147

This enemy isn’t implemented.

NPCID NPC_TRAPCCLOCKWISEC = 150

This enemy isn’t implemented.

NPCID NPC_TRAPCCLOCKWISELOS = 151

This enemy isn’t implemented.

NPCID NPC_TRAPCLOCKWISEC = 148

This enemy isn’t implemented.

NPCID NPC_TRAPCLOCKWISELOS = 149

This enemy isn’t implemented.

NPCID NPC_TRAPDIAG = 143

This enemy isn’t implemented.

NPCID NPC_TRAPHORIZC = 97

NPCID NPC_TRAPHORIZLOS = 95

NPCID NPC_TRAPSLASHC = 144

This enemy isn’t implemented.

NPCID NPC_TRAPSLASHLOS = 145

NPCID NPC_TRAPVERTC = 98

NPCID NPC_TRAPVERTLOS = 96

NPCID NPC_TRIGGER = 116

NPCID NPC_VIRE = 52

NPCID NPC_VIRETRIB = 91

NPCID NPC_WALLMASTER = 48

NPCID NPC_WIZZROBE1 = 56

Teleports.

NPCID NPC_WIZZROBE2 = 57

Phases through blocks.

NPCID NPC_WIZZROBEBAT = 107

NPCID NPC_WIZZROBEBAT2 = 108

This enemy isn’t implemented.

NPCID NPC_WIZZROBEFIRE = 99

NPCID NPC_WIZZROBEICE = 153

This enemy isn’t implemented.

NPCID NPC_WIZZROBEMIRR = 113

NPCID NPC_WIZZROBESUMM = 152

NPCID NPC_WIZZROBEWIND = 100

NPCID NPC_ZOL = 43

NPCID NPC_ZOLFIRE = 162

NPCID NPC_ZOLFIRETRIB = 164

NPCID NPC_ZOLTRIB = 89

NPCID NPC_ZORA = 33


enum NPCMiscBitflags: πŸ”— Source

NPCMiscBitflags NPCMF_0POWERWEAPS = 1

Damaged by 0-Power Weapons.

NPCMiscBitflags NPCMF_ISINVISIBLE = 2

Is Invisible.

NPCMiscBitflags NPCMF_NEVERRETURNS = 4

Never Returns After Death.

NPCMiscBitflags NPCMF_NOT_BEATABLE = 8

Doesn’t Count as beatable Enemy.

NPCMiscBitflags NPCMF_SPAWNFLICKER = 16

Unused.

NPCMiscBitflags NPCMF_ONLY_LENS = 32

Only Seen By Lens of truth.

NPCMiscBitflags NPCMF_FLASHING = 64

Is Flashing.

NPCMiscBitflags NPCMF_FLICKERING = 128

Is Flickering.

NPCMiscBitflags NPCMF_TRANSLUCENT = 256

Is translucent.

NPCMiscBitflags NPCMF_SHIELDED_FRONT = 512

Shielded on Front.

NPCMiscBitflags NPCMF_SHIELDED_LEFT = 1024

Shielded on Left.

NPCMiscBitflags NPCMF_SHIELDED_RIGHT = 2048

Shielded on Right.

NPCMiscBitflags NPCMF_SHIELDED_BACK = 4096

Shielded on Back.

NPCMiscBitflags NPCMF_HAMMERBREAKS = 8192

Hammer Can break Shield.


enum ItemSet: πŸ”— Source

Default item drop sets.

ItemSet IS_NONE = 0

ItemSet IS_DEFAULT = 1

ItemSet IS_BOMBS = 2

ItemSet IS_MONEY = 3

ItemSet IS_LIFE = 4

ItemSet IS_BOMB100 = 5

Used by Dodongos

ItemSet IS_SBOMB100 = 6

Used by Dodongos

ItemSet IS_MAGIC = 7

ItemSet IS_MAGICBOMBS = 8

ItemSet IS_MAGICMONEY = 9

ItemSet IS_MAGICLIFE = 10

ItemSet IS_MAGIC2 = 11

ItemSet IS_COMBOS = 12

Used by Tall Grass / Bush / Slash combos.


enum BossPal: πŸ”— Source

Boss palettes.

BossPal BPAL_AQUA = 0

BossPal BPAL_GLEEOK = 1

BossPal BPAL_DODONGO = 2

BossPal BPAL_GANON = 3

BossPal BPAL_BROWN = 4

BossPal BPAL_PILE = 5

Used for the Dust Pile.

BossPal BPAL_BLUE = 6

BossPal BPAL_RED = 7

BossPal BPAL_GOLD = 8

BossPal BPAL_ICON1 = 9

Used for Quest Icon 1.

BossPal BPAL_ICON2 = 10

Used for Quest Icon 2.

BossPal BPAL_ICON3 = 11

Used for Quest Icon 3.

BossPal BPAL_ICON4 = 12

Used for Quest Icon 4.

BossPal BPAL_GLEEOKF = 13

BossPal BPAL_FROZEN = 14

Unused


enum NPCWalkType: πŸ”— Source

β€œspecial” walk flags.

NPCWalkType SPW_NONE = 0

NPCWalkType SPW_DOOR = 1

NPCWalkType SPW_CLIPRIGHT = 2

NPCWalkType SPW_FLOATER = 3

NPCWalkType SPW_TRAP = 4

NPCWalkType SPW_HALFSTEP = 5

NPCWalkType SPW_WATER = 6

NPCWalkType SPW_WIZZROBE = 7

NPCWalkType SPW_CLIPBOTTOMRIGHT = 8


enum NPCMoveStatus: πŸ”— Source

NPCMoveStatus NPCMS_PAUSED = 0

NPCMoveStatus NPCMS_SPEEDUP = 1

NPCMoveStatus NPCMS_NORMAL = 2

NPCMoveStatus NPCMS_SLOWDOWN = 3


Variable descriptions#

const int ID πŸ”— Source


int Type πŸ”— Source

value NPCType (NPCT_)

The type, or β€˜npc class’ of the npc.


int Family πŸ”— Source

value NPCType (NPCT_)

Exactly the same as Type, use that instead.


int Frame πŸ”— Source

The current frame of the npc’s animation.


int Max πŸ”— Source

Returns the max number of npcs currently allowed.


int SlideClock πŸ”— Source

The timer used for npc knockback. The first byte is the clock. The second byte is the dir. Enemies that split do not slide.


int Fading πŸ”— Source

value NPCFade (NPCF_)

The death effect for the npc.


int Rate πŸ”— Source


int Homing πŸ”— Source


int Step πŸ”— Source


int ASpeed πŸ”— Source


int Halt πŸ”— Source

The clock for how long an npc is halted.


int MoveStatus πŸ”— Source

value NPCMoveStatus (NPCMS_)

The movement status of an npc, usually flying.


int Haltrate πŸ”— Source


int Random πŸ”— Source

Corresponds to the Enemy Editor Random Rate value.


int HP πŸ”— Source


int Damage πŸ”— Source


int WeaponDamage πŸ”— Source


int OriginalTile πŸ”— Source


int Weapon πŸ”— Source

value NPCWeapon (WPN_)

The weapon type used by the npc.


int ItemSet πŸ”— Source

value ItemSet

The Dropset ID that this npc will drop from when killed.


int Dropset πŸ”— Source

Alias for npc->ItemSet.

Read or write the item dropset used by the npc.


int BossPal πŸ”— Source


int SFX πŸ”— Source


const int TotalDYOffset πŸ”— Source

the weapon’s total visual Y-offset.


untyped[] InitD πŸ”— Source

The 8 InitD[] arguments for the npc script.


untyped[] Attributes πŸ”— Source

Expanded to size [32], and made datatype-insensitive.


int MiscFlags πŸ”— Source


bool CollDetection πŸ”— Source


int Stun πŸ”— Source

The duration the npc is stunned for. If 0, the npc is not stunned.


bool Core πŸ”— Source

This returns true if the NPC is the core segment of a segmented engine npc.


int[] Defense πŸ”— Source

index NPCDefenseIndex (NPCD_)

value NPCDefenseType (NPCDT_)

The defense categories for the npc.


untyped[] HitBy πŸ”— Source

index HitIndex (HIT_)

Stores the ID/UIDs of objects that hurt the npc this frame.

Indices:

The first four indices are for the *screen index* of objects:

Description Index Status

  • HIT_BY_NPC [0] Not used at this time.

  • HIT_BY_EWEAPON [1] Not used at this time.

  • HIT_BY_LWEAPON [2] In use by the engine.

  • HIT_BY_FFC [3] Not used at this time.

The next four, are for the FFCore β€˜script’ UIDs of objects:

Description Index Status

  • HIT_BY_NPC_UID [4] Not used at this time.

  • HIT_BY_EWEAPON_UID [5] Not used at this time.

  • HIT_BY_LWEAPON_UID [6] In use by the engine.

  • HIT_BY_FFC_UID [7] Not used at this time.

The last two, are reserved for special damage-object types.

Description Index Status

  • HIT_BY_COMBO [8] Not used at this time.

  • HIT_BY_MAPFLAG [9] Not used at this time.

These indices are uniform across all HitBy[] array members, for any datatype with that member.

Some lweapons, notably some melee weapons such as swords (but not sword beams), and boomerangs are not yet implemented in this mechanic.


int Hunger πŸ”— Source


int WeaponSprite πŸ”— Source

The sprite (Quest->Graphics->Sprites->Weapons) used to draw the weapon fired by the npc.


int WeaponSFX πŸ”— Source

The sfx (Quest->Audio->SFXData) used whenever the npc fires its weapon. If WeaponSFX <= 0 no sound will be played.


int[] ScriptDefense πŸ”— Source


int InvFrames πŸ”— Source

Returns the number of remaining invincibility frames if the npc is invincible, otherwise 0.


int Invincible πŸ”— Source

Returns if the npc is invincible, because of ( superman variable ).


bool Ringleader πŸ”— Source

If true, the npc is a Ringleader, and killing this npc will kill every npc in the room.


bool HasItem πŸ”— Source

True if the npc is carrying an item.


bool[] Shield πŸ”— Source

index NPCShieldIndex (SHLD_)

The shield status of the npc.


bool[] BFlags πŸ”— Source


int HitDir πŸ”— Source

Returns a direction constant if the npc is being knocked back.

Returns -1 if the npc is not being knockd back.

Writing to this has no effect, and is ignored.

This value is set both from engine, and from scripted knockback.


int Script πŸ”— Source

The npc script running on this npc.


bool Immortal πŸ”— Source

If true, the npc will not β€˜die’ even if it has 0hp or is too far off-screen.

Remove() will still delete the npc.


bool NoSlide πŸ”— Source

False by default. If set to β€˜true’, engine knockback is ignored.


bool NoScriptKnockback πŸ”— Source

False by default. If set to β€˜true’, scripted knockback via β€˜npc->Knockback()’ is ignored.


int SlideSpeed πŸ”— Source

The number of pixels engine knockback moves the npc at a time. Default 4.


int SpawnSprite πŸ”— Source

The spawn sprite used by the npc, 0-255


int DeathSprite πŸ”— Source

The death sprite used by the npc, 0-255


bool InvFlicker πŸ”— Source

If set false, the npc will neither flash, nor flicker when invincible.


int FlickerColor πŸ”— Source

This sets what color the npc is drawn when flickering.


int FlickerTransparencyPasses πŸ”— Source

This sets how many times the transparency effect is applied to the npc’s flicker effect.


const int FlashingCSet πŸ”— Source

This returns the npc’s current displayed cset when taking damage or invincible. If not in one of these states, will return its normal cset.


int Frozen πŸ”— Source


int FrozenTile πŸ”— Source


int FrozenCSet πŸ”— Source


const int UID πŸ”— Source

Deprecated.


int ParentUID πŸ”— Source

Deprecated.


Function descriptions#

int Max() πŸ”— Source

Returns the max number of npcs currently allowed.

Deprecated: Use Max instead!


void Max(int value) πŸ”— Source

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

Deprecated: Use Max instead!


bool isValid() πŸ”— Source

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


void Explode(int mode) πŸ”— Source

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


bool Submerged() πŸ”— Source

Returns true if the npc is submerged (ex. underground/underwater)


void GetName(char32[] buffer) πŸ”— Source


void BreakShield() πŸ”— Source


void RepairShield() πŸ”— Source


bool isDead() πŸ”— Source

Returns if the NPC is dead, or dying


bool CanSlide() πŸ”— Source

Unimplemented


bool Slide() πŸ”— Source

Run Engine knockback (Only does anything if a knockback is in-progress)

This is automatically called for most engine npc types

Calling this from npc types such as β€˜Other’ will allow them to recieve knockback

This is called as a part of scripted walking functions, such as β€˜ConstantWalk()’, automatically.

Return: 0 if no knockback occurred, 1 if scripted knockback (β€˜->Knockback()’) occurred, 2 if engine knockback occurred.


void Remove() πŸ”— Source

Instantly DELETES an npc. No items will be dropped, no sound will play; the npc is simply DELETED OUTRIGHT.

This will immediately invalidate the npc pointer, as well as update β€˜Screen->NumNPCs()’, and change the indexes for β€˜Screen->LoadNPC()’

If called from an NPC script on the NPC running the script, immediately terminates the script.


void StopBGSFX() πŸ”— Source

Stops the background sounds that the npc is generating.


void Attack() πŸ”— Source

Causes the npc to attack with its weapon.


void NewDir(int arr) πŸ”— Source

The npc chooses a new direction.

Uses an array literal for its args:

{ int rate, int homing, int special }


void ConstantWalk(int arr) πŸ”— Source

Causes the npc to walk.

Uses an array literal for its args.

Pass NULL as the pointer to run without args, or use:

{int rate, int homing, int special}


void ConstantWalk8(int arr) πŸ”— Source

As ConstantWalk(), but 8-directions.

{int rate, int homing, int special}


void VariableWalk(int arr) πŸ”— Source

Causes the npc to walk and occasionally change speed.

{int rate, int homing, int special}


void VariableWalk8(int arr) πŸ”— Source

As VariableWalk(), but 8-directions.

{int rate, int homing, int newclk, int special}

{int rate, int homing, int newclk, int special, int dx1, int dy1, int dx2, int dy2}


void HaltingWalk(int arr) πŸ”— Source

Causes an npc to walk, and occasionally halt.

{int rate, int homing, int special, int hrate, int haltcnt}


void HaltingWalk8(int arr) πŸ”— Source

As HaltingWalk(), but 8-directions.

{int newrate, int newhoming, int newclk, int special, int newhrate, int haltcnt}


void FloatingWalk(int arr) πŸ”— Source

Causes an npc to move, ignoring solidity on the screen.


void BreathAttack(bool seeklink = false) πŸ”— Source

Fires the breath weapon set to the npc.


void NewDir8(int arr) πŸ”— Source

As NewDir(), but 8-directions.

{int rate, int homing, int special}

{int rate, int homing, int special, int dx1, int dy1, int dx2, int dy2}


bool Collision(int obj_type, untyped obj_pointer) πŸ”— Source

Returns if either an object is colliding with the npc, or if an arbitrary set of

coordinates would collide.

Valid Object Types:

obj_type_lweapon, obj_type_eweapon, obj_type_npc, obj_type_link, obj_type_ffc, obj_type_combo_pos, obj_type_item

** Not fully implemented!


int LinedUp(int range, bool dir8 = false) πŸ”— Source

Checks if npc is lined up with Link.

If so, returns direction Link is at as compared to npc.

Returns -1 if not lined up. Range is inclusive.


bool LinkInRange(int dist_in_pixels) πŸ”— Source

Returns true if Link is within β€˜range’ pixels of the npc.


bool CanMove(int array) πŸ”— Source

Returns true if the npc can move in a given direction.

Uses an array literal for varying args.

Overloaded for a number of options:

{int dir}: Dir only, should use the default step distance.

{int dir, int special}

{int ndir, int step, int special}

{int ndir,int step,int special,int dx1,int dy1,int dx2,int dy2}


bool SimulateHit(int array) πŸ”— Source

Simulates hitting the npc with a weapon, another sprite, or an arbitrary set of

values passed as an overloaded array literal.

Returns true if that object would hit the npc.

{TYPE, pointer} : Specify the type, such as PTR_TYPE_LWEAPON, then pass an object pointer.

{int tx, int ty, int tz, int txsz, int tysz, int tzsz} : Arbitrary values.


npc Create(int array) πŸ”— Source

Similar to Screen->CreateNPC(), except:

  1. It uses an arry literal for its args, with varying size.

  2. You can either create an npc only by its ID, or you can do

that and set its spawn coordinates at the same time.

  1. It works based on an existing pointer, such as:

npc n; n->Create{args});

{ int id }

{ int id, int x, int y }


bool Knockback(int time, int dir, int speed = 4) πŸ”— Source

Attempt to knock back the npc in β€˜dir’ direction, for β€˜time’ frames, at a rate of β€˜speed’ pixels per frame.


bool Switch(int effect) πŸ”— Source

Switch the Hero with this sprite.

Valid values for effect is SwitchEffect (SW_) (SW_EFF_).


bool MovePaused() πŸ”— Source

Returns true if the npc is in a state in which it should not be allowed to move (ex. spawning, dying, stunned, time frozen by clock)


bool Move(int dir, int pxamnt, int special = 0) πŸ”— Source

Attempts to move the npc by β€˜pxamnt’ pixels in the β€˜dir’ direction, failing if it is blocked by something it cannot walk through.


bool MoveAtAngle(int degrees, int pxamnt, int special = 0) πŸ”— Source

Attempts to move the npc by β€˜pxamnt’ pixels in the β€˜degrees’ angle, failing if it is blocked by something it cannot walk through.


bool MoveXY(int dx, int dy, int special = 0) πŸ”— Source

Attempts to move the npc by β€˜dx’ in the x direction and β€˜dy’ in the y direction, failing if it is blocked by something it cannot walk through.


bool CanMove(int dir, int pxamnt, int special = 0) πŸ”— Source

Attempts to move the npc by β€˜pxamnt’ pixels in the β€˜dir’ direction, failing if it is blocked by something it cannot walk through.


bool CanMoveAtAngle(int degrees, int pxamnt, int special = 0) πŸ”— Source

Attempts to move the npc by β€˜pxamnt’ pixels in the β€˜degrees’ angle, failing if it is blocked by something it cannot walk through.


bool CanMoveXY(int dx, int dy, int special = 0) πŸ”— Source

Attempts to move the npc by β€˜dx’ in the x direction and β€˜dy’ in the y direction, failing if it is blocked by something it cannot walk through.


bool CanPlace(int nx, int ny, int special = SPW_NONE, bool knockback = false, int nw = -1, int nh = -1) πŸ”— Source

param NPCWalkType (SPW_) special - for example, SPW_FLOATER for flying enemies

Checks if the npc could be arbitrarily placed (teleported) at β€˜nx,ny’.

If β€˜nw’ or β€˜nh’ are > -1, they will be used as the width/height of the npc for the check.

Otherwise, the npc’s hitwidth/hitheight are used.

Some enemies treat pits/liquid as solid, EXCEPT if they are being knocked back.

β€˜bool knockback’ here affects this for the placement checks.

Returns true if the npc could be placed successfully, false otherwise.


bool isFlickerFrame() πŸ”— Source

This returns true if the npc is currently in a flicker frame (either invisible or color masked).


void Own(bitmap b) πŸ”— Source

Grants β€˜Ownership’ of the parameter object to the npc.


void Own(paldata b) πŸ”— Source

Grants β€˜Ownership’ of the parameter object to the npc.


void Own(file b) πŸ”— Source

Grants β€˜Ownership’ of the parameter object to the npc.


void Own(directory b) πŸ”— Source

Grants β€˜Ownership’ of the parameter object to the npc.


void Own(stack b) πŸ”— Source

Grants β€˜Ownership’ of the parameter object to the npc.


void Own(randgen b) πŸ”— Source

Grants β€˜Ownership’ of the parameter object to the npc.


void OwnArray(untyped array) πŸ”— Source

Grants β€˜Ownership’ of the parameter object to the npc.


void OwnObject(untyped object) πŸ”— Source

Grants β€˜Ownership’ of the parameter object to the npc.