Cavestory Mod API
Public Member Functions | Public Attributes | List of all members
NPCHAR Struct Reference

NPC object. More...

#include <CSMAPI_types.h>

Public Member Functions

CAVESTORY_MOD_API unsigned int GetHash (bool bForce=false)
 Get this NPC's hash. More...
 
CAVESTORY_MOD_API GUI_POINT GetDrawPosition (int fx=-1, int fy=-1)
 Get this NPC's draw position. More...
 

Public Attributes

unsigned int last_update_time
 A timestamp of when this NPC was last updated.
 
unsigned long long int nodes
 Node flags.
 
unsigned long long int transmit_nodes
 Transmit node flags.
 
unsigned char cond
 NPC Condition flags.
 
int flag
 Internal flags.
 
int x
 X Position.
 
int y
 Y Position.
 
int xm
 X Motion.
 
int ym
 Y Motion.
 
int xm2
 X Motion 2.
 
int ym2
 Y Motion 2.
 
int tgt_x
 Target X.
 
int tgt_y
 Target Y.
 
int code_char
 ID of this NPC.
 
int code_flag
 NPC Flag ID Details which NPC flag to test when first spawning this NPC.
 
int code_event
 The event this NPC should call.
 
Surface_Ids surf
 Surface ID – Reserved for CaveEditor – Do not change unless you know what you're doing.
 
int hit_voice
 Hit voice – Reserved for CaveEditor – Do not change unless you know what you're doing.
 
int destroy_voice
 Destroy voice – Reserved for CaveEditor – Do not change unless you know what you're doing.
 
int life
 NPC Health.
 
int exp
 How much experience points this NPC drops on death.
 
int size
 NPC Scale.
 
int direct
 NPC Direction.
 
unsigned int bits
 Map flags for this NPC.
 
RECT rect
 Sprite rect.
 
int ani_wait
 Animation wait counter.
 
int ani_no
 Animation number.
 
int count1
 Custom counter 1.
 
int count2
 Custom counter 2.
 
int count3
 Custom counter 3.
 
int count4
 Custom counter 4.
 
int act_no
 Act number.
 
int act_wait
 Act wait counter.
 
RECT hit
 Hit rect – Reserved for CaveEditor – Do not change unless you know what you're doing.
 
RECT view
 View rect – Reserved for CaveEditor – Do not change unless you know what you're doing.
 
unsigned char shock
 Shock Set when this NPC gets hurt, and decrements to 0 every frame.
 
int damage_view
 Damage view.
 
int damage
 How much damage this NPC deals to the player.
 
NPCHARpNpc
 NPC Pointer If you use this, you should specify "pNpc" in both Node flags & Transmit node flags in CaveEditor.
 
PutNPCFunc putFunc
 Custom draw function. More...
 
FreeNPCFunc freeFunc
 Custom free function. More...
 
CollideNPCFunc collideFunc
 Custom collide function. More...
 
bool should_call_free
 Should call free function. More...
 
int old_x
 cache – do not use
 
int old_y
 cache – do not use
 
int old_ani_no
 cache – do not use
 
int zone
 Which zone this NPC is currently in – Do not change this variable.
 
CaveNet::DataStructures::NetClientclient
 Client pointer – Do not change this variable.
 
CaveNet::DataStructures::NetClientclient2
 Client pointer – Do not change this variable.
 
MYCHARdfocus
 Display focus – Do not change this variable.
 
MYCHARfocus
 A pointer to the character that this NPC is focusing. More...
 
MYCHARfocus2
 Focus 2 – Do not change this variable.
 
int updateTicks
 Counter for updating focus – Do not change this variable.
 
bool sized
 Whether this NPC is custom sized.
 
int scalar
 Scalar for this NPC.
 
void * data
 Custom user data.
 
int entity_init_index
 The initial index of this NPC. More...
 
CaveNet::DataStructures::NetClientdependent
 The client ID of the client we're dependent on.
 
CaveNet::DataStructures::NetClientdamage_target
 Will only damage this specific client if not set to NULL.
 

Detailed Description

NPC object.

Member Function Documentation

◆ GetDrawPosition()

CAVESTORY_MOD_API GUI_POINT NPCHAR::GetDrawPosition ( int  fx = -1,
int  fy = -1 
)

Get this NPC's draw position.

Returns
Returns the top left corner of the NPC in screen coordinates.

◆ GetHash()

CAVESTORY_MOD_API unsigned int NPCHAR::GetHash ( bool  bForce = false)

Get this NPC's hash.

Parameters
bForceForce a hash, even if this NPC is not considered as 'active' (cond & 0x80).
Returns
The hash for this NPC.

Member Data Documentation

◆ collideFunc

CollideNPCFunc NPCHAR::collideFunc

Custom collide function.

If NULL, then the normal collision detection will ALWAYS run.

◆ entity_init_index

int NPCHAR::entity_init_index

The initial index of this NPC.

This controls entity properties; don't mess with this.

◆ focus

MYCHAR* NPCHAR::focus

A pointer to the character that this NPC is focusing.

Note
If you are using this variable, please run down this checklist to ensure validity in multiplayer:
    1. In CaveEditor's NPC Editor, select the NPC that you want to focus somebody
    2. In the 'Flags' tab, enable the 'Focus Closest Players' checkmark
    3. In the 'Nodes' tab, enable the 'focus' checkmark
    4. In the 'Transmit Nodes' tab, enable the 'focus' checkmark

◆ freeFunc

FreeNPCFunc NPCHAR::freeFunc

Custom free function.

If NULL, then this will not be called.

◆ putFunc

PutNPCFunc NPCHAR::putFunc

Custom draw function.

If NULL, then it will draw the NPC normally.

◆ should_call_free

bool NPCHAR::should_call_free

Should call free function.

Do not mess with this variable unless you know what you're doing.


The documentation for this struct was generated from the following file: