PDA

View Full Version : Utility Script #1 Progress Checker



HeroOfFire
06-10-2007, 06:29 PM
I've made a bunch of Utility Scripts for quests. All have been last tested in Build 364.
Update: Last Tested In Build 478.

Script #1 Progress Checker

It checks for a requirement and changes all of one combo into another if the requirement is met.


//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 ProgressChecker
//Script that tests to see if Link meets certain requirements
//If Link meets the requirement or activates the combo, all combos
//of one type are replaced by another combo
//It runs once unless it waits for activation
//Best Use: Replacing Trigger Enemies to Simulate Side Quests
//You can even have more than one per screen!
//Also not DMap Dependant! Another Plus!!!
//Can be used with other FFCs if set to Activation Requirement
//D0 = FFC Number (starts at 1)
//D1 = Requirement Type. 0 = Specific Item, 1 = Total Hearts, 2 = Total Magic, 3 = Slash, AnyOther = Activation
//D2 = Trigger value of requirement. Either item number, total hearts, or total magic
//This does not need to be set if combo is Slash Requirement or activated (Activation Requirement Type)
//D3 = The number of the combo that gets replaced
//D4 = The number of the new combo that replaces the old one
ffc script ProgressChecker {

void ChangeCombos(int tc, int nc) {
int cTile;
for (cTile = 0; cTile < 176; cTile++)
{
if (Screen->ComboD[cTile] == tc)
{
Screen->ComboD[cTile] = nc;
}
}
}
void run(float thisFFC, int triggerType, int triggerValue, int targetCombo, int newCombo) {
ffc this1 = Screen->LoadFFC(thisFFC);
while (true)
{
if (triggerType == 0)
{
if (Link->Item[triggerValue])
{
ChangeCombos(targetCombo, newCombo);
}
Quit();
}
else if (triggerType == 1)
{
if (Link->MaxHP >= triggerValue)
{
ChangeCombos(targetCombo, newCombo);
}
Quit();
}
else if (triggerType == 2)
{
if (Link->MaxMP >= triggerValue)
{
ChangeCombos(targetCombo, newCombo);
}
Quit();
}
else if (triggerType == 3)
{
if (Game->Generic[GEN_CANSLASH] == 1)
{
ChangeCombos(targetCombo, newCombo);
}
Quit();
}
else if (this1->CSet == 0)
{
ChangeCombos(targetCombo, newCombo);
this1->Data = 0;
Quit();
}
Waitframe();
}
}
}

For a quick overview:
This script has 5 parameters.
The first is the number of the FFC (the workaround for the this->bug).
The second is the kind of progress the script is checking.
0: Link has specific item.
1: Link has a number of hearts
2: Link has an amount of magic
Other: Link has activated the FFC (set its CSet to 0)
The third is the value of the progress.
This is either the item number or the amount of max life/max magic.
The fourth is the combo # you want to replace.
The fifth is the combo # you will be replacing the other combo with.

Basic Uses:
Change walkable combos into stair or pit combos and vice-versa.
Swap unwalkable combos for walkable combos and vice-versa.
Simply change walkable combos into other walkable combos that are used as a clue for puzzles.

Cool Things:
You can have many FFCs using this script per screen. That means one screen could change multiple times over a quest based on what each FFC is checking for.
The lens of truth cannot pick up these changes. You can hide secrets from the crafty player.
Enemies and secret combos are unneccessary! You can have the script test for an item while Link can kill all the enemies to activate the normal secrets.
DMap independent! No more needing extra DMaps so you can use those trigger enemies in boss rooms!
If combined with another script that changes its CSet to 0, you can use the activation requirement without needing the FFC to have a flag.
You can have multiple of these scripts looking for the exact same thing. Perhaps you want to raise all the red walls and lower all the blue ones when Link has a 'dummy' item of some sort in his inventory. Just have two FFCs checking for the same item.

Potential Applications:
Link can't get to the screen with the Magic Sword unless he has the White Sword.
Link can't get to the screen with the White Sword unless he has enough life.
Link can't get stuck because he lacks an item (for example, Link can't enter the room with Gannon unless he has the silver arrow).
Link can't attempt a trial without enough life (just like a cave in Majora's Mask).
Link can't progress unless he can read the ancient text by having the magic book (Link would normally get warped to a screen where an invisible guy gives you unreadable text. If he has the book, Link instead warps to a different screen where he 'reads' the text and the path is opened, just like in LTTP).

Update Complete: Script can now check if Link has the slash ability. Good if you want Link to have the slash ability before the spin attack.

Hot Water Music
06-10-2007, 07:38 PM
what would I need to do to mod the script so that it'll trigger all the secret combos instead of replacing a specific combo with another?

HeroOfFire
06-10-2007, 08:06 PM
Unless ZScript has a command to trigger secret combos, there is no direct way to do that.

However, the combo you create could have a flag or be the trigger type (the kind you step on) to activate all the secret combos. You could even go as far as changing most of the floor into trigger types (which would look identical) so as soon as Link takes a step, he activates the secret combos.

I could also mod the script to give Link a kill-all item when it runs, but then you would be limited to trigger enemies and the enemies->secret flag (unless you want all the enemies to go kaput whenever you enter the room).

Russ
11-19-2007, 04:55 PM
Okay, you probably already answered this question, but I am asking it anyways. If I have this script on the same screen as the password script, will this one activate when I enter the password to the password script? I'm just trying to do something simple (you enter the password and the door opens).

BTW sorry for the HUGE bumb.

HeroOfFire
11-19-2007, 07:20 PM
The password script requires you to designate which FFC to 'activate'. So yes, all you have to do is tell the password FFC to activate this script's FFC and set this FFC's requirement type to activation (simply set D1 to anything greater than 3). Oh, and make sure the FFC with this script is not CSet 0 by default.

Just one thing. If your door is one combo, this will be all you need. If the door is more than one combo you need to change, then it gets a little tricky. You would need to use my FFCInterface to trigger multiple of these FFCs at once. Or you could place trigger combos hidden below layer 1 and use secret combos.

Once I get a good sample quest to show off all my scripts (including some not yet posted because I'm refining them), I'll post it. I'll try to show as many of these uses as possible so they are easy to understand and use.

Russ
11-20-2007, 01:42 AM
I'm having trouble with this script. I set it so that it reacts when Link has fourteen hearts, and when he does, it make the top of the screen walkable so Link can get to the next screen. Problem: the top of the screen changes even if Link lacks fourteen hearts. Possible problem: I have a string in the same room. Could this be causing the problem?

Edit: Never mind. I am such an idiot. Since a freeform combo goes away if you don't set it's combo, I just choose a random transparent tile. It was set to cset 0. So the script thought it had been activated.

Edit again; Wait, it still doesn't work. "The first is the number of the FFC (the workaround for the this->bug)." This means just to enter the number of the freeform combo the script is attached to, right?