Jump to content

Moosh's Pit Script

Overview
Creator: Moosh Updated: 24 Apr 2018 Tags: FFC, Global Downloads: 161
Rating[?]: Rating: 4.6/5 (4 ratings)
View Script Download Example
(1.49 MB)
Information

Description Setup Reviews Comments

Constants:
First, you'll want to set up all the constants in the script for your quest as follows:
  • CT_HOLELAVA: This is the combo type the pit script uses. By default it's No Ground Enemies. You probably don't need to change it, but if you have plans to use No Ground Enemies for something else, it's an option.
  • CF_LAVA: This is the flag that makes the pit behave as lava. Uses General Purpose 1 (Scripts) by default.
  • SPR_FALLHOLE: Sprite in weapons/misc for Link falling in a pit
  • SPR_FALLLAVA: Sprite in weapons/misc for Link falling in lava
  • DAMAGE_FALLHOLE: Damage from falling in a hole (16ths of a heart)
  • DAMAGE_FALLLAVA: Damage from falling in lava (16ths of a heart)
  • FFC_MOOSHPIT_AUTOWARPA: Set this to the number of an FFC that's not being used on any screen. Chances are you can leave it at 32.
  • CMB_MOOSHPIT_AUTOWARPA: Set this to the number of an invisible combo with the type set to Auto Side Warp [A].
  • SF_MISC_MOOSHPITWARP: This is the screen flag under the Misc section that makes pits warp you. If none of your other scripts use screen flags, you can leave it be. Otherwise, count from the top of the Misc section starting at 0.
  • MOOSHPIT_LINKHITBOXWIDTH, MOOSHPIT_LINKHITBOXHEIGHT: Width and height of Link's hitbox, which is centered on the bottom half of his tile. The whole hitbox needs to overlap the pit for him to fall in. Increase to make pits less sensitive.
  • MOOSHPIT_SIDEVIEW_LINKHITBOXWIDTH, MOOSHPIT_SIDEVIEW_LINKHITBOXHEIGHT: Same as above but for sideview. Here, the hitbox is centered on Link.
  • MOOSHPIT_MIN_FALL_TIME: Minimum delay after falling in a pit in frames (60ths of a second). This is a safety value to prevent Link repeatedly falling into pits and respawning. You can lower it if you really want fast pit falling.
  • MOOSHPIT_EXTRA_FALL_TIME: Extra frames (60ths of a second) after Link falls into a pit before he respawns.
  • MOOSHPIT_NO_GRID_SNAP: Set to 1 if you don't want Link's falling sprite to snap to the combo grid. This might look weird for most sprites with the default hitbox settings.
  • MOOSHPIT_ENABLE_SLIDEYPITS: Set to 1 if you want Link to slide into pits. This will only work with a lenient pit hitbox (I used 12x12 in testing)
  • MOOSHPIT_NO_MOVE_WHILE_FALLING: Set to 1 if you don't want Link to move while dropping from a higher floor.
  • MOOSHPIT_NO_REENTER_STAIRS: Set to 1 to prevent Link reentering stairs if he respawns on them. This uses an FFC script.
  • MOOSHPIT_STUN_ENEMIES_WHILE_FALLING: Set to 1 to stun enemies while the falling animations plays. This makes long fall animations more fair but may produce bugs and won't work with all enemies.
Global:
If this is your only global script, you can just use the included MooshPitGlobal script and be on your way. Otherwise, you'll have to combine it with your other scripts. Put MooshPit_Init(); somewhere between void run(){ and while(true){. Put MooshPit_Update(); somewhere between while(true){ and Waitdraw();. If there's no Waitdraw(); put it before Waitframe();.

Warps:
Screens where you want pits to warp Link down to a lower floor are marked with a screen flag in the Misc section. By default this is General Use 1 (Scripts). When this flag is set, pits will warp Link instead of dealing damage. The warp destination is set with Side Warp A. You cannot have more than one warp destination on one screen or damaging pits and warp pits on the same screen. Not that either of those situations would make sense anyways.

MooshPit_StairsFix:
This script is mostly just called by the global script to fix a bug with respawning on top of stairs, but ZC itself isn't always consistent about this behavior. If you find a spot where Link is kicked down stairs because of F6 or some other thing you can also just place the script manually.

This script requires std.zh and ffcscript.zh.