Jump to content

Photo

Picking up the item triggers secrets

FFC

  • Please log in to reply
4 replies to this topic

#1 Avataro

Avataro

    Quest maker

  • Members
  • Real Name:Robin
  • Gender:Male
  • Location:Germany

Posted 15 March 2014 - 06:57 AM

Picking up the item triggers secrets


Description

This script will trigger the screen secrets when there is no room item on the screen. Items dropped by enemies, bushes or other scripts, etc won't be counted. Only the item that you place on the screen manually matters. You can use this, for example, to open a path when the player picks up the key, or something like that. You can also define if it should play a sound effect or not.

Screenshots and Demo

N/A

Code

import "std.zh"

// D0 is the number for the sound effect to play. Leave at 0 if you don't want one.
ffc script SecretsTriggeredByItem{
    void run(int sfx){
        while(true){
            if ( Screen->State[ST_ITEM] && !Screen->State[ST_SECRET] ) {
                Game->PlaySound(sfx);
                Screen->TriggerSecrets();
                Screen->State[ST_SECRET] = true;
            }
            Waitframe();
        }
    }
}

Setup

Place an FFC with this script on a screen where you want to use it.
D0 is the number for the sound effect to play. If you want no sound effect playing, then leave it at 0.

Resources

std.zh (comes with downloading Zelda Classic)

#2 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Gender:Male
  • Location:Austria

Posted 27 March 2014 - 04:31 AM

Great idea! :D

Does this work with autowarps too? Because some scripts crash, when you use items and warp in the same screen.



#3 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris
  • Gender:Intersexed

Posted 27 March 2014 - 05:48 AM

Just as well, does this work with enemies dropping the room item, and the room item being in chests? Or when the item falls from the ceiling?



#4 MoscowModder

MoscowModder

    Still fighting the inevitable

  • Members
  • Gender:Male
  • Location:Wisconsin (WHAT)

Posted 27 March 2014 - 07:35 AM

I think those should all work, with the possible exception of the chests. It's worth a try.



#5 Alucard648

Alucard648

    Adept

  • Members
  • Gender:Male
  • Location:castle Dracula

Posted 27 March 2014 - 09:13 AM

Here are some of my more generalized screen state related scripts.

ffc script EnemySecret{ //Triggers secrets when specific enemy dies.
	//DO: Enemy Slot
	//D1: Set to anything > 0 for secret permanency.
	void run (int enemyslot, int perm){
		Waitframes(4); //Needed for ZC for initialize enemies
		npc trigger = Screen->LoadNPC(enemyslot); // Get a pointer for needed enemy
		while ( trigger->isValid()) Waitframe(); //Wait until enemy dies.
		Screen->TriggerSecrets(); // Trigger secrets
		Game->PlaySound(SFX_SECRET); //Play secret discovery jingle.
		if (perm>0) Screen->State[ST_SECRET]=true; //Set screen state to render secrets permanent.
	}
}

ffc script SecretKillAllEnemies{ //Kills all enemies when specific screen state is set.
	//D0: Screen State to check. Refer to stdConstants.zh for determining which number to set.
	void run(int state){
		Waitframes(4); // Needed to allow engine to initialize enemies
		while (!Screen->State[state]) Waitframe(); // Wait until desired screen state is set to true 
		for (int i; i<= Screen->NumNPCs(); i++){ // Kill all enemies on screen
			npc kill= Screen->LoadNPC(i);
			kill->HP=0;
		}
	}
}

ffc script ScreenStateTrigger{ // Triggers secrets when specific screen state is set
	//D0: Screen State to check. Refer to stdConstants.zh for determining which number to set.
	//D1: Set to 1 to render secrets permanent.
	//D2: Set Screen State to "false" on reentering for reusability (useful for 2.10-styled bosses).
	//    Any number > 0 activates this function.
	void run (int state, int perm, int falsestart){
		if (falsestart>0) Screen->State[state]=false; // Set the screen state to false if needed (like reusable ambush trap)
		while (!Screen->State[state]) Waitframe(); // Wait until screen state is set to true.
		Game->PlaySound(SFX_SECRET); //Trigger screen secrets, complete with all accessories.
		Screen->TriggerSecrets();
		if (perm>0) Screen->State[ST_SECRET]=true;
	}
}

I think those should all work, with the possible exception of the chests. It's worth a try.

Replace ST_ITEM with ST_SPECIALITEM to make that script work with treasure chest items.


  • Avataro likes this



Also tagged with one or more of these keywords: FFC

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users