Jump to content

Photo

Triggering Secrets Only When You Have Items


  • Please log in to reply
7 replies to this topic

#1 Korben

Korben

    Junior

  • Members
  • Location:USA

Posted 14 January 2022 - 01:28 AM

Is there a way to trigger screen secrets only after you have obtained certain items? So basically you can collect 5 non-gameplay items and when you walk into a certain screen with the items in your inventory, the secrets on the screen are triggered. I guess it would kind of work like the triforce works with triforce check rooms. Is this possible?


  • Bagu likes this

#2 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 14 January 2022 - 06:04 AM

This is a thing which will probably need to be scripted.
...but, it's gonna be a short, simple code.


  • Korben likes this

#3 P-Tux7

P-Tux7

    💛

  • Members

Posted 14 January 2022 - 07:09 AM

Can't it be done by
1. Make the items you pick up increment one of the custom counters
2. Have a string on that screen (room type: message and then pick the string like any normal talking room) that has no words but does check to see if that counter is 5 or over, and if the counter IS 5 or over to trigger screen secrets. I'm sure there's string control codes to so that. I'll check tomorrow and write up a string.

In fact I think it's good to note for everybody that string control codes can be used invisibly in Message room types without there being actual words in the string. Here are some other places you can use string control codes that may not be obvious:

-Message Room (as above)
-Pay for Info's 3 strings (this can be used as an alternative to purchasing passive items and have it be "taught" to you, or the person asks which of 3 counters you want refilled, or begs you for money and will give you something if you pay)
-Door Repair (useful in combination with how these rooms disappearing after you read the string. Set the fee to 0 if you do not want rupees draining)
-(2.55) Item Pickup String (to make something change after you get an item, especially in combination with Message room or Signpost strings)
-(2.55) Signpost (useful for things like

1. NPCs who you want them to change what they say after you accumulated enough objects or got an item (such as Sarashala giving you Pegasus Boots after you got the first pendant or the Bully complementing you on getting the Moon Pearl, or Richard gives you the Slime Key if you have 5 leaves and removes the leaves from your inventory)
2. Having NPCs change their dialogue after the first time you talk to them by having the talk check for a counter, if it's 0 play the message that sets it to 1, and the next time it will see the counter is at 1 and go to another string
3. Having NPCs change their dialogue after you set a counter using another screen, item, or signpost's string control codes (like "So you talked to Zelda already?")
4. Trade quests that check to see if you have an item in your inventory and if so, give you the next and take away your previous item, and if not, tell you to go get the item)

-DMap titles do NOT have string control codes. Hopefully DMap titles will have the option to use strings later.

EDIT: I have also been informed that one can make their own shops using signpost combos and String Control Codes with items that cost things other than rupees, such as ammo, items, or custom counters, multiple counter and/or item costs, and more than 3 items in a room (plus changing their location). I am not sure if Wealth Medals work with this method though.

Edited by P-Tux7, 14 January 2022 - 07:47 AM.

  • Korben likes this

#4 Taco Chopper

Taco Chopper

    protector of the darn forum

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

Posted 14 January 2022 - 08:15 AM

This is a thing which will probably need to be scripted.
...but, it's gonna be a short, simple code.

yeah, it's super simple. sounds pretty much what i asked for as a script a month ago in this thread. a modified version of what ywkls posted should do the job for sure.
 
something like
 

const int KEY_ITEM_1 = 155;
const int KEY_ITEM_2 = 156;
const int KEY_ITEM_3 = 157;
//you can do this as many times as you want, just make sure you're adding additional KEY ITEM ints in the code - i.e. const int KEY_ITEM_4 = 158; etc

ffc script KeyItemCheck{
    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]){
                    Screen->TriggerSecrets();
                    Screen->State[ST_SECRET]= true;
                    Quit();
	         } 
                 Waitframe();
            }
    }
}

add that into your FFC script, compile that script into your quest, and assign it to a freeform combo with a transparent combo that isn't combo 0. make sure the KEY_ITEM_1/2/3/etc item codes match up to your custom items as well, and you should be good to go!


also make sure you add additional && Link->ITEM[KEY_ITEM_xyz] for each key item integer you add as well, that way the script will be checking for the extra items to trigger the secret


  • Korben and Bagu like this

#5 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 14 January 2022 - 12:14 PM

yeah, it's super simple. sounds pretty much what i asked for as a script a month ago in this thread. a modified version of what ywkls posted should do the job for sure.
 
something like
 

const int KEY_ITEM_1 = 155;
const int KEY_ITEM_2 = 156;
const int KEY_ITEM_3 = 157;
//you can do this as many times as you want, just make sure you're adding additional KEY ITEM ints in the code - i.e. const int KEY_ITEM_4 = 158; etc

ffc script KeyItemCheck{
    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]){
                    Screen->TriggerSecrets();
                    Screen->State[ST_SECRET]= true;
                    Quit();
	         } 
                 Waitframe();
            }
    }
}

add that into your FFC script, compile that script into your quest, and assign it to a freeform combo with a transparent combo that isn't combo 0. make sure the KEY_ITEM_1/2/3/etc item codes match up to your custom items as well, and you should be good to go!


also make sure you add additional && Link->ITEM[KEY_ITEM_xyz] for each key item integer you add as well, that way the script will be checking for the extra items to trigger the secret

Err, you should use the initd variables of the script for the different items. So, something like:

ffc script KeyItemCheck
{
    void run(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8)
    {
        if(Screen->State[ST_SECRET])
            Quit();
        int items[] = {i1,i2,i3,i4,i5,i6,i7,i8};
        while(true)
        {
            bool trigger = true;
            for(int q = 0; q < 8; ++q)
            {
                if(items[q] > 0 && !Link->Item[it])
                {
                    trigger = false;
                    break;
                }
            }
            if(trigger)
            {
                Screen->TriggerSecrets();
                Screen->State[ST_SECRET]= true;
                Quit();
            }
            Waitframe();
        }
    }
}

So, with this, you just set the 8 `InitD[]` args in the ffc editor to 8 items. If you want less than 8 items, leave any extras at 0 and they will be ignored.

This is far better, because, you can use it again and again on different screens with different item combinations.


  • Taco Chopper, Mani Kanina, Korben and 1 other like this

#6 TheRock

TheRock

    Go glitches

  • Members

Posted 14 January 2022 - 01:45 PM

Yeah, it's really simple. When you collect one of the items it has a screen state carry over to the other screen. That one screen has 5 version of it and if the one gets collected then go to next screen. So if collect all five then go to final screen. To The Top does this a lot and it's a 2.10 quest and Herald of Heroes has it everywhere. 



#7 Taco Chopper

Taco Chopper

    protector of the darn forum

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

Posted 14 January 2022 - 08:46 PM

Err, you should use the initd variables of the script for the different items. So, something like:

ffc script KeyItemCheck
{
    void run(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8)
    {
        if(Screen->State[ST_SECRET])
            Quit();
        int items[] = {i1,i2,i3,i4,i5,i6,i7,i8};
        while(true)
        {
            bool trigger = true;
            for(int q = 0; q < 8; ++q)
            {
                if(items[q] > 0 && !Link->Item[it])
                {
                    trigger = false;
                    break;
                }
            }
            if(trigger)
            {
                Screen->TriggerSecrets();
                Screen->State[ST_SECRET]= true;
                Quit();
            }
            Waitframe();
        }
    }
}

So, with this, you just set the 8 `InitD[]` args in the ffc editor to 8 items. If you want less than 8 items, leave any extras at 0 and they will be ignored.

This is far better, because, you can use it again and again on different screens with different item combinations.

doh, i forgot to edit that part in cos i'm only using it for one screen on my quest. good pick up on that!


  • Bagu likes this

#8 Korben

Korben

    Junior

  • Members
  • Location:USA

Posted 14 January 2022 - 09:54 PM

Thanks everyone!


  • Taco Chopper likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users