PDA

View Full Version : Utility Script #2 FFC Interface



HeroOfFire
06-10-2007, 06:46 PM
Here is another useful utility script I made. Last used in build 364.
Update: Last Tested In build 478.

Script # 2: FFC Interface

This script activates multiple other scripts upon activation. This activation includes collision with Link or a specified FFC.


//Various Scripts, by HeroOfFire

//NOTE: When I say activation of a script, I mean setting its CSet to 0.
//This is how I tell a script its been activated, triggered, etc.

import "std.zh"

//FFC Script FFCInterface
//Script that creates an interface between FFCs
//Activates other FFCs; can activate more than one
//Can be triggered by collision with another FFC or Link
//Only activates other FFCs when activated
//D0 = FFC Number (starts at 1)
//D1 = Special Trigger type of the interface. 0 = None. 1 = FFC Collision. 2 = Link Collision. 3 = Check Other FFC
//Note: Link does not collide unless if on ground
//D2 = The Target Trigger if the special trigger is FFC collision or Check Other FFC
//D3 = The first FFC to be activated
//D4 = The additional number of consecutive FFCs to be activated
ffc script FFCInterface {

void run(float thisFFC, int triggerType, int targetTrigger, int targetFFC, int extraTargets) {
ffc this1 = Screen->LoadFFC(thisFFC);
int inc;
ffc thisTrig;
ffc actFFC;
if (triggerType == 1 || triggerType == 3)
{
thisTrig = Screen->LoadFFC(targetTrigger);
}
while (true)
{
if (triggerType == 1)
{
if (Abs(thisTrig->X - this1->X) < 3 && Abs(thisTrig->Y - this1->Y) < 3)
{
this1->CSet = 0;
}
}
if (triggerType == 2)
{
if (Abs(Link->X - this1->X) < 2 && Abs(Link->Y - this1->Y) < 2 && Link->Z < 1)
{
this1->CSet = 0;
}
}
if (triggerType == 3)
{
if (thisTrig->CSet == 0)
{
this1->CSet = 0;
}
}
if (this1->CSet == 0)
{
for (inc = targetFFC; inc < targetFFC + extraTargets + 1; inc++)
{
actFFC = Screen->LoadFFC(inc);
actFFC->CSet = 0;
}
this1->Data = 0;
Quit();
}
Waitframe();
}
}
}

Quick Overview:
This script has 5 parameters.
The first is the number of the FFC.
The second is what activates the FFC
0: No special activation.
1: Collides with a specific FFC.
2: Collides with Link (or Link steps on it, depending on how you look at it).
The third is the trigger FFC for the FFC collision (if FFC collision is used).
The fourth is the target FFC that will be activated when this FFC is activated.
The fifth is the number of extra consecutive FFCs that will also be activated.
Key Note: Emphasis on consecutive. If you have 3 for the number of extra activations, then the target FFC and the next 3 will be activated.

Basic Use:
If triggered, multiple FFCs can be triggered that frame.
This simulates floor buttons without using secret combos.
Almost useless unless you use other scripts that check for activation (such as my other utility scripts).

Cool Things:
When combined with my Utility Script #1, you can potentially have a whole new set of secret combos (restricted to layer one however).
You could have a FFC NPC that moves over this FFC and triggers it.
If you want, you could have this FFC be triggered by secret combos. Just set it to no special activation: it still activates if its CSet becomes 0.

Update Completed: Interface can now wait until another FFC has been activated to activate.
Update Completed: Collision with other FFCs improved.
Update Completed: Link will not activate this FFC if in the air (just like a button you can jump over).