Binding of Isaac - Afterbirth+ Lua Reference/Guide

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
EntityNPC Class Reference
Inheritance diagram for EntityNPC:

## Public Member Functions
boolean | Morph (EntityType, integer Variant, integer SubType, integer ChampionColorIdx)
| KillUnique ()
| For entities with unique death animation, like Flush! vs poop enemies. More...
boolean | IsBoss ()
Entity & | GetPlayerTarget ()
| if there are no modifiers (best friend) this will return the player More...
Vector | CalcTargetPosition (float DistanceLimit)
integer | GetBossColorIdx ()
integer | GetChampionColorIdx ()
| ResetPathFinderTarget ()
boolean | CanBeDamagedFromVelocity (Vector Velocity)
boolean | CanReroll ()
boolean | IsChampion ()
| MakeChampion (integer Seed)
| Forces a non champion to become a champion, resets hp to max hp. More...
| PlaySound (SoundEffect ID, float Volume, integer FrameDelay, boolean Loop, float Pitch)
EntityEffect & | MakeSplat (float Size)
integer | GetAliveEnemyCount ()
| Used to redirect close door enemies to any enemies for friendly npcs. More...
| FireProjectiles (Vector Pos, Vector Velocity, ProjectilesMode Mode, ProjectileParams Params)
EntityProjectile & | FireBossProjectiles (integer NumProjectiles, Vector TargetPos, float TrajectoryModifier, ProjectileParams Params)
| AnimWalkFrame (string HorizontalAnim, string VerticalAnim, float SpeedThreshold)
EntityList | QueryNPCsType (EntityType Type, integer Variant)
EntityList | QueryNPCsSpawnerType (EntityType SpawnerType, EntityType Type, boolean OnlyEnemies)
EntityList | QueryNPCsGroup (integer GroupIdx)
Public Member Functions inherited from Entity
table | GetData ()
| Update ()
| Render (Vector Offset)
boolean | RenderShadowLayer (Vector Offset)
| PostRender ()
boolean | TakeDamage (float Damage, integer Flags, EntityRef Source, integer DamageCountdown)
boolean | HasMortalDamage ()
| Kill ()
| Kills the entity and makes a blood splat or gibs. More...
| Die ()
| Remove ()
| BloodExplode ()
| Explodes with gibs and blood. More...
| AddVelocity (Vector Velocity)
| MultiplyFriction (float Value)
| SetColor (KColor KColor, integer Duration, integer Priority, boolean Fadeout, boolean Share)
const KColor & | GetColor ()
| SetSpriteFrame (string AnimationName, integer FrameNum)
| SetSpriteOverlayFrame (string AnimationName, integer FrameNum)
| SetSize (float Size, Vector SizeMulti, integer NumGridCollisionPoints)
boolean | CollidesWithGrid ()
boolean | IsEnemy ()
| return true for NPCs that are not controlled by the player More...
boolean | IsActiveEnemy (boolean includeDead)
| return true for non background NPCs (ex: every enemy except fire and shopkeepers) More...
boolean | IsVulnerableEnemy ()
| return true for enemies that can be damaged More...
boolean | IsFlying ()
| AddEntityFlags (integer Flags)
| ClearEntityFlags (integer Flags)
integer | GetEntityFlags ()
boolean | HasEntityFlags (integer Flags)
boolean | HasFullHealth ()
| AddHealth (float HitPoints)
| AddPoison (EntityRef Source, integer Duration, float Damage)
| AddFreeze (EntityRef Source, integer Duration)
| AddSlowing (EntityRef Source, integer Duration, float SlowValue, KColor SlowColor)
| Makes the friction higher. More...
| AddCharmed (integer Duration)
| AddConfusion (EntityRef Source, integer Duration, boolean IgnoreBosses)
| AddMidasFreeze (EntityRef Source, integer Duration)
| AddFear (EntityRef Source, integer Duration)
| AddBurn (EntityRef Source, integer Duration, float Damage)
| AddShrink (EntityRef Source, integer Duration)
| RemoveStatusEffects ()
boolean | Exists ()
boolean | IsDead ()
boolean | IsVisible ()
boolean | IsInvincible ()
boolean | CanShutDoors ()
| enemies keep the doors shut More...
boolean | IsBoss ()
| bosses display health bar More...
BossId | GetBossID ()
Entity & | GetLastParent ()
Entity & | GetLastChild ()
boolean | HasCommonParentWithEntity (Entity Other)
boolean | IsFrame (integer Frame, integer Offset)
| true every X frames More...
RNG & | GetDropRNG ()
Sprite & | GetSprite ()
EntityPlayer | ToPlayer ()
EntityEffect | ToEffect ()
EntityNPC | ToNPC ()
EntityPickup | ToPickup ()
EntityFamiliar | ToFamiliar ()
EntityBomb | ToBomb ()
EntityKnife | ToKnife ()
EntityLaser | ToLaser ()
EntityTear | ToTear ()
EntityProjectile | ToProjectile ()

## Static Public Member Functions
static | ThrowSpider (Vector Position, Entity Spawner, Vector TargetPos, boolean Big, float YOffset)

## Public Attributes
boolean | CanShutDoors
float | Scale
const EntityNPC & | ParentNPC
| parent entity, for multi-entity NPCs like Larry Jr. More...
const EntityNPC & | ChildNPC
Entity & | EntityRef
integer | StateFrame
PathFinder | Pathfinder
integer | State
integer | ProjectileCooldown
integer | ProjectileDelay
| >0: projectile will be fired in n frames More...
Vector | V1
| general usage for ai_* functions, initialized to (0,0) More...
Vector | V2
| like m_V1, in case we need two of those More...
integer | I1
| general usage ints for ai_ More...
integer | I2
| same as m_I1 More...
integer | GroupIdx
| Used to identify multichunks groups. More...
Public Attributes inherited from Entity
float | Friction
| loaded from entity config More...
Vector | Position
Vector | Velocity
const EntityType | Type
integer | Variant
| void SetType(eEntityType Type); More...
integer | SubType
EntityType | SpawnerType
integer | SpawnerVariant
const KColor & | SplatColor
boolean | Visible
const Vector & | PositionOffset
integer | RenderZOffset
boolean | FlipX
const Vector & | SpriteOffset
const Vector & | SpriteScale
float | SpriteRotation
Vector | SizeMulti
float | Mass
float | MaxHitPoints
float | HitPoints
const integer | Index
const Vector & | TargetPosition
GridCollisionClass | GridCollisionClass
EntityCollisionClass | EntityCollisionClass
float | CollisionDamage
const integer | SpawnGridIndex
Entity & | Parent
Entity & | Child
Entity & | Target
Entity & | SpawnerEntity
const integer | FrameCount
const integer | InitSeed
const integer | DropSeed
float | DepthOffset

## Member Function Documentation

## ◆ AnimWalkFrame()

EntityNPC::AnimWalkFrame | ( | string | HorizontalAnim,
|  | string | VerticalAnim,
|  | float | SpeedThreshold
| ) |  |

animation helpers void anim_walkframe(Sprite& S, const char* HorizontalAnim, const char* VerticalAnim, float SpeedThreshold);

## ◆ CalcTargetPosition()

Vector EntityNPC::CalcTargetPosition | ( | float | DistanceLimit | ) |

## ◆ CanBeDamagedFromVelocity()

boolean EntityNPC::CanBeDamagedFromVelocity | ( | Vector | Velocity | ) |

## ◆ CanReroll()

boolean EntityNPC::CanReroll | ( |  | ) |

## ◆ FireBossProjectiles()

EntityProjectile& EntityNPC::FireBossProjectiles | ( | integer | NumProjectiles,
|  | Vector | TargetPos,
|  | float | TrajectoryModifier,
|  | ProjectileParams | Params
| ) |  |

fire a number of projectiles, optionally targeting the player direction is randomized, or slightly randomized when targeting the player FallingAccelModifier can be used to make projectiles fall faster to the ground returns a pointer to the projectile spawned last (useful e.g. when NumProjectiles=1)

## ◆ FireProjectiles()

EntityNPC::FireProjectiles | ( | Vector | Pos,
|  | Vector | Velocity,
|  | ProjectilesMode | Mode,
|  | ProjectileParams | Params
| ) |  |

## ◆ GetAliveEnemyCount()

integer EntityNPC::GetAliveEnemyCount | ( |  | ) |

Used to redirect close door enemies to any enemies for friendly npcs.

## ◆ GetBossColorIdx()

integer EntityNPC::GetBossColorIdx | ( |  | ) |

## ◆ GetChampionColorIdx()

integer EntityNPC::GetChampionColorIdx | ( |  | ) |

## ◆ GetPlayerTarget()

Entity& EntityNPC::GetPlayerTarget | ( |  | ) |

if there are no modifiers (best friend) this will return the player

## ◆ IsBoss()

boolean EntityNPC::IsBoss | ( |  | ) |

## ◆ IsChampion()

boolean EntityNPC::IsChampion | ( |  | ) |

## ◆ KillUnique()

EntityNPC::KillUnique | ( |  | ) |

For entities with unique death animation, like Flush! vs poop enemies.

## ◆ MakeChampion()

EntityNPC::MakeChampion | ( | integer | Seed | ) |

Forces a non champion to become a champion, resets hp to max hp.

## ◆ MakeSplat()

EntityEffect& EntityNPC::MakeSplat | ( | float | Size | ) |

## ◆ Morph()

boolean EntityNPC::Morph | ( | EntityType | ,
|  | integer | Variant,
|  | integer | SubType,
|  | integer | ChampionColorIdx
| ) |  |

## ◆ PlaySound()

EntityNPC::PlaySound | ( | SoundEffect | ID,
|  | float | Volume,
|  | integer | FrameDelay,
|  | boolean | Loop,
|  | float | Pitch
| ) |  |

## ◆ QueryNPCsGroup()

EntityList EntityNPC::QueryNPCsGroup | ( | integer | GroupIdx | ) |

## ◆ QueryNPCsSpawnerType()

EntityList EntityNPC::QueryNPCsSpawnerType | ( | EntityType | SpawnerType,
|  | EntityType | Type,
|  | boolean | OnlyEnemies
| ) |  |

## ◆ QueryNPCsType()

EntityList EntityNPC::QueryNPCsType | ( | EntityType | Type,
|  | integer | Variant
| ) |  |

## ◆ ResetPathFinderTarget()

EntityNPC::ResetPathFinderTarget | ( |  | ) |

## ◆ ThrowSpider()

static EntityNPC::ThrowSpider | ( | Vector | Position,
|  | Entity | Spawner,
|  | Vector | TargetPos,
|  | boolean | Big,
|  | float | YOffset
| ) |  |
| static

## Member Data Documentation

## ◆ CanShutDoors

boolean EntityNPC::CanShutDoors

## ◆ ChildNPC

const EntityNPC& EntityNPC::ChildNPC

## ◆ EntityRef

Entity& EntityNPC::EntityRef

## ◆ GroupIdx

integer EntityNPC::GroupIdx

Used to identify multichunks groups.

## ◆ I1

integer EntityNPC::I1

general usage ints for ai_

## ◆ I2

integer EntityNPC::I2

same as m_I1

## ◆ ParentNPC

const EntityNPC& EntityNPC::ParentNPC

parent entity, for multi-entity NPCs like Larry Jr.

## ◆ Pathfinder

PathFinder EntityNPC::Pathfinder

## ◆ ProjectileCooldown

integer EntityNPC::ProjectileCooldown

projectiles can fire again when it reaches 0

## ◆ ProjectileDelay

integer EntityNPC::ProjectileDelay

>0: projectile will be fired in n frames

## ◆ Scale

float EntityNPC::Scale

## ◆ State

integer EntityNPC::State

## ◆ StateFrame

integer EntityNPC::StateFrame

## ◆ V1

Vector EntityNPC::V1

general usage for ai_* functions, initialized to (0,0)

## ◆ V2

Vector EntityNPC::V2

like m_V1, in case we need two of those