Jump to content

Photo

Non-sideview Ladder


  • Please log in to reply
4 replies to this topic

#1 Phosphor

Phosphor

    Lasers? This calls for a selfie.

  • Members
  • Real Name:Jack
  • Gender:Male
  • Location:On EVA

Posted 25 December 2018 - 02:19 PM

Hey, I was wondering if anyone could write a script that functions similarly to Justin's Sideview Ladder Script except on normal screens instead of sideview gravity screens. Preferably the script can detect a specific combo type the player is walking on and force them to always face upwards or switch their sprite out for a specific animation. I do understand that you can pull off this without scripting if you fiddle with the swim animations and set the ladders to the water combo type, however I plan on having the flippers elsewhere in my quest alongside standard swimming and diving. Thanks!



#2 Avataro

Avataro

    Quest maker

  • Members
  • Real Name:Robin
  • Gender:Male
  • Location:Germany

Posted 25 December 2018 - 03:47 PM

const int ComboType_NormalLadder = 142; //combo type for ladders. "script 1" by default. see std_constants.zh for a list of combo types.
global script NormalLadder{
	void run(){
		while(true){
			if ( Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] == ComboType_NormalLadder ) {
				//disable A and B
				Link->InputA = false; Link->PressA = false;
				Link->InputB = false; Link->PressB = false;
			}
			Waitdraw();
			if ( Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] == ComboType_NormalLadder ) {
				Link->Dir = DIR_UP; //make link face up
			}
			Waitframe();
		}
	}
}
Making Link only face one direction only works as a global after Waitdraw(); I think.
I added 2 lines to disable A and B. You could try that out, or remove them if you want.

Edited by Avataro, 25 December 2018 - 04:09 PM.


#3 Avataro

Avataro

    Quest maker

  • Members
  • Real Name:Robin
  • Gender:Male
  • Location:Germany

Posted 25 December 2018 - 05:49 PM

import "LinkMovement.zh"

const int ComboType_NormalLadder = 142; //combo type for ladders. "script 1" by default. see std_constants.zh for a list of combo types.
global script NormalLadder{
	void run(){
		LinkMovement_Init();
		bool OnNormalLadder;
		while(true){
			LinkMovement_Update1();
			
			if ( Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] == ComboType_NormalLadder ) {
				OnNormalLadder = true;
				//disable A and B
				Link->InputA = false; Link->PressA = false;
				Link->InputB = false; Link->PressB = false;
				//slow down link
				LinkMovement_AddLinkSpeedBoost(-0.5);
			}
			else
				OnNormalLadder = false;

			Waitdraw();
			LinkMovement_Update2();
			
			if ( OnNormalLadder )
				Link->Dir = DIR_UP; //make link face up
			Waitframe();
		}
	}
}
Added in a function that makes Link slower. Uses LinkMovement.zh by Moosh now, so that'll need to be imported.

Edited by Avataro, 25 December 2018 - 05:49 PM.


#4 Phosphor

Phosphor

    Lasers? This calls for a selfie.

  • Members
  • Real Name:Jack
  • Gender:Male
  • Location:On EVA

Posted 25 December 2018 - 07:57 PM

It works perfectly! Thanks!



#5 Sans

Sans

    Hey kid wanna buy hot dogs ?

  • Members
  • Gender:Male
  • Location:Judgement Hall

Posted 26 December 2018 - 05:58 PM

Pretty cool 


Edited by Sans, 26 December 2018 - 06:13 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users