Jump to content

Photo

Orientation Script


  • Please log in to reply
9 replies to this topic

#1 RupeeCollector

RupeeCollector

    Junior

  • Members

Posted 08 June 2016 - 09:11 PM

I don't know much about scripting but I feel like this script would be simple to make, I just don't know how. Would anyone mind making a script where when Link warps into a room he is facing a certain direction?



#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 June 2016 - 11:37 PM

That's far too vague for any of us to know what you want. Is this supposed to be an item script? Is it a one-time warp? What is the effect, in detail, that you want?

 

It's take a scant few minutes to generate a one-time-warp, but if you want an item that warps to a selection of locations, that's another matter. I've already made...three..I believe...scripts to do that, not including the code for LoE that has warping dynamics, so it's pretty simple, but I wont guess at what you want out of this. :P


Edited by ZoriaRPG, 08 June 2016 - 11:37 PM.


#3 RupeeCollector

RupeeCollector

    Junior

  • Members

Posted 09 June 2016 - 12:03 AM

Well, I just want it to be an FFC that you can place on a screen so when you warp to it via tile or side warp you are facing up, down, left, or right, whichever you choose for that specific screen. 

 

Edit: And the ffc should function every time you warp to the screen, not just once.


Edited by drakemilio, 09 June 2016 - 01:25 AM.


#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 09 June 2016 - 02:02 AM

Oh. I thought you wanted to cause Link to warp, based on his direction.

 

...

 

So, this took ten seconds. :)

 

ffc script ForceDir{
    void run(int dir){
        while( Link->Action == LA_SCROLLING || Link->Action == LA_INWIND ) Waitframe();
        if ( Link->Dir != dir ) Link->Dir = dir;
    }
}

 

Arg D0 is the direction, where 0 is up, 1 is down, 2 is left, and 3 is right.

Try that out, and tell me if you like it. I will note than an ffc script is not ideal for this, as there may be a momentary period where the direction is wrong, and then abruptly changes.

 

It's possible to solve this with a function call in your global active script.



#5 RupeeCollector

RupeeCollector

    Junior

  • Members

Posted 09 June 2016 - 03:20 AM

Thanks, how do I add the function call?

 

Edit: Also, would you mind answering this too? On an unrelated subject, how can I change it so that when a text box appears it doesn't play the sfx?


Edited by drakemilio, 09 June 2016 - 03:28 AM.


#6 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 09 June 2016 - 10:56 AM

SFX 25 is used when a text box appears. SFX 18 is used for each letter.


Edited by Cukeman, 06 August 2016 - 10:33 PM.


#7 jsm116

jsm116

    Script kludger

  • Members
  • Location:The 301

Posted 09 June 2016 - 01:46 PM

Not sure about getting rid of the sound when the text box pops up, but the sound for the letters is controlled in the string window Attributes tab for each string. Just set that to 0 to turn off the letter sounds. You could, in theory, have a different letter sound for each text box. If your messages are triggered by the room state the item sound (25) plays when the room is entered. If your messages are triggered by a script (like a signpost) then the popup sound (25) will only play if you tell the script to play that sound too.

 

EDIT: note that the sound for each letter is per string entry, so changing one will not change the others.


Edited by jsm116, 09 June 2016 - 01:47 PM.


#8 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 09 June 2016 - 07:59 PM

Thanks, how do I add the function call?
 
Edit: Also, would you mind answering this too? On an unrelated subject, how can I change it so that when a text box appears it doesn't play the sfx?


This is what it would look like as a global component:
 
//Global RAM Array indices.

const int FORCED_LINKDIR = 100; 

//Global RAM Array
int Glob_RAM[214747];

//Set to run on Screen Init
ffc script ForceDir{
    void run(int dir){
        while( Link->Action == LA_SCROLLING || Link->Action == LA_INWIND ) Waitframe();
        if ( Link->Dir != dir ) ForceLinkDir(dir);
    }
}

global script active_dir_example{
	void run(){
		
		Glob_RAM[FORCED_LINKDIR] = -1;
		while(true){
			DoForcedLinkDir();
			Waitdraw();
			Waitframe();
		}
	}
}

	

void DoForcedLinkDir(){
	if ( Glob_RAM[FORCED_LINKDIR] >= 0 && Link->Dir != Glob_RAM[FORCED_LINKDIR] ) {
		Link->Dir = gram[FORCED_LINKDIR];
		Glob_RAM[FORCED_LINKDIR] = -1;
	}
}

//Accessors

void ForceLinkDir(int dir){ Glob_RAM[FORCED_LINKDIR] = dir; }
int ForceLinkDir(){ return Glob_RAM[FORCED_LINKDIR]; }
	
Placing the ffc on a screen, allows it to set a global state. (Use ffc flag: Run on screen init.)
When that state is active, it causes the function call in the global active script to evaluate, and force Link->Dir (for one frame).

Edited by ZoriaRPG, 09 June 2016 - 08:00 PM.


#9 Korben

Korben

    Junior

  • Members
  • Location:USA

Posted 11 June 2016 - 11:45 AM

Edit: Deleted  


Edited by Korben, 26 March 2024 - 12:22 PM.


#10 RupeeCollector

RupeeCollector

    Junior

  • Members

Posted 11 June 2016 - 01:17 PM

This is what it would look like as a global component:
 

//Global RAM Array indices.

const int FORCED_LINKDIR = 100; 

//Global RAM Array
int Glob_RAM[214747];

//Set to run on Screen Init
ffc script ForceDir{
    void run(int dir){
        while( Link->Action == LA_SCROLLING || Link->Action == LA_INWIND ) Waitframe();
        if ( Link->Dir != dir ) ForceLinkDir(dir);
    }
}

global script active_dir_example{
	void run(){
		
		Glob_RAM[FORCED_LINKDIR] = -1;
		while(true){
			DoForcedLinkDir();
			Waitdraw();
			Waitframe();
		}
	}
}

	

void DoForcedLinkDir(){
	if ( Glob_RAM[FORCED_LINKDIR] >= 0 && Link->Dir != Glob_RAM[FORCED_LINKDIR] ) {
		Link->Dir = gram[FORCED_LINKDIR];
		Glob_RAM[FORCED_LINKDIR] = -1;
	}
}

//Accessors

void ForceLinkDir(int dir){ Glob_RAM[FORCED_LINKDIR] = dir; }
int ForceLinkDir(){ return Glob_RAM[FORCED_LINKDIR]; }
	
Placing the ffc on a screen, allows it to set a global state. (Use ffc flag: Run on screen init.)
When that state is active, it causes the function call in the global active script to evaluate, and force Link->Dir (for one frame).

 

 

 

Not sure about getting rid of the sound when the text box pops up, but the sound for the letters is controlled in the string window Attributes tab for each string. Just set that to 0 to turn off the letter sounds. You could, in theory, have a different letter sound for each text box. If your messages are triggered by the room state the item sound (25) plays when the room is entered. If your messages are triggered by a script (like a signpost) then the popup sound (25) will only play if you tell the script to play that sound too.

 

EDIT: note that the sound for each letter is per string entry, so changing one will not change the others.

 

SFX 25 is used when a text box appears. SFX 18 is used for each letter.

 

In my quest file, I replaced both sounds with a silent .WAV file. SFX 25 is also used when Link picks up certain items. I uploaded the sound I wanted to for that in one of the empty slots at the end of the list (61 and up are available in a default ZQuest file). Then I went into the properties for each item and replaced "25" with the number of the sound I was using.

 

There may or may not be a scripting solution.

 

Thank you.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users