Jump to content

Photo

"Level 9" custom entrance item check idea


  • Please log in to reply
2 replies to this topic

#1 Taco Chopper

Taco Chopper

    protector of the darn forum

  • Administrators
  • Pronouns:He / Him
  • Location:South Australia

Posted 19 December 2021 - 11:50 AM

trying to build a custom level 9-esque gate. link collects three key items, and heads onto a screen where a small quake and secrets are triggered once only. been trying to search for posts that could have anything on this so i'm just throwing it to the crowd in the hope that someone can figure it out.

 

once more i am trying to fiddle with coding at 3 am. here's what i've written so far that works; it's kind of mangled from a few example scripts here:

const int KEY_ITEM_1 = 155;
const int KEY_ITEM_2 = 156;
const int KEY_ITEM_3 = 157;

ffc script DungeonCheck
{
    void run()
    {
	    if(Link->Item[KEY_ITEM_1] && Link->Item[KEY_ITEM_2] && Link->Item[KEY_ITEM_3])
	    {
		    Game->PlaySound(83);
		    Screen->Quake = 120;
		    Link->SwordJinx = 120;
		    Link->ItemJinx = 120;
		    Game->PlaySound(82);
	    }
	    else
	    {
		    Quit();
	    }
    }
}

at this stage i'm looking for a way to trigger secret combos on the screen, as well as ensuring the script activates once. i thought i could use Game->SetComboFlag to trigger stuff, but i'm a bit confused with the documentation in std + zscript. similarly, i tried cannibalising a one-time message script to ensure that the script would activate just once. however, i realised it'd only work if the player is on the screen for the first time with all three key items.

 



#2 ywkls

ywkls

    Master

  • Members

Posted 19 December 2021 - 12:26 PM

Try this instead.

const int KEY_ITEM_1 = 155;
const int KEY_ITEM_2 = 156;
const int KEY_ITEM_3 = 157;

ffc script DungeonCheck{
    void run(){
            if(Screen->State[ST_SECRET])
                 Quit();
            while(true){	   
                 if(Link->Item[KEY_ITEM_1]
                    && Link->Item[KEY_ITEM_2] 
                    && Link->Item[KEY_ITEM_3]){
		    Game->PlaySound(83);
		    Screen->Quake = 120;
		    Link->SwordJinx = 120;
		    Link->ItemJinx = 120;
		    Game->PlaySound(82);
                    Screen->TriggerSecrets();
                    Screen->State[ST_SECRET]= true;
                    Quit();
	         } 
                 Waitframe();
            }
    }
}

If you wanted to use this in multiple places, then the best way would be to have the items as arguments in the ffc.

Also, you could have it check things based on the arguments which could be used to determine if the script is triggered.


  • Taco Chopper likes this

#3 Taco Chopper

Taco Chopper

    protector of the darn forum

  • Administrators
  • Pronouns:He / Him
  • Location:South Australia

Posted 19 December 2021 - 09:37 PM

This is exactly what I wanted it to do! Thank you.

 

I think I have a fair understanding of how to trigger the screen state permanently now too from this code, which is also important :P I'll probably use a modified version of this script on the same screen to trigger the key items "appearing" on their respective pedestals too, using the items as arguments in the FFC like you suggested. i just realised i can use moosh's npc script to create combos of them appearing without needing the secret to trigger oops


Edited by Taco Chopper, 19 December 2021 - 09:39 PM.

  • ywkls likes this


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users