Jump to content

Photo

Multiple Whistle Triggers

whistle trigger secrets

  • Please log in to reply
2 replies to this topic

#1 Korben

Korben

    Junior

  • Members
  • Location:USA

Posted 28 May 2021 - 10:21 AM

Hello, I would like to request a script involving having to activate multiple whistle triggers on the screen and I'll try to give as much detail as to what I want to achieve as possible. Using ZC version 2.55, alpha 92, build 57. 

 

I want to have multiple combos on screen where you need to use the whistle while standing on the combo, and when you do, that specific whistle trigger combo changes to another combo. All of the screens that I would use this on would just change the combo to a combo with no flags and no type, this way the player can't just use the same whistle trigger combo multiple times, and also to give a visual that they already triggered that specific combo. The combos would be different from each other because some of them would have different tiles to look visually different. You then have to do the same (trigger a whistle combo) to every other whistle trigger combo on the screen before screen secret flags (16-31) are triggered. This would also be a temporary secrets trigger, so if you leave the screen and come back it would all be reset. I know you can set this by checking "secrets are temporary", but that might be possible to be overided by scripting so I wanted to make note of that. The whistle triggers don't have to be triggered in a specific order, but if you want to add that as an optional functionality I would try to utilize it, but for my purposes most of them should be able to be triggered in any order on each screen.

 

I tried to give as much detail as possible, sorry if I forgot anything. Thanks for reading.



#2 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 29 May 2021 - 11:39 PM

//D0: 0 - Each whistle combo is a secret, 1 - Only the final trigger triggers secrets, 2 - Only the final trigger triggers secrets and it's permanent
//D1: SFX to play when each trigger is hit
//D2: SFX to play when all triggers are hit
ffc script WhistleMultiTrigger{
	void run(int triggerAll, int sfxTriggerSingle, int sfxTriggerAll){
		int i;
		int pos;
		lweapon whistle;
		
		bool active[176];
		int numTriggers;
		
		for(i=0; i<176; ++i){
			if(Screen->ComboF[i]==CF_WHISTLE){
				Screen->ComboF[i] = 0;
				if(Screen->State[ST_SECRET])
					++Screen->ComboD[i];
				active[i] = true;
				++numTriggers;
			}
		}
		
		if(Screen->State[ST_SECRET])
			Quit();
		
		while(true){
			pos = ComboAt(Link->X+8, Link->Y+8);
			whistle = LoadLWeaponOf(LW_WHISTLE);
			if(whistle->isValid()){
				if(active[pos]){
					--numTriggers;
					if(numTriggers==0){
						Screen->TriggerSecrets();
						if(triggerAll==2)
							Screen->State[ST_SECRET] = true;
						Game->PlaySound(sfxTriggerAll);
					}
					else{
						if(!triggerAll)
							Screen->TriggerSecrets();
						Game->PlaySound(sfxTriggerSingle);
					}
					++Screen->ComboD[pos];
					active[pos] = false;
				}
			}
			Waitframe();
		}
	}
}

This should do the trick. Place flag 3 on your whistle combos as usual (placed flag, not inherent). When you use the whistle on them they'll advance forward one combo like a lock block. Set the arguments as follows:

  • D0: Changes how the triggers behave
    • 0: Every whistle spot triggers secrets
    • 1: Only the last one hit triggers secrets
    • 2: Only the last one hit triggers secrets and the secret is permanent
  • D1: The sound to play when individual whistle spots are hit
  • D2: The sound to play when the last whistle spot is hit

I'd also recommend using this simple whistle sound script and setting your whistle's sound to 0 so it doesn't hold you in place every time you use it.

item script WhistleSound{
	void run(int sfx){
		Game->PlaySound(sfx);
	}
}

  • Korben likes this

#3 Korben

Korben

    Junior

  • Members
  • Location:USA

Posted 30 May 2021 - 12:07 AM

//D0: 0 - Each whistle combo is a secret, 1 - Only the final trigger triggers secrets, 2 - Only the final trigger triggers secrets and it's permanent
//D1: SFX to play when each trigger is hit
//D2: SFX to play when all triggers are hit
ffc script WhistleMultiTrigger{
	void run(int triggerAll, int sfxTriggerSingle, int sfxTriggerAll){
		int i;
		int pos;
		lweapon whistle;
		
		bool active[176];
		int numTriggers;
		
		for(i=0; i<176; ++i){
			if(Screen->ComboF[i]==CF_WHISTLE){
				Screen->ComboF[i] = 0;
				if(Screen->State[ST_SECRET])
					++Screen->ComboD[i];
				active[i] = true;
				++numTriggers;
			}
		}
		
		if(Screen->State[ST_SECRET])
			Quit();
		
		while(true){
			pos = ComboAt(Link->X+8, Link->Y+8);
			whistle = LoadLWeaponOf(LW_WHISTLE);
			if(whistle->isValid()){
				if(active[pos]){
					--numTriggers;
					if(numTriggers==0){
						Screen->TriggerSecrets();
						if(triggerAll==2)
							Screen->State[ST_SECRET] = true;
						Game->PlaySound(sfxTriggerAll);
					}
					else{
						if(!triggerAll)
							Screen->TriggerSecrets();
						Game->PlaySound(sfxTriggerSingle);
					}
					++Screen->ComboD[pos];
					active[pos] = false;
				}
			}
			Waitframe();
		}
	}
}

This should do the trick. Place flag 3 on your whistle combos as usual (placed flag, not inherent). When you use the whistle on them they'll advance forward one combo like a lock block. Set the arguments as follows:

  • D0: Changes how the triggers behave
    • 0: Every whistle spot triggers secrets
    • 1: Only the last one hit triggers secrets
    • 2: Only the last one hit triggers secrets and the secret is permanent
  • D1: The sound to play when individual whistle spots are hit
  • D2: The sound to play when the last whistle spot is hit

I'd also recommend using this simple whistle sound script and setting your whistle's sound to 0 so it doesn't hold you in place every time you use it.

item script WhistleSound{
	void run(int sfx){
		Game->PlaySound(sfx);
	}
}

 

Awesome! Thank you so much!





Also tagged with one or more of these keywords: whistle, trigger, secrets

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users