Jump to content

Solid FFCs/Sideview Moving Platforms

Overview
Creator: Moosh Updated: 16 Feb 2019 Tags: FFC, Global Downloads: 54
Rating[?]: Rating: 4.33/5 (2 ratings)
View Script Download Example
(1.25 MB)
Information

Description Setup Reviews Comments

Constants:
First, set the following constants in the script file to match the settings you want for your quest:

Crush Settings:
All of these settings only apply if you're using the feature where FFCs pushing Link against each other or a solid wall can crush him. Skip them if you don't need that setting.
  • SPR_LINKCRUSH: The sprite used for Link getting crushed. This is an animated sprite and can have either two or 8 states. Tiles for different states should be laid out in rows going down from the starting tile.
  • SFX_LINKCRUSH: Sound when Link gets crushed.
  • SFX_ENEMYCRUSH: Sound when an enemy gets crushed.
  • DAMAGE_LINKCRUSH: How much HP getting crushed takes.
  • DELAY_CRUSH: Delay in addition to the crush animation's duration before Link respawns after being crushed.
Other Settings:
  • SOLIDOBJ_MAX: The max number of solid objects active at once. This should be at least 32, but if you're using other scripts with solid behavior you can expand it. If this number is changed, you should also change the size of the SolidObjects[] array to 12+SOLIDOBJ_MAX*8.
  • SOLIDOBJ_CRUSH_BEHAVIOR: Setting to enable crushing. If this is 0, Link can't be crushed. If this is 1, he'll be crushed and then teleport to the screen entrance. If this is 2, he'll be killed instantly. Hopefully if you're using setting 2, you'll use crushing objects sparingly.
  • SOLIDOBJ_CRUSH_REPOSITION: If crush behavior is 1, this will determine whether or not Link teleports back to the screen entrance. If 0, he'll stay where he was when he got crushed. If 1, he'll teleport. Obviously don't use setting 0 if you have crushing FFCs that will stay in the crushing position permanently.
  • SOLIDOBJ_COMPLEX_CRUSH_ANIM: If this is set to 1, the sprite set by SPR_LINKCRUSH will have 6 states based on how Link was crushed. Else it has two:
    • If 6 States: Wall Crush (North), Wall Crush (South), Wall Crush (West), Wall Crush (East), FFC Crush (Vertical), FFC Crush (Horizontal)
    • If 2 States: FFC Crush (Vertical), FFC Crush (Horizontal)
  • SOLIDOBJ_PUSH_NPC: If this is set to 1, enemies can be pushed around by solid FFCs. This is a somewhat buggy feature that some of the default enemy classes will not cooperate with. There's still a secondary toggle for individual FFCs, but leaving this as 0 disables it universally. I'm mainly leaving this in with the idea that scripters can expand on it.
  • SOLIDOBJ_CRUSH_SAFETY: This is a leniency setting for the crushing behavior. Link can be clipped this many pixels into an object before he gets crushed.
  • SOLIDOBJ_LINKXTRIM / SOLIDOBJ_LINKYTRIM: More leniency settings, but these two apply to all solid FFCs in relation to Link's hitbox. This many pixels will be trimmed off the left/right and top (in sideview) of Link's hitbox.
Global Script:
Next, combine the global script. I have two example global scripts included with this one instead of the usual one because this script should be combined with the LinkMovement global script in a certain order. The SolidObjects_ functions need to run before the LinkMovement_ ones in the loop. Positioning of ghost.zh shouldn't particularly matter.

FFC Scripts:
There are three FFC scripts included to make FFCs in your quest solid as well as having them behave as sideview platforms. An important note: If you're using especially fast moving platforms, change MAX_PUSH in LinkMovement.zh to accommodate for their top speeds. I set mine to 24.

Here's the arguments for each:

Solid_FFC
  • D0: Width of the FFC's hitbox
  • D1: Height of the FFC's hitbox
  • D2: X offset of the FFC's hitbox
  • D3: Y offset of the FFC's hitbox
  • D4: Set the FFC's flags by adding these numbers together:
    • 1 - The FFC is only solid on the top, for sideview platforms
    • 2 - The FFC will push enemies
  • D5: If >0, the FFC's movement will mirror that of another FFC. This works like the "Link to" drop-down in the FFC editor, except it properly obeys the target FFC's A.Delay.
  • D6: If >0, this specifies a combo that will disable the FFC's hitbox when it changes to it.
Moving_Platform_Circular
This script uses the FFC's Combo W and Combo H to determine the hitbox instead of D0-3 like the first one.
  • D0: Radius of the circular motion of the platform
  • D1: Starting angle of the platform
  • D2: Rotation speed of the platform
  • D3: Set the FFC's flags by adding these numbers together:
  • 1 - The FFC is only solid on the top, for sideview platforms
  • 2 - The FFC will push enemies
Moving_Platform_StepActivate
This script uses the FFC's Combo W and Combo H to determine the hitbox instead of D0-3 like the first one. The way the platform reacts once activated is set by X/Y Speed and Accel on the FFC.
  • D0: Set this to the number of frames the FFC should shake for before activating (0 for not shake animation).
  • D1: Set the FFC's flags by adding these numbers together:
  • 1 - The FFC is only solid on the top, for sideview platforms
  • 2 - The FFC will push enemies
The Feather Item Script:
Any Roc's Feather class items should have FeatherAction placed in their active script slots. If you're using a global script for a jump button or another Roc's Feather active script, consult your local Moosh or other available scripter to combine them. This should be a simple task in most cases.

For Scripters:
If you want your scripts to use this solid FFC behavior, there's a simple function you can call. The script is not limited to just making FFCs solid.
void SolidObjects_Add(int ID, int x, int y, int width, int height, int vX, int vY, int flags){
Here's what each of the arguments do:
  • ID: This is a number that should be unique to each platform object. IDs 1-32 are typically used by FFCs but you can use anything as long as it's unique from all other solid objects on the screen. Two of the same platform will produce glitchy behavior. If your object isn't a platform (lets Link jump off it, carries Link around based on its vX/vY) you can leave this at 0.
  • x,y: Pretty self explanatory, the coordinates for the top left corner of the collision box.
  • width,height: Width and height of the collision box
  • vX,vY: X and Y velocities of the collision box. If your object is a platform, this should be calculated based on difference in position each frame rather than how fast it's going. I had float imprecision issues when using direct velocity values. Even if the object isn't a platform, this is also used to determine if it can crush Link.
  • flags: The sum of binary flags for the object's extra behaviors. See SFFCF_ constants.
This script requires std.zh, LinkMovement.zh, and ghost.zh.