Jump to content

Photo

Magic Book


  • Please log in to reply
10 replies to this topic

#1 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 29 March 2017 - 02:57 PM

Hi everyone i want to make a new request but this time on item and ffc script.
I want as item the Magic Book.
His action is when we press A with the book on a pedestal with the Book FFC placed on the pedestal Link warping on a same room but in the dark and then a secert path appears, When we press at A at a the empty pedestal then Link will be warping on a normal room and then beside the empty pedestal where Link was been before the action. When he warping the portal sound can be hears and when he try to press A without a book on a pedestal a error sound can be hears without making Libk warping. i could make the warp as Side Direct Warp A to D.
The item it would be useful for a specific dungeon especially the Time Temple. if it's possible you can make a test dungeon but however it's possible without global script ?



#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 02 May 2017 - 02:09 PM

Hi everyone i want to make a new request but this time on item and ffc script.
I want as item the Magic Book.
His action is when we press A with the book on a pedestal with the Book FFC placed on the pedestal Link warping on a same room but in the dark and then a secert path appears, When we press at A at a the empty pedestal then Link will be warping on a normal room and then beside the empty pedestal where Link was been before the action. When he warping the portal sound can be hears and when he try to press A without a book on a pedestal a error sound can be hears without making Libk warping. i could make the warp as Side Direct Warp A to D.
The item it would be useful for a specific dungeon especially the Time Temple. if it's possible you can make a test dungeon but however it's possible without global script ?

 

 

 

Try this:
 

///////////////////////////
///     'Magic Book'    ///
/// Requested by Cedric ///
///    By: ZoriaRPG     ///
///    2nd May, 2017    ///
///////////////////////////

//D0: Tile Warp to use: 0 for A, 1 for B, 2 for C, 3 for D.
ffc script bookwarp{
	void run(int warpID){ 
		while(this->Misc->D[15] != 10 ) { Waitframe(); }
		Screen->ComboT[ComboAt(Link->X, Link->Y)] = (CT_SWARPA + warpID);
	}
}

//D0: Maximum Distance between FFC and Link; normally 4. 
//D1: Sound for error. 
item script warpbook{
	void run(int distxy, int errorSFX){
		if ( distxy == 0 ) { distxy = 6; }
		int fff[]="bookwarp";
		int ff = Game->GetFFCScript(fff);
		bool match;
		for ( int q = 1; q < 32; q ++ ) {
			ffc f = Screen->LoadFFC(q);
			if ( f->Script == ff ) {
				if ( FFCDistXY(f, distxy) ) {
					f->Misc[15] = 10;
					match = true; 
				}
			}
		}
		if ( !match ) { 
			if ( errorSFX ) Game->PlaySound(errorSFX); 
		}
	}
	bool FFCDistXY(ffc b, int distance) {
		int distx; int disty;
		if ( Link->X > b->X ) distx = Link->X - b->X;
		else distx = b->X - Link->X;
		
		if ( Link->Y > b->Y ) disty = Link->Y - b->Y;
		else disty = b->Y - Link->Y;

		return ( distx <= distance && disty <= distance );
	} 
}

Play the ffc on the pedestal, wherever you wish, and attach this script. Set its D0 to a tile warp that is otherwise not used on the screen, and set the warp destination and effects for the tile warp to match this setting.

Assign the item script to your book, and set its D0 argument to a value between 4 and 8, based on your desired sensitivity for proximity to Link. If left at 0, it defaults to a sensitivity of '6'. Set its D1 argument to an error sound.

This is untested, but it should work as you desire.


Edited by ZoriaRPG, 02 May 2017 - 02:45 PM.


#3 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 05 May 2017 - 09:14 PM

alright thanks :)

#4 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 06 May 2017 - 04:15 PM

I got this problem: 

''Pass 4: Type-checking/completing function symbol tables/constant folding Book.z, line 11: error T29: that pointer type does not have a variable misc.''
 

there's a solution ?


Edited by Cedric, 07 May 2017 - 04:20 PM.


#5 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 07 May 2017 - 09:21 PM

it's means i need the std-weapon.zh or stdExtra.zh ? because i not figured out this problem and i was never seen this type error before :/

#6 justin

justin

    Adept

  • Members

Posted 08 May 2017 - 03:40 AM

Change this line
while(this->Misc->D[15] != 10 ) { Waitframe(); }
to this
while(this->Misc[15] != 10 ) { Waitframe(); }

  • ShadowTiger likes this

#7 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 08 May 2017 - 10:24 AM

You have a exemple quest for that ? i tested and apparently the scripts works but when i have the item and i go on the pedestale nothing happens i was setting up all the instructions and i was put this with Custom Item 01 with (Custom Itemclass 01). I should ''Run Script at Screen Int'' ?


Edited by Cedric, 08 May 2017 - 10:27 AM.


#8 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 09 May 2017 - 12:33 PM

And for somes reasons the script doesn't run ever if i press ''A'' or ''B''. Yes the item must not appears on ''A'' or ''B'' window but i still not understanding why the script doesn't works ever if i made the correct setting up. I made a test room for that so if you want i could give you the test quest so maybe you could find the problem because i tried everything.

i don't know if it's the main script himself the problem.



#9 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 09 May 2017 - 03:33 PM



And for somes reasons the script doesn't run ever if i press ''A'' or ''B''. Yes the item must not appears on ''A'' or ''B'' window but i still not understanding why the script doesn't works ever if i made the correct setting up. I made a test room for that so if you want i could give you the test quest so maybe you could find the problem because i tried everything.

i don't know if it's the main script himself the problem.

 

Sorry about this->Misc->D[]. I'm not certain how that mutant thing came to exist, but aye, it is merely this->Misc[].

 

Here is a fixed, and updated script:

///////////////////////////
///     'Magic Book'    ///
/// Requested by Cedric ///
///    By: ZoriaRPG     ///
///    9th May, 2017    ///
///////////////////////////

const int CMB_MAGIC_BOOK_WARP = 888; //A 'Sensitive Warp-A' combo with no graphics. 
//The next three combos should be Sensitive Warp B, C, and D each with an identical (blank) tile.

//D0: Tile Warp to use: 0 for A, 1 for B, 2 for C, 3 for D.
//D1: Secial combo to use instead of default. Will use CMB_MAGIC_BOOK_WARP if set to '0'.
ffc script bookwarp{
    void run(int warpID, int warpcombo){
        while(this->Misc[15] != 10 ) { Waitframe(); }
        this->X = Link->X; this->Y = Link->Y;
        if ( warpcombo > 0 ) { this->Data = ( warpcombo + warpID ); }
    }
}

//D0: Maximum Distance between FFC and Link; normally 4.
//D1: Sound for error.
item script warpbook{
    void run(int distxy, int errorSFX){
        if ( distxy == 0 ) { distxy = 6; }
        int fff[]="bookwarp";
        int ff = Game->GetFFCScript(fff);
        bool match;
        for ( int q = 1; q < 32; q ++ ) {
            ffc f = Screen->LoadFFC(q);
            if ( f->Script == ff ) {
                if ( FFCDistXY(f, distxy) ) {
                    f->Misc[15] = 10;
                    match = true;
                }
            }
        }
        if ( !match ) {
            if ( errorSFX ) Game->PlaySound(errorSFX);
        }
    }
    bool FFCDistXY(ffc b, int distance) {
        int distx; int disty;
        if ( Link->X > b->X ) distx = Link->X - b->X;
        else distx = b->X - Link->X;
        
        if ( Link->Y > b->Y ) disty = Link->Y - b->Y;
        else disty = b->Y - Link->Y;

        return ( distx <= distance && disty <= distance );
    }
}

WarpBook Script for Cedric, Test Quest

 


Edited by ZoriaRPG, 09 May 2017 - 05:26 PM.


#10 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Location:Judgement Hall

Posted 09 May 2017 - 07:17 PM

i test it and the compilation is works perfectly :) but i got a question: How can you set the Magic Book on the ''B'' window ? because i saw it on your exemple quest (because it was setting on when you start the quest but on mine how can you put it on ''B'' for exemple when Link find it on a chest ?
and i have obligatory use the ''Custom Itemclass 1'' or i can use anothers ?
mine is doesn't appears on the ''B'' window. There's something i missing ?

edit: i did the same setup as ZoriaRPG done as the video but...
Just for asking it's possible to make the string on D2 or D3 for when you got the item ?
and also i have to specifies the ffc script and the item script on specific slot ? because i did not see anything that i must change the member for the scripts slots i already used the Item Message and the Trempoline ffc script on slot 1

Edit: Nevermind i finally figured out ^^' i just needed to adding the book with the script on the subscreen.
 


Edited by Cedric, 10 May 2017 - 10:21 AM.


#11 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 10 May 2017 - 02:41 PM

i test it and the compilation is works perfectly :) but i got a question: How can you set the Magic Book on the ''B'' window ? because i saw it on your exemple quest (because it was setting on when you start the quest but on mine how can you put it on ''B'' for exemple when Link find it on a chest ?
and i have obligatory use the ''Custom Itemclass 1'' or i can use anothers ?
mine is doesn't appears on the ''B'' window. There's something i missing ?

You may use other item classes, but the class must be one that you can set to the item slots; and only the custom classes have no other effects.

 

I skipped the subscreen modification, as I expected that to be extraneous; but I did briefly consider showing it in the video.
 

Just for asking it's possible to make the string on D2 or D3 for when you got the item ?
and also i have to specifies the ffc script and the item script on specific slot ? because i did not see anything that i must change the member for the scripts slots i already used the Item Message and the Trempoline ffc script on slot 1

///////////////////////////
///     'Magic Book'    ///
/// Requested by Cedric ///
///    By: ZoriaRPG     ///
///    10th May, 2017   ///
///////////////////////////

const int CMB_MAGIC_BOOK_WARP = 888; //A 'Sensitive Warp-A' combo with no graphics.
//The next three combos should be Sensitive Warp B, C, and D each with an identical (blank) tile.

//D0: Tile Warp to use: 0 for A, 1 for B, 2 for C, 3 for D.
//D1: Special combo to use instead of default. Will use CMB_MAGIC_BOOK_WARP if set to '0'.
ffc script bookwarp{
    void run(int warpID, int warpcombo){
        while(this->Misc[15] != 10 ) { Waitframe(); }
        this->X = Link->X; this->Y = Link->Y;
        if ( warpcombo > 0 ) { this->Data = ( warpcombo + warpID ); }
    }
}


//D0: Passthrough for item message.
//D1: Passthrough for Trampoline ffc signal.
//D2: Maximum Distance between FFC and Link; normally 4.
//D3: Sound for error.
item script warpbook{
    void runint msg, int trampoline, int distxy, int errorSFX){
        if ( distxy == 0 ) { distxy = 6; }
        int fff[]="bookwarp";
        int ff = Game->GetFFCScript(fff);
        bool match;
        for ( int q = 1; q < 32; q ++ ) {
            ffc f = Screen->LoadFFC(q);
            if ( f->Script == ff ) {
                if ( FFCDistXY(f, distxy) ) {
                    f->Misc[15] = 10;
                    match = true;
                }
            }
        }
        if ( !match ) {
            if ( errorSFX ) Game->PlaySound(errorSFX);
        }
    }
    bool FFCDistXY(ffc b, int distance) {
        int distx; int disty;
        if ( Link->X > b->X ) distx = Link->X - b->X;
        else distx = b->X - Link->X;
        
        if ( Link->Y > b->Y ) disty = Link->Y - b->Y;
        else disty = b->Y - Link->Y;

        return ( distx <= distance && disty <= distance );
    }
}

 
Don't forget to update the item in the editor.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users