Binding of Isaac - Afterbirth+ Lua Reference/Guide
|
Public Member Functions | |
Update () | |
Render () | |
boolean | IsPaused () |
Displays the HUD elements that are moved to the gamepad. More... | |
Entity & | Spawn (EntityType Type, integer Variant, Vector Position, Vector Velocity, Entity Spawner, integer SubType, integer Seed) |
EntityNPC & | SpawnEntityDesc (Entity::EntityDesc desc, Vector Position, Entity Spawner) |
BombDamage (Vector Position, float Damage, float Radius, boolean LineCheck, Entity Source, integer TearFlags, integer DamageFlags, boolean DamageSource) | |
BombExplosionEffects (Vector Position, float Damage, integer TearFlags, Color Color, Entity Source, float RadiusMult, boolean LineCheck, boolean DamageSource) | |
The complete bomb explosion package: Do damage, spawn boomgraphics, and apply tearflag-based effects. More... | |
BombTearflagEffects (Vector Position, float Radius, integer TearFlags, Entity Source) | |
Does bomb-exclusive special effects. More... | |
Fart (Vector Position, float Radius, Entity Source, float FartScale, integer FartSubType) | |
CharmFart (Vector Position, float Radius, Entity Source) | |
ButterBeanFart (Vector Position, float Radius, Entity Source, boolean ShowEffect) | |
boolean | RerollEnemy (Entity e) |
SpawnParticles (Vector Pos, EntityEffect::Variant ParticleType, integer NumParticles, float Speed, Color Color, float Height) | |
Font & | GetFont () |
Level & | GetLevel () |
Room & | GetRoom () |
EntityPlayer & | GetPlayer (integer Index) |
EntityPlayer & | GetNearestPlayer (Vector Pos) |
EntityPlayer & | GetRandomPlayer (Vector Pos, float Radius) |
integer | GetNumPlayers () |
History & | GetItemHistory () |
ItemPool & | GetItemPool () |
ItemOverlay & | GetItemOverlay () |
Seeds & | GetSeeds () |
End (Ending Ending) | |
ShowFortune () | |
ShowRule () | |
StartRoomTransition (integer RoomIndex, Direction Direction, RoomTransition::Animation Animation) | |
ChangeRoom (integer RoomIndex) | |
StartStageTransition (boolean SameStage, StageTransition::Animation Animation) | |
MoveToRandomRoom (boolean IAmErrorRoom, integer Seed) | |
integer | GetFrameCount () |
boolean | GetStateFlag (StateFlag StateFlag) |
SetStateFlag (StateFlag StateFlag, boolean Val) | |
SetLastDevilRoomStage (LevelStage Stage) | |
LevelStage (UserData) | GetLastDevilRoomStage () |
AddTreasureRoomsVisited () | |
integer | GetTreasureRoomVisitCount () |
AddStageWithoutHeartsPicked () | |
ClearStagesWithoutHeartsPicked () | |
integer | GetStagesWithoutHeartsPicked () |
AddStageWithoutDamage () | |
ClearStagesWithoutDamage () | |
integer | GetStagesWithoutDamage () |
AddDevilRoomDeal () | |
DonateGreed (integer Donate) | |
DonateAngel (integer Donate) | |
integer | GetDevilRoomDeals () |
integer | GetDonationModGreed () |
integer | GetDonationModAngel () |
ClearDonationModGreed () | |
ClearDonationModAngel () | |
SetLastLevelWithDamage (LevelStage Stage) | |
LevelStage | GetLastLevelWithDamage () |
AddEncounteredBoss (EntityType Boss, integer Variant) | |
integer | GetNumEncounteredBosses () |
boolean | HasEncounteredBoss (EntityType Boss, integer Variant) |
integer | GetGreedWavesNum () |
integer | GetGreedBossWaveNum () |
SetLastLevelWithoutHalfHp (LevelStage Stage) | |
LevelStage | GetLastLevelWithoutHalfHp () |
ShakeScreen (integer Timeout) | |
const integer & | GetScreenShakeCountdown () |
Darken (float Darkness, integer Timeout) | |
float | GetDarknessModifier () |
float | GetTargetDarkness () |
integer | GetVictoryLap () |
NextVictoryLap () | |
boolean | IsGreedMode () |
RerollLevelCollectibles () | |
RerollLevelPickups (integer Seed) | |
FinishChallenge () | |
AddPixelation (integer Duration) | |
ShowHallucination (integer FrameCount, Backdrop::Backdrop HallucinationBackdrop) | |
integer | HasHallucination () |
UpdateStrangeAttractor (Vector Position) | |
Ambush & | GetAmbush () |
Fadein (float Speed) | |
Fadeout (float Speed, FadeoutTarget Target) | |
Public Attributes | |
integer | BossRushParTime |
Number of frames of game time. More... | |
integer | BlueWombParTime |
const Vector & | ScreenShakeOffset |
Challenge | Challenge |
const Difficulty | Difficulty |
integer | TimeCounter |
same as FrameCounter but can be modified, mostly used for timed events (bossrush, daily, ...) and not for timestepping More... | |
Game::AddDevilRoomDeal | ( | ) |
Game::AddEncounteredBoss | ( | EntityType | Boss, |
integer | Variant | ||
) |
Game::AddPixelation | ( | integer | Duration | ) |
Triggers the effect of the "retro vision" pill.
Game::AddStageWithoutDamage | ( | ) |
Increases the ingame counter, that keeps track of the stages you cleared without taking damage. (useful for Devil deal manipulations)
Game::AddStageWithoutHeartsPicked | ( | ) |
Increases the ingame counter, that keeps track of stages you cleared without picking up hearts.
Game::AddTreasureRoomsVisited | ( | ) |
Game::BombDamage | ( | Vector | Position, |
float | Damage, | ||
float | Radius, | ||
boolean | LineCheck, | ||
Entity | Source, | ||
integer | TearFlags, | ||
integer | DamageFlags, | ||
boolean | DamageSource | ||
) |
Game::BombExplosionEffects | ( | Vector | Position, |
float | Damage, | ||
integer | TearFlags, | ||
Color | Color, | ||
Entity | Source, | ||
float | RadiusMult, | ||
boolean | LineCheck, | ||
boolean | DamageSource | ||
) |
The complete bomb explosion package: Do damage, spawn boomgraphics, and apply tearflag-based effects.
Does bomb-exclusive special effects.
Game::ChangeRoom | ( | integer | RoomIndex | ) |
Game::ClearDonationModAngel | ( | ) |
Game::ClearDonationModGreed | ( | ) |
Game::ClearStagesWithoutDamage | ( | ) |
Sets the counter for stages cleared without damage to 0.
Game::ClearStagesWithoutHeartsPicked | ( | ) |
Sets the counter for stages cleared without picking up hearts to 0.
Game::Darken | ( | float | Darkness, |
integer | Timeout | ||
) |
Game::DonateAngel | ( | integer | Donate | ) |
Game::DonateGreed | ( | integer | Donate | ) |
Game::End | ( | Ending | Ending | ) |
remove entity from the update list (render only) void EnableEntity(Entity* e); add entity back to the update list (update + render) void DisableEntity(Entity* e);
Game::Fadein | ( | float | Speed | ) |
Game::Fadeout | ( | float | Speed, |
FadeoutTarget | Target | ||
) |
Game::FinishChallenge | ( | ) |
Ambush& Game::GetAmbush | ( | ) |
float Game::GetDarknessModifier | ( | ) |
integer Game::GetDevilRoomDeals | ( | ) |
integer Game::GetDonationModAngel | ( | ) |
Get the value that indicates the angel-counter of a shop-donation maschine. This Stat increases everytime you donate to a shop. A higher number grants a few advantages.
integer Game::GetDonationModGreed | ( | ) |
Font& Game::GetFont | ( | ) |
integer Game::GetFrameCount | ( | ) |
Returns the number of frames the gameplay is actively running. Pauses are therefore not included!
1 second equals 30 frames.
This function therefore works drastically different than Isaac.GetFrameCount()
local curTime = Game():GetFrameCount()
local msecs= curTime%30 * (10/3) -- turns the millisecond value range from [0 to 30] to [0 to 100]
local secs= math.floor(curTime/30)%60
local mins= math.floor(curTime/30/60)%60
local hours= math.floor(curTime/30/60/60)%60
integer Game::GetGreedBossWaveNum | ( | ) |
integer Game::GetGreedWavesNum | ( | ) |
History& Game::GetItemHistory | ( | ) |
ItemOverlay& Game::GetItemOverlay | ( | ) |
ItemPool& Game::GetItemPool | ( | ) |
LevelStage (UserData) Game::GetLastDevilRoomStage | ( | ) |
Since it returns UserData, this function is unusable and therefore broken.
LevelStage Game::GetLastLevelWithDamage | ( | ) |
LevelStage Game::GetLastLevelWithoutHalfHp | ( | ) |
Level& Game::GetLevel | ( | ) |
EntityPlayer& Game::GetNearestPlayer | ( | Vector | Pos | ) |
integer Game::GetNumEncounteredBosses | ( | ) |
integer Game::GetNumPlayers | ( | ) |
EntityPlayer& Game::GetPlayer | ( | integer | Index | ) |
EntityPlayer& Game::GetRandomPlayer | ( | Vector | Pos, |
float | Radius | ||
) |
Room& Game::GetRoom | ( | ) |
const integer& Game::GetScreenShakeCountdown | ( | ) |
Seeds& Game::GetSeeds | ( | ) |
integer Game::GetStagesWithoutDamage | ( | ) |
integer Game::GetStagesWithoutHeartsPicked | ( | ) |
boolean Game::GetStateFlag | ( | StateFlag | StateFlag | ) |
float Game::GetTargetDarkness | ( | ) |
integer Game::GetTreasureRoomVisitCount | ( | ) |
integer Game::GetVictoryLap | ( | ) |
boolean Game::HasEncounteredBoss | ( | EntityType | Boss, |
integer | Variant | ||
) |
integer Game::HasHallucination | ( | ) |
boolean Game::IsGreedMode | ( | ) |
boolean Game::IsPaused | ( | ) |
Returns true, if the game is in a state, where the player is unable to input any thing or the game logic is paused. This includes hiving the pause menu opened, being in room transitions/cutscenes or while displaying a "big book" animation.
Game::MoveToRandomRoom | ( | boolean | IAmErrorRoom, |
integer | Seed | ||
) |
Game::NextVictoryLap | ( | ) |
Game::Render | ( | ) |
boolean Game::RerollEnemy | ( | Entity | e | ) |
Game::RerollLevelCollectibles | ( | ) |
Game::RerollLevelPickups | ( | integer | Seed | ) |
Game::SetLastDevilRoomStage | ( | LevelStage | Stage | ) |
Game::SetLastLevelWithDamage | ( | LevelStage | Stage | ) |
Game::SetLastLevelWithoutHalfHp | ( | LevelStage | Stage | ) |
Game::SetStateFlag | ( | StateFlag | StateFlag, |
boolean | Val | ||
) |
Game::ShakeScreen | ( | integer | Timeout | ) |
Game::ShowFortune | ( | ) |
Game::ShowHallucination | ( | integer | FrameCount, |
Backdrop::Backdrop | HallucinationBackdrop | ||
) |
Plays the Delirium animation (Static noise intersected with past gameplay fotage), which will also change the background of the current room.
This function does not work and will crash your game on use!
local usagetime = -1 -- stores the last time the effect was called.
-- call this function to play the Hallucination effect
function playHallucination()
local player = Isaac.GetPlayer(0)
usagetime = Game().TimeCounter
player:UseActiveItem(510, false, false, false, false) -- use the delirious item without applying the costume
player:GetEffects():RemoveCollectibleEffect(510) -- remove any unwanted side effects of the item usage
end
-- Removes all spawned NPC entities when activating the function
function mod:onFriendlyInit(npc)
if Game().TimeCounter-usagetime == 0 then -- only remove enemies that spawned when the effect was called!
npc:Remove()
end
end
mod:AddCallback(ModCallbacks.MC_POST_NPC_INIT, mod.onFriendlyInit)
Game::ShowRule | ( | ) |
Entity& Game::Spawn | ( | EntityType | Type, |
integer | Variant, | ||
Vector | Position, | ||
Vector | Velocity, | ||
Entity | Spawner, | ||
integer | SubType, | ||
integer | Seed | ||
) |
The game has two spawn functions, Game():Spawn() (this one) and Isaac.Spawn(). If you need to spawn something with a specific seed, then you use Game():Spawn(). If you need to spawn something with a randomly generated seed, then use Isaac.Spawn(). Most of the time, you will probably want to use Isaac.Spawn().
Game():Spawn(
EntityType.ENTITY_LEECH, -- Type
0, -- Variant
Game():GetRoom():GetCenterPos(), -- Position
Vector(0, 0), -- Velocity
nil, -- Parent
0, -- SubType
Game():GetRoom():GetSpawnSeed() -- Seed (the "GetSpawnSeed()" function gets a reproducible seed based on the room, e.g. "2496979501")
)
Game::SpawnParticles | ( | Vector | Pos, |
EntityEffect::Variant | ParticleType, | ||
integer | NumParticles, | ||
float | Speed, | ||
Color | Color, | ||
float | Height | ||
) |
Game::StartRoomTransition | ( | integer | RoomIndex, |
Direction | Direction, | ||
RoomTransition::Animation | Animation | ||
) |
Game::StartStageTransition | ( | boolean | SameStage, |
StageTransition::Animation | Animation | ||
) |
Starts a transition animation like it`s playing when entering a trapdoor to switch between stages.
Stage Transition types:
Game::Update | ( | ) |
Game::UpdateStrangeAttractor | ( | Vector | Position | ) |
integer Game::BlueWombParTime |
integer Game::BossRushParTime |
Number of frames of game time.
Challenge Game::Challenge |
const Difficulty Game::Difficulty |
const Vector& Game::ScreenShakeOffset |
integer Game::TimeCounter |
same as FrameCounter but can be modified, mostly used for timed events (bossrush, daily, ...) and not for timestepping