Jump to content

Photo

Multiple Chest Script (Request)


  • Please log in to reply
18 replies to this topic

#16 Hari

Hari

    Snivy Gang

  • Members
  • Pronouns:She / Her
  • Location:Idaho

Posted 16 May 2016 - 06:05 PM

You can save the chest's state. I believe you do this by writing a number to Screen->Misc[] when the chest is opened. Then, when the screen loads, have the FFC script check Screen->Misc[], and if Screen->Misc[] contains that number, then change the chest to its open state and terminate the script.

 

Here's an example:

ffc script DoStuff {
    void run() {
        if (Screen->Misc[2] == 500) {  //Yes, that number is a little extreme.
            Quit();
        }
        
        bool Open = true;
       
        while (Open) {
            if (true) {  //Enter your condition here.
                //Do stuff here.
               
                Screen->Misc[2] = 500;
                Open = false;
            }
            
            Waitframe();
         }
    }
}

That's basically how you do that. I'm not really an expert scripter, so I might be wrong. But that's how I think you would do it.



#17 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 16 May 2016 - 08:57 PM

There's no such variable as Screen->Misc[]. You're probably thinking of Screen->D[]. There are eight elements in that array, there's one for each screen/DMap combination, and it's part of the save file, so it will stay after saving and resetting the game. You could also set Screen->State[ST_CHEST]. There's only one of those per room, but it's also permanent.

Shadowblitz, your solid tile chest won't open because that's not how Abs() works.
 
if ((Link->PressA) && (Link->Dir == DIR_UP) && (Abs(Link->X) == Abs(Chest->X)) && (Abs(Link->Y) == Abs(Chest->Y+1)))
Absolute value just removes the negative sign if there is one, so this is no different from your previous check and so it won't work for the same reasons. Try this instead.
 
if ((Link->PressA) && (Link->Dir == DIR_UP) && (Abs(Link->X - Chest->X) <= 4) && (Link->Y == Chest->Y+8))


#18 Hari

Hari

    Snivy Gang

  • Members
  • Pronouns:She / Her
  • Location:Idaho

Posted 16 May 2016 - 10:26 PM

That was what I meant. Oops.

Edited by Hookshot, 16 May 2016 - 10:27 PM.


#19 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 16 May 2016 - 10:55 PM

ok thanks guys




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users