Jump to content

Photo

Level 1 Flippers


  • Please log in to reply
9 replies to this topic

#1 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 06 March 2018 - 11:25 AM

I would like to request, what I think (and hope) would be a simple script: Level 1 Flippers that allow you to swim, but not dive.

 

If I'm not mistaken, the script would disable the A and B inputs if Link has the Level 1 Flippers AND he is swimming.

 

Of course my Level 2 Flippers would have "Keep Lower Level Items" unchecked, so that it would replace the Level 1 Flippers and allow diving.

 

Let's see how far I can get on my own using this script as a base:

const int BoomerangID = 123; //set number to boomerang item ID

global script Active{
	void run(){
		while(true){
			if ( Game->Counter[CR_SCRIPT1] == 0 ) {
				if ( GetEquipmentA() == BoomerangID )
					Link->InputA = false;
				if ( GetEquipmentB() == BoomerangID )
					Link->InputB = false;
			}
			Waitframe();
		}
	}
}

item script BoomerangActive{
	void run(){
		Game->Counter[CR_SCRIPT1] --;
	}
}

My incomplete edit:

 

const int FlipperID = 51; //set number to Flipper item ID

global script Active{
	void run(){
		while(true){
			if ( Game->Counter[CR_SCRIPT1] == 0 ) {//Replace with Link->Swimming?
				if ( GetEquipment() == FlipperID )//just delete A button since it's not a button item?
					Link->InputA = false;
					Link->InputB = false;
			}
			Waitframe();
		}
	}
}

item script FlipperActive{
	void run(){
		Game->Counter[CR_SCRIPT1] --;//Replace with... not sure what
	}
}


#2 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 06 March 2018 - 03:00 PM

In your edited script there remove line 7 altogether, and in line 6 have this

if ( Link->Action == LA_SWIMMING ) {

The item script also isn't needed. If you are planning to use this together with the boomerang stuff you gotta combine the 2 global scripts.



#3 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 07 March 2018 - 01:21 AM

const int FlipperID = 51; //set number to Flipper item ID

global script Active{
	void run(){
		while(true){
			if ( Link->Action == LA_SWIMMING ) {
					Link->InputA = false;
					Link->InputB = false;
			}
			Waitframe();
		}
	}
}

...but then the constant isn't being used... how will the script know to apply this to only one set of flippers?


Edited by Cukeman, 07 March 2018 - 01:22 AM.


#4 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 07 March 2018 - 09:51 AM

Oh, true.

if ( Link->Action == LA_SWIMMING && Link->Item[FlipperID] ) {

Line 6 should be this then. That'll make this only apply if Link has the level 1 flippers.



#5 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 07 March 2018 - 02:37 PM

import "std.zh"


const int BoomerangID = 23; //set number to boomerang item ID
const int EmberID = 35; //set number to Ember item ID
const int FlipperID = 51; //set number to Flipper item ID

//Credits
//Avataro
//Cukeman


global script Active{
	void run(){
		while(true){
			if ( Game->Counter[CR_SCRIPT1] == 0 ) {
				if ( GetEquipmentA() == BoomerangID )
					Link->InputA = false;
				if ( GetEquipmentB() == BoomerangID )
					Link->InputB = false;
			}
			if ( Game->Counter[CR_SCRIPT2] == 0 ) {
				if ( GetEquipmentA() == EmberID )
					Link->InputA = false;
				if ( GetEquipmentB() == EmberID )
					Link->InputB = false;
			}
			if ( Link->Action == LA_SWIMMING && Link->Item[FlipperID] ) {
					Link->InputA = false;
					Link->InputB = false;
			}
			Waitframe();
		}
	}
}

//Credits
//Avataro
//Cukeman


item script BoomerangActive{
	void run(){
		Game->Counter[CR_SCRIPT1] --;
	}
}

//Credits
//Avataro


item script EmberActive{
	void run(){
		Game->Counter[CR_SCRIPT2] --;
	}
}

//Credits
//Avataro
//Cukeman

Hmm... it's preventing diving alright, but after getting the Level 2 Flippers Link still can't dive. Apparently leaving "Keep Lower Level Items" unchecked isn't enough...

 

Maybe an item script for Level 2 Flippers that removes the Level 1 Flippers from your inventory?



#6 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 07 March 2018 - 03:27 PM

I'd say for the flippers item ID set the ID of level 2 flippers instead and then add an "!" infront of Link->Item[FlipperID] like

!Link->Item[FlipperID]

So then you cant dive when you dont have level 2 flippers.


Edited by Avataro, 07 March 2018 - 03:28 PM.


#7 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 07 March 2018 - 05:12 PM

I'd say for the flippers item ID set the ID of level 2 flippers instead and then add an "!" infront of Link->Item[FlipperID] like

!Link->Item[FlipperID]
So then you cant dive when you dont have level 2 flippers.

 

 
Hmm, still no diving for either Flipper item

import "std.zh"


const int BoomerangID = 23; //set number to boomerang item ID
const int EmberID = 35; //set number to Ember item ID
const int FlipperID = 150; //set number to Flipper item ID


global script Active{
	void run(){
		while(true){
			if ( Game->Counter[CR_SCRIPT1] == 0 ) {
				if ( GetEquipmentA() == BoomerangID )
					Link->InputA = false;
				if ( GetEquipmentB() == BoomerangID )
					Link->InputB = false;
			}
			if ( Game->Counter[CR_SCRIPT2] == 0 ) {
				if ( GetEquipmentA() == EmberID )
					Link->InputA = false;
				if ( GetEquipmentB() == EmberID )
					Link->InputB = false;
			}
			if ( Link->Action == LA_SWIMMING && !Link->Item[FlipperID] ) {
					Link->InputA = false;
					Link->InputB = false;
			}
			Waitframe();
		}
	}
}


item script BoomerangActive{
	void run(){
		Game->Counter[CR_SCRIPT1] --;
	}
}


item script EmberActive{
	void run(){
		Game->Counter[CR_SCRIPT2] --;
	}
}


//Credits
//Avataro
//Cukeman

EDIT: Is it because there is no "Get" in "!Link->Item[FlipperID]" ?

 

Should it say "!Link->GetItem[FlipperID]" instead?

Or should it say having Flippers is "true"?


Edited by Cukeman, 07 March 2018 - 05:32 PM.


#8 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 07 March 2018 - 06:27 PM

 

 

Should it say "!Link->GetItem[FlipperID]" instead?

Or should it say having Flippers is "true"?

 

Oh no, that would be wrong syntax.

 

Maybe you have the boomerang or ember on your dive button without having enough of the respective script counter? (If that's the case you should add an "&& Link->Action != LA_SWIMMING" in lines 12 and 18)

 

Edit: whoops mistake


Edited by Avataro, 07 March 2018 - 07:51 PM.


#9 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 07 March 2018 - 07:30 PM

You are right, the ember and boomerang were on the A and B buttons with 0 ammo.

 

What does that... ohhh, the script is telling the dive button not to work because the ember and boomerang ammos are at 0

 

EDIT: It works now, YES! Awesome! Thanks so much!  :D

import "std.zh"


const int BoomerangID = 23; //set number to boomerang item ID
const int EmberID = 35; //set number to Ember item ID
const int FlipperID = 150; //set number to Flipper item ID


global script Active{
	void run(){
		while(true){
			if ( Game->Counter[CR_SCRIPT1] == 0 && Link->Action != LA_SWIMMING) {
				if ( GetEquipmentA() == BoomerangID )
					Link->InputA = false;
				if ( GetEquipmentB() == BoomerangID )
					Link->InputB = false;
			}
			if ( Game->Counter[CR_SCRIPT2] == 0 && Link->Action != LA_SWIMMING) {
				if ( GetEquipmentA() == EmberID )
					Link->InputA = false;
				if ( GetEquipmentB() == EmberID )
					Link->InputB = false;
			}
			if ( Link->Action == LA_SWIMMING && !Link->Item[FlipperID] ) {
					Link->InputA = false;
					Link->InputB = false;
			}
			Waitframe();
		}
	}
}


item script BoomerangActive{
	void run(){
		Game->Counter[CR_SCRIPT1] --;
	}
}


item script EmberActive{
	void run(){
		Game->Counter[CR_SCRIPT2] --;
	}
}


//Credits
//Avataro
//Cukeman

Edited by Cukeman, 08 March 2018 - 01:32 AM.


#10 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 March 2018 - 06:45 AM

Hmph. Perhaps I should add Link->CanDive.

...as this kind of thing is silly. In fact, I'll just add a flag on the flippers 'No Diving'. I seem to recall thinking of doing that at some prior point.
  • Avaro likes this


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users