npc#

Inherits: sprite

Variables#

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

const int

ID

int

Type

int

Family

int

Damage

int

WeaponDamage

int

OriginalTile

int

Weapon

int

ItemSet

int

Dropset

BossPal

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

LightRadius

int

LightShape

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 arg1)

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 = 0, 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 NpcType: ๐Ÿ”— Source

NpcType NPCT_GUY = 0

NpcType NPCT_WALK = 1

NpcType NPCT_TEKTITE = 3

NpcType NPCT_LEEVER = 4

NpcType NPCT_PEAHAT = 5

NpcType NPCT_ZORA = 6

NpcType NPCT_ROCK = 7

NpcType NPCT_GHINI = 8

NpcType NPCT_ARMOS = 9

NpcType NPCT_KEESE = 10

NpcType NPCT_TRAP = 15

NpcType NPCT_WALLMASTER = 16

NpcType NPCT_WIZZROBE = 21

NpcType NPCT_AQUAMENTUS = 22

NpcType NPCT_MOLDORM = 23

NpcType NPCT_DODONGO = 24

NpcType NPCT_MANHANDLA = 25

NpcType NPCT_GLEEOK = 26

NpcType NPCT_DIGDOGGER = 27

NpcType NPCT_GOHMA = 28

NpcType NPCT_LANMOLA = 29

NpcType NPCT_PATRA = 30

NpcType NPCT_GANON = 31

NpcType NPCT_PROJECTILE = 32

NpcType NPCT_SPINTILE = 37

NpcType NPCT_NONE = 38

NpcType NPCT_FAIRY = 39

NpcType NPCT_OTHERFLOAT = 40

NpcType NPCT_OTHER = 41

NpcType NPCT_CUSTOM_01 = 43

NpcType NPCT_SCRIPT_01 = 43

NpcType NPCT_CUSTOM_02 = 44

NpcType NPCT_SCRIPT_02 = 44

NpcType NPCT_CUSTOM_03 = 45

NpcType NPCT_SCRIPT_03 = 45

NpcType NPCT_CUSTOM_04 = 46

NpcType NPCT_SCRIPT_04 = 46

NpcType NPCT_CUSTOM_05 = 47

NpcType NPCT_SCRIPT_05 = 47

NpcType NPCT_CUSTOM_06 = 48

NpcType NPCT_SCRIPT_06 = 48

NpcType NPCT_CUSTOM_07 = 49

NpcType NPCT_SCRIPT_07 = 49

NpcType NPCT_CUSTOM_08 = 50

NpcType NPCT_SCRIPT_08 = 50

NpcType NPCT_CUSTOM_09 = 51

NpcType NPCT_SCRIPT_09 = 51

NpcType NPCT_CUSTOM_10 = 52

NpcType NPCT_SCRIPT_10 = 52

NpcType NPCT_CUSTOM_11 = 53

NpcType NPCT_SCRIPT_11 = 53

NpcType NPCT_CUSTOM_12 = 54

NpcType NPCT_SCRIPT_12 = 54

NpcType NPCT_CUSTOM_13 = 55

NpcType NPCT_SCRIPT_13 = 55

NpcType NPCT_CUSTOM_14 = 56

NpcType NPCT_SCRIPT_14 = 56

NpcType NPCT_CUSTOM_15 = 57

NpcType NPCT_SCRIPT_15 = 57

NpcType NPCT_CUSTOM_16 = 58

NpcType NPCT_SCRIPT_16 = 58

NpcType NPCT_CUSTOM_17 = 59

NpcType NPCT_SCRIPT_17 = 59

NpcType NPCT_CUSTOM_18 = 60

NpcType NPCT_SCRIPT_18 = 60

NpcType NPCT_CUSTOM_19 = 61

NpcType NPCT_SCRIPT_19 = 61

NpcType NPCT_CUSTOM_20 = 62

NpcType NPCT_SCRIPT_20 = 62

NpcType NPCT_FRIENDLY_01 = 63

NpcType NPCT_FRIENDLY_02 = 64

NpcType NPCT_FRIENDLY_03 = 65

NpcType NPCT_FRIENDLY_04 = 66

NpcType NPCT_FRIENDLY_05 = 67

NpcType NPCT_FRIENDLY_06 = 68

NpcType NPCT_FRIENDLY_07 = 69

NpcType NPCT_FRIENDLY_08 = 70

NpcType NPCT_FRIENDLY_09 = 71

NpcType NPCT_FRIENDLY_10 = 72


enum NpcDefenseIndex: ๐Ÿ”— Source

Use as index for npc->Defense[].

NpcDefenseIndex NPCD_BRANG = 0

NpcDefenseIndex NPCD_BOMB = 1

NpcDefenseIndex NPCD_SBOMB = 2

NpcDefenseIndex NPCD_ARROW = 3

NpcDefenseIndex NPCD_FIRE = 4

NpcDefenseIndex NPCD_WAND = 5

NpcDefenseIndex NPCD_MAGIC = 6

NpcDefenseIndex NPCD_HOOKSHOT = 7

NpcDefenseIndex NPCD_HAMMER = 8

NpcDefenseIndex NPCD_SWORD = 9

NpcDefenseIndex NPCD_BEAM = 10

NpcDefenseIndex NPCD_REFBEAM = 11

NpcDefenseIndex NPCD_REFMAGIC = 12

NpcDefenseIndex NPCD_REFFIREBALL = 13

NpcDefenseIndex NPCD_REFROCK = 14

NpcDefenseIndex NPCD_STOMP = 15

NpcDefenseIndex NPCD_BYRNA = 16

NpcDefenseIndex NPCD_SCRIPT = 17

NpcDefenseIndex NPCD_SCRIPT1 = 20

NpcDefenseIndex NPCD_SCRIPT2 = 21

NpcDefenseIndex NPCD_SCRIPT3 = 22

NpcDefenseIndex NPCD_SCRIPT4 = 23

NpcDefenseIndex NPCD_SCRIPT5 = 24

NpcDefenseIndex NPCD_SCRIPT6 = 25

NpcDefenseIndex NPCD_SCRIPT7 = 26

NpcDefenseIndex NPCD_SCRIPT8 = 27

NpcDefenseIndex NPCD_SCRIPT9 = 28

NpcDefenseIndex NPCD_SCRIPT10 = 29

NpcDefenseIndex NPCD_WHISTLE = 35

NpcDefenseIndex NPCD_SWITCHHOOK = 36

NpcDefenseIndex NPCD_THROWN = 37

NpcDefenseIndex NPCD_REFARROW = 38

NpcDefenseIndex NPCD_REFFIRE = 39

NpcDefenseIndex NPCD_REFFIRE2 = 40


enum NpcDefenseType: ๐Ÿ”— Source

Use as value type for npc->Defense[].

NpcDefenseType NPCDT_NONE = 0

NpcDefenseType NPCDT_HALFDAMAGE = 1

NpcDefenseType NPCDT_QUARTERDAMAGE = 2

NpcDefenseType NPCDT_STUN = 3

NpcDefenseType NPCDT_STUNORBLOCK = 4

NpcDefenseType NPCDT_STUNORIGNORE = 5

NpcDefenseType NPCDT_BLOCK1 = 6

NpcDefenseType NPCDT_BLOCK2 = 7

NpcDefenseType NPCDT_BLOCK4 = 8

NpcDefenseType NPCDT_BLOCK6 = 9

NpcDefenseType NPCDT_BLOCK8 = 10

NpcDefenseType NPCDT_BLOCK = 11

NpcDefenseType NPCDT_IGNORE1 = 12

NpcDefenseType NPCDT_IGNORE = 13

NpcDefenseType NPCDT_ONEHITKILL = 14

NpcDefenseType NPCDT_BLOCK10 = 15

NpcDefenseType NPCDT_2XDAMAGE = 16

NpcDefenseType NPCDT_3XDAMAGE = 17

NpcDefenseType NPCDT_4XDAMAGE = 18

NpcDefenseType NPCDT_HEAL = 19

NpcDefenseType NPCDT_TRIGGERSECRETS = 20

NpcDefenseType NPCDT_SWITCH = 50


enum NpcWeapon: ๐Ÿ”— Source

Enemy projectile weapon selections. Use with npc->Weapon. Note: Donโ€™t use these with Screen->CreateEWeapon! Use the EW_ constants instead. Use WeaponTypeToID to convert this enum to a EW_ value.

NpcWeapon WPN_NONE = 0

NpcWeapon WPN_ENEMYFLAME = 140

NpcWeapon WPN_ENEMYWIND = 141

NpcWeapon WPN_ENEMYFIREBALL = 129

NpcWeapon WPN_ENEMYARROW = 130

NpcWeapon WPN_ENEMYBRANG = 131

NpcWeapon WPN_ENEMYSWORD = 132

NpcWeapon WPN_ENEMYROCK = 133

NpcWeapon WPN_ENEMYMAGIC = 134

NpcWeapon WPN_ENEMYBOMB = 135

NpcWeapon WPN_ENEMYSBOMB = 136

NpcWeapon WPN_ENEMYLITBOMB = 137

NpcWeapon WPN_ENEMYLITSBOMB = 138

NpcWeapon WPN_ENEMYFIRETRAIL = 139

NpcWeapon WPN_ENEMYFLAME2 = 142

NpcWeapon WPN_ENEMYFLAME2TRAIL = 143

Not implemented

NpcWeapon WPN_ENEMYICE = 144

Not implemented

NpcWeapon WPN_ENEMYFIREBALL2 = 145

A fireball that doesnโ€™t fly toward Link


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 NpcMoveFlagIndex: ๐Ÿ”— Source

NpcMoveFlagIndex NPCMV_OBEYS_GRAVITY = 0

NpcMoveFlagIndex NPCMV_CAN_PITFALL = 1

NpcMoveFlagIndex NPCMV_CAN_PIT_WALK = 2

NpcMoveFlagIndex NPCMV_CAN_WATERDROWN = 3

NpcMoveFlagIndex NPCMV_CAN_WATER_WALK = 4

NpcMoveFlagIndex NPCMV_ONLY_WATER_WALK = 5

NpcMoveFlagIndex NPCMV_ONLY_SHALLOW_WATER_WALK = 6

NpcMoveFlagIndex NPCMV_ONLY_PIT_WALK = 7

NpcMoveFlagIndex NPCMV_NO_FAKE_Z = 8

NpcMoveFlagIndex NPCMV_NO_REAL_Z = 9

NpcMoveFlagIndex NPCMV_USE_FAKE_Z = 10

NpcMoveFlagIndex NPCMV_IGNORE_SOLIDITY = 11

NpcMoveFlagIndex NPCMV_IGNORE_BLOCKFLAGS = 12

NpcMoveFlagIndex NPCMV_IGNORE_SCREENEDGE = 13

NpcMoveFlagIndex NPCMV_USE_SCRIPTED_MOVEMENT_ENGINE = 14

NpcMoveFlagIndex NPCMV_NOT_PUSHABLE_BY_SOLIDS = 15


enum NpcShieldIndex: ๐Ÿ”— Source

NpcShieldIndex SHLD_FRONT = 0

NpcShieldIndex SHLD_BACK = 1

NpcShieldIndex SHLD_LEFT = 2

NpcShieldIndex SHLD_RIGHT = 3

NpcShieldIndex SHLD_CAN_BREAK = 4


enum NpcFade: ๐Ÿ”— Source

NpcFade NPCF_NONE = 0

NpcFade NPCF_FLICKER = 1

NpcFade NPCF_INVISIBLE = 2

NpcFade NPCF_FLASH = 3

NpcFade NPCF_POOF = 4


Variable descriptions#

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 enemy knockback. The first byte is the clock. The second byte is the dir. Enemies that split do not slide.


int Fading ๐Ÿ”— Source

The death effect for the npc.

Valid values: NpcFade (NPCF_).


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

The movement status of an npc, usually flying.

See enum NPCMoveStatus in <std.zh>.


int Haltrate ๐Ÿ”— Source


int Random ๐Ÿ”— Source

Corresponds to the Enemy Editor Random Rate value.


int HP ๐Ÿ”— Source


const int ID ๐Ÿ”— Source

The enemy ID of the enemy.


int Type ๐Ÿ”— Source

The type, or โ€˜enemy classโ€™ of the enemy.

Valid values: NpcType (NPCT_).


int Family ๐Ÿ”— Source

The type, or โ€˜enemy classโ€™ of the enemy. Same as Type.

Valid values: NpcType (NPCT_).


int Damage ๐Ÿ”— Source


int WeaponDamage ๐Ÿ”— Source


int OriginalTile ๐Ÿ”— Source


int Weapon ๐Ÿ”— Source

Valid values: NpcWeapon (WPN_).


int ItemSet ๐Ÿ”— Source

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

Valid values: ItemSet (IS_).


int Dropset ๐Ÿ”— Source

Alias for npc->ItemSet.

Read or write the item dropset used by the npc.


BossPal BossPal ๐Ÿ”— Source

Valid values: BossPal (BPAL_).


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 enemy.


int[] Defense ๐Ÿ”— Source

Expanded to a size of 42 to cover new defense categories.

Valid indices are NpcDefenseIndex (NPCD_). Valid values: NpcDefenseType (NPCDT_).


untyped[] HitBy ๐Ÿ”— Source

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 enemy is invincible, otherwise 0.


int Invincible ๐Ÿ”— Source

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


bool Ringleader ๐Ÿ”— Source

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


bool HasItem ๐Ÿ”— Source

True if the enemy is carrying an item.


bool[] Shield ๐Ÿ”— Source

Flags related to the enemyโ€™s shield.

Valid indices are NpcShieldIndex (SHLD_).


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 enemy 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 enemy at a time. Default 4.


int LightRadius ๐Ÿ”— Source

The radius of light this object emits in a dark room


int LightShape ๐Ÿ”— Source

The shape of light this object emits in a dark room.


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 enemy is drawn when flickering.


int FlickerTransparencyPasses ๐Ÿ”— Source

This sets how many times the transparency effect is applied to the enemyโ€™s flicker effect.


const int FlashingCSet ๐Ÿ”— Source

This returns the enemyโ€™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

Warning

Deprecated!


int ParentUID ๐Ÿ”— Source

Warning

Deprecated!


Function descriptions#

int Max() ๐Ÿ”— Source

Returns the max number of npcs currently allowed.

Warning

Deprecated! Use Max instead!


void Max(int value) ๐Ÿ”— Source

Sets the max number of npcs 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 npc. If this returns false, using any other value of this pointer will error.


void Explode(int arg1) ๐Ÿ”— Source


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 enemy types

Calling this from enemy 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 enemy 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 enemy to move, ignoring solidity on the screen.


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

Fires the breath weapon set to the enemy.


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 enemy is lined up with Link.

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

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 enemy.


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_EFF_).


bool MovePaused() ๐Ÿ”— Source

Returns true if the enemy 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 enemy 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 enemy 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 enemy 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 enemy 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 enemy 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 enemy 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 = 0, bool knockback = false, int nw = -1, int nh = -1) ๐Ÿ”— Source

Checks if the enemy could be arbitrarily placed (teleported) at โ€˜nx,nyโ€™.

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

Otherwise, the enemyโ€™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.

Use the โ€˜SPW_โ€™ constants to provide a special value;

i.e. โ€˜SPW_FLOATERโ€™ for flying enemies.

Use โ€˜SPW_NONEโ€™ if you donโ€™t know what to use.

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


bool isFlickerFrame() ๐Ÿ”— Source

This returns true if the enemy 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.