Hero#
Inherits: sprite
Contains functions and variables related to the playable hero character.
Access with Hero->
.
Variables#
int |
|
int |
|
int |
|
int |
|
int |
|
int |
|
int |
|
int |
|
int |
|
int |
|
bool[] |
|
int[] |
|
int |
|
int |
|
int |
|
int |
|
bool |
|
bool |
|
bool |
|
int[] |
|
untyped[] |
|
const int |
|
const int |
|
int |
|
bool |
|
int |
|
int |
|
int |
|
int |
|
int |
|
int |
|
bool |
|
int |
|
int |
|
int |
|
int |
|
bool |
|
bool |
|
bool |
|
int |
|
const int |
|
int |
|
bool |
|
int |
|
const bool |
|
int |
|
int |
|
int |
|
int |
|
const int |
|
const int |
|
int |
|
const bool |
|
int |
|
int |
|
int |
|
int |
|
int |
|
bool[] |
|
int |
|
int |
|
int |
|
const int |
|
const int |
|
const int |
|
int |
|
int |
|
int |
|
int |
|
int |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
int |
|
int |
|
int |
|
int |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
bool |
|
const int |
|
int |
Functions#
void |
Warp(int DMap, int screen) |
void |
WarpEx(int[] ptr) |
void |
Explode(int arg1) |
void |
PitWarp(int arg1, int arg2) |
void |
SelectAWeapon(int dir) |
void |
SelectBWeapon(int dir) |
void |
SelectXWeapon(int dir) |
void |
SelectYWeapon(int dir) |
bool |
SwitchCombo(int pos, int effect) |
void |
Kill(bool bypass_revive = |
bool |
MoveXY(int dx, int dy, bool is_knockback = |
bool |
CanMoveXY(int dx, int dy, bool is_knockback = |
bool |
MoveAtAngle(int degrees, int pixels, bool is_knockback = |
bool |
CanMoveAtAngle(int degrees, int pxamnt, bool is_knockback = |
bool |
Move(int dir, int pixels, bool is_knockback = |
bool |
CanMove(int dir, int pxamnt, bool is_knockback = |
void |
LiftWeapon(lweapon arg1, int arg2, int arg3) |
bool |
|
void |
Warp(int arg1) |
void |
SetItemA(int arg1) |
void |
SetItemB(int arg1) |
void |
SetItemSlot(int itm_id, int button, int force) |
int |
GetOriginalTile(int arg1, int arg2) |
int |
GetOriginalFlip(int arg1, int arg2) |
Enumerations#
HeroSliding SLD_NONE = 0
HeroSliding SLD_ICE = 1
sliding on the ground, on ice
HeroSliding SLD_AIR = 2
sliding in the air (momentum from ice)
HeroSliding SLD_MAX = 3
Variable descriptions#
The current *total* Hero Tile Modifier.
Reading from, or writing to this array no longer causes lag.
The number of pixels that the Hero moves in a frame, based on present coordinates. The movement is taken from X and Y:
The default values are: { 1, 1, 2, 1, 1, 2, 1, 1 }
You can double the speed by doubling these values.
NOTE: This only affects 4-way movement, and has no effect if the quest
rule New Hero Movement
is enabled.
The rate the Hero moves at. This is similar to npc::Step: a step of 100 moves the Hero 1 pixel per frame. The default step rate is 150, which moves the Hero 1.5 pixels per frame.
NOTE: This affects BOTH 4-way and 8-way movement, but ONLY if the quest
rule New Hero Movement
is enabled.
The offset from corners that the Heroโs movement will โshoveโ them around. Ranges from 0-16
NOTE: Only applies if Newer Hero Movement
Quest Rule is enabled.
The timer for the health beep sound, if it is not constant.
Setting this to -2 suspends system control over stopping the sound, and setting this to -4 suspends system control over both stopping, and starting it.
The normal operating range used by the system is 70 to -1, where -1 wraps around to zero internally.
bool NoStepForward ๐ Source
If set true, the Hero will not take two steps into NES dungeon rooms.
This value is reset to false every time that the hero sprite is initialised, so should be written ideally in the hero init script.
!! Future versions may change when this is cleared.
bool CollDetection ๐ Source
Unused at this time.
Stores the ID/UIDs of objects that hurt the Link this frame.
This returns how long Link will remain invincible, 0 if not invincible. Can be set.
If set false, Link will neither flash, nor flicker when invincible.
The sound that plays when Link is injured. By default this is 16
, but
you may change it at any time.
Contains the item IDs of what is currently equiped to Linkโs B button.
Contains the item IDs of what is currently equiped to Linkโs A button.
Contains the item IDs of what is currently equiped to Linkโs X (Ex1) button.
Contains the item IDs of what is currently equiped to Linkโs Y (Ex2) button.
Returns 0 if the Hero is not eaten, otherwise it returns the duration of them being eaten.
Returns if the Hero is grabbed (i.e. by wallmaster)
Returns the number of frames for which Link will; remain stunned.
Writing to this causes Link to be stunned for โnโ frames.
This decrements once per frame.
Returns the number of frames for which the Hero will be a Bunny.
If -1, the effect will be removed by the engine if the current
dmap does not have the bunny flag, or the Hero possesses a pearl item.
-2 through -99 reserved for potential future engine use If <-100, the effect will last until script-modified
If >0, will tick down each frame
Returns the number of frames that Link has been pushing against a solid object.
This corresponds to whether โDiagonal Movementโ is enabled, or not.
This corresponds to whether โBig Hitboxโ is enabled, or not.
Returns as โtrueโ when the hero is climbing a sideview ladder
Setting to โfalseโ will let go of the ladder, and setting โtrueโ will grab the ladder
While โtrueโ, gravity does not affect the hero
Returns the number of times the hero has jumped in mid-air since last landing.
If this is positive, it will be reset to 0 the next frame the hero is on the ground.
Used by Rocโs Feather items to determine how many extra jumps the hero has left
const int PitPullDir ๐ Source
Returns the direction that the Hero is being pulled in by a pit
A timer related to pits pulling the hero
The pit will only pull the hero on frames where โPitPullTimer % PitSensitivity == 0โ
The Pit Sensitivity is an attribyte on the pit combo
Returns true if a stopwatch/clock is active.
Writing to this acts like picking up a stopwatch/clock item, and sets the duration of its effect based on ClockTimer. If ClockTimer is 0, the effect.
Lasts until the Hero changes screens.
Returns the current ticks of a stopwatch/clock item countdown timer.
Writing to this while ClockActive is true sets or changes the duration
of the clock effect; if no stopwatch/clock is active, it pre-sets the
value so that you may start a timed effect by setting ClockActive to
true
.
const bool IsWarping ๐ Source
Returns true if the Hero is currently being warped
Note that as scripts generally do not run in warps, this may not ever return true during a given warp, depending on the warp type, QRs, script type, etc.
The X-coordinate at which the Hero will respawn upon drowning or such.
The engine may overwrite this value upon changing screens or standing on safe ground.
The Y-coordinate at which the Hero will respawn upon drowning or such.
The engine may overwrite this value upon changing screens or standing on safe ground.
The DMap at which the Hero will respawn upon drowning or such.
The engine may overwrite this value upon changing screens or standing on safe ground.
The screen at which the Hero will respawn upon drowning or such.
The engine may overwrite this value upon changing screens or standing on safe ground.
const int SwitchTimer ๐ Source
The timer for the switchhook effect. If > 0, a switch effect is active.
The Hero will swap positions with the target when this is equal to
Hero->SwitchMaxTimer / 2
, and the animation completes when this reaches
0.
const int SwitchMaxTimer ๐ Source
The starting (max) value of the switch timer.
If non-zero, the Hero will not die, even if their HP drops to 0.
This will prevent effects such as bottled fairies from being triggered.
If greater than 0, decrements by 1 each frame.
If it becomes 0 while the Hero has 0 hp, it will act as though their HP just dropped to 0 that frame, and normal effects such as fairies will trigger.
const bool Standing ๐ Source
Returns true if the hero is โstandingโ, as is used to check if they are capable of jumping. Automatically accounts for sideview.
The number of frames the hero has been off the ground. Range 0-65535.
0 while standing. When not standing, ticks up by 1 each frame.
When jumping, is immediately set to 65535.
If this value is < 65535 and < a featherโs โCoyote Timeโ attribute, the feather will be able to jump despite being in the air.
Setting this to 65535 will disable coyote jumps, though this will be set to 0 upon landing on the ground again.
lweapon LiftedWeapon ๐ Source
Returns a value representing the current hammer swing. - 0 = not swinging hammer - 1 = hammer above head - 2 = hammer at angle - 3 = hammer hit the ground
The time, in frames, that the shield is disabled. Negative values disable indefinitely.
This sets what color Link is drawn when flickering.
If -1, will use the default from Init Data.
If the quest rule โInvincible Hero Flickersโ is unchecked, this is unused.
int FlickerTransparencyPasses ๐ Source
This sets how many times the transparency effect is applied to Linkโs flicker effect.
If -1, will use the default from Init Data. If 0, will use a solid color.
If the quest rule โInvincible Hero Flickersโ is unchecked, this is unused.
const int FlashingCSet ๐ Source
This returns Linkโs current displayed cset when taking damage or invincible. If not in one of these states, will return his normal cset.
If called before Waitdraw() / Hero update, results may be off by a frame.
If the quest rule โInvincible Hero Flickersโ is checked, this is unused.
Valid values: HeroSliding (SLD_
).
const int IceCombo ๐ Source
The icy combo the Hero is sliding on.
int ScriptIceCombo ๐ Source
Read-write. If nonzero, this combo is used instead of the IceCombo (can be used to force the Hero to slide).
If the specified combo is not an Icy Floor combo that affects the Hero, no sliding will occur.
The Heroโs ice velocity (in pixels per frame).
Has no effect unless the Hero is Sliding.
If the Hero is not Sliding, the engine will clear these to 0
.
The Heroโs ice velocity (in pixels per frame).
Has no effect unless the Hero is Sliding.
If the Hero is not Sliding, the engine will clear these to 0
.
int IceEntryFrames ๐ Source
Read/write, 0-255, has no effect unless the Hero is Sliding.
Used to grant the Hero some leeway when first entering the ice.
On entering the ice, these are set to the same value, and โIceEntryFramesโ then ticks down each frame to 0. Instantly goes to 0 if the Hero is still.
Based on the ratio between these values, the Heroโs deceleration will be somewhere between the IceComboโs deceleration and half of the Heroโs step speed.
int IceEntryMaxFrames ๐ Source
Read/write, 0-255, has no effect unless the Hero is Sliding.
Used to grant the Hero some leeway when first entering the ice.
On entering the ice, these are set to the same value, and โIceEntryFramesโ then ticks down each frame to 0. Instantly goes to 0 if the Hero is still.
Based on the ratio between these values, the Heroโs deceleration will be somewhere between the IceComboโs deceleration and half of the Heroโs step speed.
bool InputAxisDown ๐ Source
bool InputAxisLeft ๐ Source
bool InputAxisRight ๐ Source
bool PressAxisDown ๐ Source
bool PressAxisLeft ๐ Source
bool PressAxisRight ๐ Source
const int TotalDYOffset ๐ Source
Link->Equipment is now read-write, and needs testing.
Function descriptions#
void Warp(int DMap, int screen) ๐ Source
Warps link to the given screen in the given DMap, just like if heโd triggered an โInsta-Warpโ-type warp.
Uses warp return square A, unless compat rule Old 'Hero->Warp' Return Square
is on, in which case it uses the warp return square of the
current screenโs Sidewarp A.
void WarpEx(int[] ptr) ๐ Source
void Explode(int arg1) ๐ Source
void PitWarp(int arg1, int arg2) ๐ Source
void SelectAWeapon(int dir) ๐ Source
Changes the A button item (respectively), in the same manner the engine subscreen cursor moves. DIR_RIGHT/DIR_LEFT are equivalent to how quickswap cycles.
Does nothing if the QR allowing items to be set for that button is not enabled.
void SelectBWeapon(int dir) ๐ Source
Changes the B button item (respectively), in the same manner the engine subscreen cursor moves. DIR_RIGHT/DIR_LEFT are equivalent to how quickswap cycles.
void SelectXWeapon(int dir) ๐ Source
Changes the X button item (respectively), in the same manner the engine subscreen cursor moves. DIR_RIGHT/DIR_LEFT are equivalent to how quickswap cycles.
Does nothing if the QR allowing items to be set for that button is not enabled.
void SelectYWeapon(int dir) ๐ Source
Changes the Y button item (respectively), in the same manner the engine subscreen cursor moves. DIR_RIGHT/DIR_LEFT are equivalent to how quickswap cycles.
Does nothing if the QR allowing items to be set for that button is not enabled.
bool SwitchCombo(int pos, int effect) ๐ Source
Switch the Hero with the given combo position. Returns true if successful.
Valid values for effect
: SwitchEffect (SW_EFF_
).
void Kill(bool bypass_revive = false
) ๐ Source
Kills the Hero. Their HP will be set to 0, and โImmortalโ will be bypassed.
If โbypass_reviveโ is true, bottles will not be checked for revival items, and the normal single frame delay before death that is used for script-revival will also be skipped.
Otherwise, revival processes will occur as normal.
bool MoveXY(int dx, int dy, bool is_knockback = false
, bool ignore_sideview = false
, bool corner_shove = true
) ๐ Source
Attempts to move the Hero by โdx, dyโ; obeying solidity.
is_knockback
should be true if this movement is the result of some
scripted form of knockback.
This currently has no effect for the Heroโฆ It may in the future?
โignore_sideviewโ: if this is false, and the current screen is sideview gravity, โdyโ will be ignored (unless the Hero is โClimbingโ, has walk-through-walls enabled, or is sideview swimming)
corner_shove
: if this is true, and the movement is not diagonal (i.e.
one of dx or dy is 0
), then if the movement pushes the Hero into the
corner of a solid, the Hero will automatically be shoved โaroundโ the
corner. (Same as how engine movement does it)
Returns true if the full distance was moved, false otherwise.
bool CanMoveXY(int dx, int dy, bool is_knockback = false
, bool ignore_sideview = false
, bool corner_shove = true
) ๐ Source
Same as MoveXY(), but does not move the Hero- instead, just returns true/false based on what MoveXY() would return.
bool MoveAtAngle(int degrees, int pixels, bool is_knockback = false
, bool ignore_sideview = false
, bool corner_shove = true
) ๐ Source
Like MoveXY(), but for a pixels
movement in the degrees
angle.
bool CanMoveAtAngle(int degrees, int pxamnt, bool is_knockback = false
, bool ignore_sideview = false
, bool corner_shove = true
) ๐ Source
Like MoveAtAngle(), but does not move the Hero - instead, just returns true/false based on what MoveAtAngle() would return.
bool Move(int dir, int pixels, bool is_knockback = false
, bool ignore_sideview = false
, bool corner_shove = true
) ๐ Source
Like MoveXY(), but for a pixels
movement in the dir
direction.
bool CanMove(int dir, int pxamnt, bool is_knockback = false
, bool ignore_sideview = false
, bool corner_shove = true
) ๐ Source
Like Move(), but does not move the Hero - instead, just returns true/false based on what Move() would return.
lweapon ReleaseLiftWeapon() ๐ Source
void LiftWeapon(lweapon arg1, int arg2, int arg3) ๐ Source
bool isFlickerFrame() ๐ Source
This returns true if the Hero is currently in a flicker frame (either invisible or color masked).
If called before Waitdraw() / Hero update, results may be off by a frame.
If the quest rule โInvincible Hero Flickersโ is unchecked, this is unused.
void Warp(int arg1) ๐ Source
void SetItemA(int arg1) ๐ Source
void SetItemB(int arg1) ๐ Source
void SetItemSlot(int itm_id, int button, int force) ๐ Source
This allows you to set Linkโs button items without binary operation with options for forcing them.
Use the constants ITM_REQUIRE_
and ITM_SLOT_
from <std> when passing
values into this function.
int GetOriginalTile(int arg1, int arg2) ๐ Source