Jump to content

Photo

Fairy Script "L" additions


  • Please log in to reply
11 replies to this topic

#1 Xenix

Xenix

    Well excuse me princess.

  • Members
  • Real Name:Chris
  • Location:Newport News, VA

Posted 06 June 2011 - 04:59 PM

I would like to be able to press L and have a message show up on the screen. the message played should be controlled via FFC script and should allow for an sfx to play like the npc script. it would make things a lot more interesting in my game because i can make it so that you can get info on bosses and also be able to tell the player what his/her current objective is. can anyone do this for me?

Thanks,
~Sepulcher

bump, cause i need this for my demo that i hope to finish in a few weeks.

#2 Colossal

Colossal

    Illustrious

  • Members
  • Location:Canada

Posted 06 June 2011 - 05:22 PM

This should do the trick. D0 is the string number, D1 is the sound effect number.

CODE
ffc script ScreenMessage {
   void run(int message, int sfx) {
      while(true) {
         if(Link->InputL) {
            Game->PlaySound(sfx);
            Screen->Message(message);
            Link->InputL = false;
         }
         Waitframe();
      }
   }
}



#3 Xenix

Xenix

    Well excuse me princess.

  • Members
  • Real Name:Chris
  • Location:Newport News, VA

Posted 06 June 2011 - 05:47 PM

Wonderful! It worked beautifully! Thanks Colossal! *adds to credits*

#4 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 06 June 2011 - 08:59 PM

Do you mind if I give this a try in my quest as well, Sepulcher?

#5 Colossal

Colossal

    Illustrious

  • Members
  • Location:Canada

Posted 06 June 2011 - 09:36 PM

I wouldn't mind if you used it. Note that it will only work right if the "Messages Freeze All Action" and "Messages Disappear" quest rules are enabled.


#6 Xenix

Xenix

    Well excuse me princess.

  • Members
  • Real Name:Chris
  • Location:Newport News, VA

Posted 07 June 2011 - 05:15 AM

QUOTE(HylianGlaceon @ Jun 6 2011, 08:59 PM) View Post

Do you mind if I give this a try in my quest as well, Sepulcher?

YES! I will KILL YOU!!! naw, just kidding man, go ahead!

#7 Colossal

Colossal

    Illustrious

  • Members
  • Location:Canada

Posted 07 June 2011 - 03:32 PM

In case you're interested, Sepulcher, here's another version of the script.

CODE
const int DEFAULT_SFX = 0;
int currentobjective;
ffc script ScreenMessage {
   void run(int message, int sfx) {
      while(true) {
         if(Link->InputL) {
            if(sfx == 0) Game->PlaySound(DEFAULT_SFX);
            else Game->PlaySound(sfx);
            if(message == 0) Screen->Message(currentobjective);
            else Screen->Message(message);
            Link->InputL = false;
         }
         Waitframe();
      }
   }
}


It's similar to before, but now it's possible to have screens where the displayed string changes over time throughout the quest by leaving D0 set to 0 for those screens. It could be useful as the player completes objectives, for instance. This string can be changed from any script, such as this one:

CODE
ffc script SetObjective {
   void run(int newobjective) {
      currentobjective = newobjective;
   }
}


You can also set a default sound effect by changing the value for DEFAULT_SFX and it will play when D1 is set to 0.


#8 Xenix

Xenix

    Well excuse me princess.

  • Members
  • Real Name:Chris
  • Location:Newport News, VA

Posted 07 June 2011 - 03:47 PM

SWEEEEET!!! but one question, how would I go about using the change objective one (D0 settings, D1 settings, etc)? could you lay it out for me bro? also, will this make it so that I don't have to make like, a million copies of one map just to get different effects? does it allow for detection of certain items through D# settings?

Edited by Sepulcher, 07 June 2011 - 03:51 PM.


#9 Colossal

Colossal

    Illustrious

  • Members
  • Location:Canada

Posted 07 June 2011 - 04:21 PM

For the set objective script, D0 is the string number for the string that mentions the next objective. FFCs that use this script can be placed in, say one-time cutscenes to set the next string. This allows for a different string to be displayed depending on how far the player is into the quest without having to make a copy of the map (when D0 is set to 0 for the ScreenMessage FFC). And yes, the string can still be set to something different in, say, a boss room or a puzzle room.

As for item detection, how exactly would you like that to work? Would you like the string to change right away when Link picks up an item, or do you have something else in mind?

Edited by Colossal, 07 June 2011 - 04:22 PM.


#10 Xenix

Xenix

    Well excuse me princess.

  • Members
  • Real Name:Chris
  • Location:Newport News, VA

Posted 07 June 2011 - 04:24 PM

on the subject of the item detection, first off, i think D0 should be the string, D1 the sfx (if it needs to change), and D2 should be the item id. It should change right away.

#11 Colossal

Colossal

    Illustrious

  • Members
  • Location:Canada

Posted 07 June 2011 - 05:15 PM

I had to make some minor changes to allow the default sfx to be changed. As a result, a default sfx will not be played until the objective has been changed once by a FFC that has a new sfx value set (this will only make a difference if loading a saved game from before these scripts were added). Here are the scripts:

CODE
int currentobjective;
int defaultsfx;
ffc script ScreenMessage {
   void run(int message, int sfx) {
      while(true) {
         if(Link->InputL) {
            if(sfx == 0) Game->PlaySound(defaultsfx);
            else Game->PlaySound(sfx);
            if(message == 0) Screen->Message(currentobjective);
            else Screen->Message(message);
            Link->InputL = false;
         }
         Waitframe();
      }
   }
}

ffc script SetObjective {
   void run(int newobjective, int newsfx) {
      currentobjective = newobjective;
      if(newsfx > 0) defaultsfx = newsfx;
   }
}

const int SETOBJECTIVEITEM_D = 7;
ffc script SetObjectiveItem {
   void run(int newobjective, int newsfx, int screenitem) {
      if(Screen->D[SETOBJECTIVEITEM_D] == 1) Quit();
      while(true) {
         if(Link->Item[screenitem]) {
            currentobjective = newobjective;
            Screen->D[SETOBJECTIVEITEM_D] = 1;
            if(newsfx > 0) defaultsfx = newsfx;
            Quit();
         }
         Waitframe();
      }
   }
}


ScreenMessage is unchanged from before, if D0/D1 are set to 0, the current objective/sfx are used.

For SetObjective and SetObjectiveItem, D0 is the next string, D1 is the next sfx (if set to 0, sfx will not change), and, for SetObjectiveItem, D2 is the item ID.

A FFC using SetObjectiveItem can be placed on the screen with the item to get the string to change when Link picks up the item. The SETOBJECTIVEITEM_D constant is the screen-specific D variable to use. I left it at 7, which will be ok unless any other scripts on that screen are using that D variable.


#12 Xenix

Xenix

    Well excuse me princess.

  • Members
  • Real Name:Chris
  • Location:Newport News, VA

Posted 07 June 2011 - 06:06 PM

Thanks Colossal! You've saved me so much trouble with this! Now I will repay you by making the best quest I can make!


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users