Jump to content

Photo

Book of Mudora

Book of Mudora

  • Please log in to reply
20 replies to this topic

#16 Demonlink

Demonlink

    Experienced Quest Developer

  • Members
  • Real Name:Miguel
  • Gender:Male
  • Location:Where you can't see me. Ha!

Posted 09 April 2018 - 10:19 PM

Give me a few days, I'll have it ready for you then. :)



#17 Demonlink

Demonlink

    Experienced Quest Developer

  • Members
  • Real Name:Miguel
  • Gender:Male
  • Location:Where you can't see me. Ha!

Posted 10 April 2018 - 04:05 AM


import "std.zh"


//Item IDs of the books.
const int I_BOOK_OF_MUDORA_HYLIAN = 123; 
const int I_BOOK_OF_MUDORA_HGORON = 124;
const int I_BOOK_OF_MUDORA_HZORAN = 125;
const int I_BOOK_OF_MUDORA_HGZORAN = 126;


//These constants are for drawing a small bubble on top of Link according to the offsets. It draws it on Layer 5.
const int C_READABLE = 4; //The combo to use for the Readable graphic
const int CS_READABLE = 7; //The cset to use for the Readable graphic
const int READABLE_X_OFFSET = 10; //The X offset for the Readable graphic
const int READABLE_Y_OFFSET = -10; //The Y offset for the Readable graphic


//D0 is the Book Type needed: Hylian is 1, Hylian/Goron is 2, Hylian/Zoran is 3.
//D1 is the string to display when you don't have the book.
//D2 is the string to display when you have the book.


ffc script BookOfMudora{
void run(int booktype, int encrypted, int decrypted){
while(true){
if(Link->X>=this->X-8&&Link->X<=this->X+16*this->TileWidth-8&&Link->Y==this->Y+this->TileHeight*16-{
Screen->FastCombo(5, Link->X+READABLE_X_OFFSET, Link->Y+READABLE_Y_OFFSET, C_READABLE, CS_READABLE, 128);
if(booktype==1){
if((Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()!=I_BOOK_OF_MUDORA_HYLIAN) 
|| (Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()!=I_BOOK_OF_MUDORA_HGORON) 
|| (Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()!=I_BOOK_OF_MUDORA_HZORAN)
|| (Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()!=I_BOOK_OF_MUDORA_HGZORAN)){
Link->InputA=false;
Screen->Message(encrypted);
}
else if((Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()==I_BOOK_OF_MUDORA_HYLIAN)
|| (Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()==I_BOOK_OF_MUDORA_HGORON)
|| (Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()==I_BOOK_OF_MUDORA_HZORAN)
|| (Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()==I_BOOK_OF_MUDORA_HGZORAN) 
|| (Link->Dir==DIR_UP && Link->PressB && GetEquipmentB()==I_BOOK_OF_MUDORA_HYLIAN)
|| (Link->Dir==DIR_UP && Link->PressB && GetEquipmentB()==I_BOOK_OF_MUDORA_HGORON)
|| (Link->Dir==DIR_UP && Link->PressB && GetEquipmentB()==I_BOOK_OF_MUDORA_HZORAN)
|| (Link->Dir==DIR_UP && Link->PressB && GetEquipmentB()==I_BOOK_OF_MUDORA_HGZORAN)){
Link->InputA=false;
Link->InputB=false;
Screen->Message(decrypted);
Waitframe();
if(!Screen->State[ST_SECRET]){
Game->PlaySound(SFX_SECRET);
Screen->TriggerSecrets();
Screen->State[ST_SECRET]=true;
}
                    }
}
else if(booktype==2){
if((Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()!=I_BOOK_OF_MUDORA_HGORON)
|| (Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()!=I_BOOK_OF_MUDORA_HGZORAN)){
Link->InputA=false;
Screen->Message(encrypted);
}
else if((Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()==I_BOOK_OF_MUDORA_HGORON)
|| (Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()==I_BOOK_OF_MUDORA_HGZORAN) 
|| (Link->Dir==DIR_UP && Link->PressB && GetEquipmentB()==I_BOOK_OF_MUDORA_HGORON)
|| (Link->Dir==DIR_UP && Link->PressB && GetEquipmentB()==I_BOOK_OF_MUDORA_HGZORAN)){
Link->InputA=false;
Link->InputB=false;
Screen->Message(decrypted);
Waitframe();
if(!Screen->State[ST_SECRET]){
Game->PlaySound(SFX_SECRET);
Screen->TriggerSecrets();
Screen->State[ST_SECRET]=true;
}
                      }
}
else if(booktype==3){
if((Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()!=I_BOOK_OF_MUDORA_HZORAN)
|| (Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()!=I_BOOK_OF_MUDORA_HGZORAN)){
Link->InputA=false;
Screen->Message(encrypted);
}
else if((Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()==I_BOOK_OF_MUDORA_HZORAN)
|| (Link->Dir==DIR_UP && Link->PressA && GetEquipmentA()==I_BOOK_OF_MUDORA_HGZORAN) 
|| (Link->Dir==DIR_UP && Link->PressB && GetEquipmentB()==I_BOOK_OF_MUDORA_HZORAN)
|| (Link->Dir==DIR_UP && Link->PressB && GetEquipmentB()==I_BOOK_OF_MUDORA_HGZORAN)){
Link->InputA=false;
Link->InputB=false;
Screen->Message(decrypted);
Waitframe();
if(!Screen->State[ST_SECRET]){
Game->PlaySound(SFX_SECRET);
Screen->TriggerSecrets();
Screen->State[ST_SECRET]=true;
}
                        }
}
               }
               Waitframe();
          }
     }
}

I have that, and it works pretty much like you want it to; BUT. The problem is that it only works so far with the B Button. Pressing the A Button while having the book equipped to it will still show the untranslated string. I'm not sure what I'm doing wrong that makes it do that... Can anybody lend a hand as to why this is happening?

 

I'm also pretty sure I can make wrap it up much easier with fewer lines, but give me a chance, I'm still learning. :lol:


Edited by Demonlink, 10 April 2018 - 04:07 AM.


#18 Demonlink

Demonlink

    Experienced Quest Developer

  • Members
  • Real Name:Miguel
  • Gender:Male
  • Location:Where you can't see me. Ha!

Posted 11 April 2018 - 08:46 PM

Forget it, did some minor rewrites and it works now as I originally intended it to. :)

 

Here's the code:

 

CODE

  • Reflectionist likes this

#19 Reflectionist

Reflectionist

    Apprentice

  • Members
  • Real Name:Jake
  • Gender:Male
  • Location:Missouri, US

Posted 12 April 2018 - 02:15 AM

Whoaaa...

Thanks, Demonlink!
  • Demonlink likes this

#20 Dimentio

Dimentio

    Procrastinator at heart

  • Members
  • Real Name:Joshua
  • Gender:Male
  • Location:America's Hat.

Posted 11 May 2018 - 12:23 PM

I'm pretty sure you could do this without duplicate Strings. First you'd use GetMessage(int string, int buffer[]); to store the string, then depending on whether you have the book, you'd draw the string with the appropriate Font. For best effects, you could just use tango to automate the string drawing process, but I know tango can be a bit of a pain to set up/understand. Thankfully you don't need Tango, but it helps.


  • Demonlink likes this

#21 Demonlink

Demonlink

    Experienced Quest Developer

  • Members
  • Real Name:Miguel
  • Gender:Male
  • Location:Where you can't see me. Ha!

Posted 11 May 2018 - 06:00 PM

I'm pretty sure you could do this without duplicate Strings. First you'd use GetMessage(int string, int buffer[]); to store the string, then depending on whether you have the book, you'd draw the string with the appropriate Font. For best effects, you could just use tango to automate the string drawing process, but I know tango can be a bit of a pain to set up/understand. Thankfully you don't need Tango, but it helps.

I tried to make it as simple as possible without needing any other further setup. But, I still think that script can be simplified even more; what I wanted to do was use an array to store the item ids of the books. Thus, when reading the sign or whatever, locate what book Link has, and display the string according to such...

 

But I haven't really used ZC lately, and scripting hasn't been a major priority either. :(


  • Dimentio likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users