Jump to content

Photo

[2.55] Side warp X doesn't activate unless you have specified item


  • Please log in to reply
6 replies to this topic

#1 Jenny

Jenny

    Hero of Time

  • Members
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 26 August 2021 - 05:27 AM

Basically I want a script that makes it so a side warp doesn't actually work until you have a specific item in your inventory. Before having the item, the screen exit would just work as normal (taking you to the next screen)

 

If this is at all possible I would appreciate the help.


  • Bagu likes this

#2 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 26 August 2021 - 05:57 AM

Maybe it' not exactly what you're looking for.

...but it would work.
This is a script that I wrote to set ALTERN tile- or sidewarps depending on a specific item.

So if you'd use it. you have to use a sidewarp, to the regular next screen (instead of scrolling).
...the script will change the destination screen, map, warp effect and warp return. When Link has the relevant item.

ffc script AlternWarp
{
    void run(int check_type, int warp, int screen_a, int screen_b, int dmap_a, int dmap_b, int type, int switcher)
    {
	while(true){
            if((check_type == 0) && (Link->Item[switcher])){
		Screen->SetSideWarp(warp, screen_a, dmap_a, type);
	    }
            else if((check_type == 1) && (Link->Item[switcher])){
		Screen->SetTileWarp(warp, screen_a, dmap_a, type);		
	    }
	    else if((check_type == 0) && (!Link->Item[switcher])){
		Screen->SetSideWarp(warp, screen_b, dmap_b, type);		
	    }
            else if((check_type == 1)  && (!Link->Item[switcher])){
		Screen->SetTileWarp(warp, screen_b, dmap_b, type);		
	    }
	    Waitframe();
	}
    }
}

(SORRY! I FORGOT TO POST THE SETUP)

 

D0 = "0"= sidewarp, "1" = tilewarp.
D1 = "0-3" = tile/-sidewarp A-D
D2 =  new dest. screen (with switch item)

D3 =  regular dest. screen (without switch item)

D4 =  new dest. map (with switch item)

D5 =  regular dest. map (without switch item)

D6 = Warp Effect
D7 = Switch Item


Edited by Bagu, 26 August 2021 - 06:00 AM.

  • Twilight Knight and Jenny like this

#3 Jenny

Jenny

    Hero of Time

  • Members
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 26 August 2021 - 06:02 AM

This achieves essentially the same purpose. Thank you very much!


  • Twilight Knight and Bagu like this

#4 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 26 August 2021 - 06:14 AM

I see Bagu also provided a script while I was quickly working on this one.

Perhaps this method will work better for you so I'll share anyway:

// Changes sidewarp A to the destination and type of sidewarp B if Link has a certain item
// You're ought to set the sides of sidewarp A beforehand
ffc script ChangeSideWarpIfItem
{
	void run(
		int itemID, // The item Link must have
		int changeSideWarpNumber, // The side warp number that we want to change (A = 0, B = 1, C = 2, D = 4)
		int copySideWarpNumber // The side warp number that we want to copy (A = 0, B = 1, C = 2, D = 4)
	) {
		// Do nothing if Link doesn't have the item
		while (!Link->Item[itemID]) Waitframe();
		
		// Get all properties of sidewarp we want to copy
		int warpDmap = Screen->GetSideWarpDMap(copySideWarpNumber);
		int warpScreen = Screen->GetSideWarpScreen(copySideWarpNumber);
		int warpType = Screen->GetSideWarpType(copySideWarpNumber);
		
		// Set sidewarp properties
		Screen->SetSideWarp(changeSideWarpNumber, warpScreen, warpDmap, warpType);
	}
}

This script will set the properties of 1 sidewarp to the other. That way it requires little scripting, no looking up what screen number/warp type you need and provides you with a versatile little script.

Set up is simple, D0 is the item ID, D0 the warp number to target (in your case A), D1 a warp number to copy (for example B). Note that it's an integer and warp A = 0, B = 1, C = 3, D = 4

It's also important you setup the warp side for warp A. If you don't want to have a warp there, but simply to the next screen, you'd have to set warp A to a scrolling warp that will take you to that next screen. (this is also the case with Bagu's script, I don't believe there is a way to set the warp side via scripting)

Here's an example how to setup:
LPED8Zm.png

ky0dO2s.png

 

Xra8IVi.png


And I suppose this would be more efficient code (less ZASM lines):
 

// Changes sidewarp A to the destination and type of sidewarp B if Link has a certain item
// You're ought to set the sides of sidewarp A beforehand
ffc script ChangeSideWarpIfItem
{
	void run(
		int itemID, // The item Link must have
		int changeSideWarpNumber, // The side warp number that we want to change (A = 0, B = 1, C = 2, D = 4)
		int copySideWarpNumber // The side warp number that we want to copy (A = 0, B = 1, C = 2, D = 4)
	) {
		// Do nothing if Link doesn't have the item
		while (!Link->Item[itemID]) Waitframe();
		
		// Get properties of the warp to copy and set them to the warp we want to change
		Screen->SetSideWarp(
			changeSideWarpNumber,
			Screen->GetSideWarpScreen(copySideWarpNumber),
			Screen->GetSideWarpDMap(copySideWarpNumber),
			Screen->GetSideWarpType(copySideWarpNumber)
		);
	}
}

Edited by Twilight Knight, 26 August 2021 - 06:16 AM.

  • ShadowTiger, Jenny and Bagu like this

#5 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 26 August 2021 - 06:22 AM

I see Bagu also provided a script while I was quickly working on this one.

Perhaps this method will work better for you so I'll share anyway:

// Changes sidewarp A to the destination and type of sidewarp B if Link has a certain item
// You're ought to set the sides of sidewarp A beforehand
ffc script ChangeSideWarpIfItem
{
	void run(
		int itemID, // The item Link must have
		int changeSideWarpNumber, // The side warp number that we want to change (A = 0, B = 1, C = 2, D = 4)
		int copySideWarpNumber // The side warp number that we want to copy (A = 0, B = 1, C = 2, D = 4)
	) {
		// Do nothing if Link doesn't have the item
		while (!Link->Item[itemID]) Waitframe();
		
		// Get all properties of sidewarp we want to copy
		int warpDmap = Screen->GetSideWarpDMap(copySideWarpNumber);
		int warpScreen = Screen->GetSideWarpScreen(copySideWarpNumber);
		int warpType = Screen->GetSideWarpType(copySideWarpNumber);
		
		// Set sidewarp properties
		Screen->SetSideWarp(changeSideWarpNumber, warpScreen, warpDmap, warpType);
	}
}

This script will set the properties of 1 sidewarp to the other. That way it requires little scripting, no looking up what screen number/warp type you need and provides you with a versatile little script.

Set up is simple, D0 is the item ID, D0 the warp number to target (in your case A), D1 a warp number to copy (for example B). Note that it's an integer and warp A = 0, B = 1, C = 3, D = 4

It's also important you setup the warp side for warp A. If you don't want to have a warp there, but simply to the next screen, you'd have to set warp A to a scrolling warp that will take you to that next screen. (this is also the case with Bagu's script, I don't believe there is a way to set the warp side via scripting)

Here's an example how to setup:
LPED8Zm.png

ky0dO2s.png

 

Xra8IVi.png

You are pretty quick, Twily!!!

...that's one reason, why I think, you'd make a good webmaster.

btw.... It's always intressting to see, how many ways there are, to script simialar functions.


I would suggest to use Twilight Knights script.
...it's written specificly for what you want to do
...and you can keep SCROLLING to the regular dest. screen.


Edited by Bagu, 26 August 2021 - 06:23 AM.

  • ShadowTiger, Twilight Knight and Jenny like this

#6 Jenny

Jenny

    Hero of Time

  • Members
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 26 August 2021 - 06:31 AM

Oh wow, thank you as well Twilight Knight! The help is all greatly appreciated.


  • Twilight Knight and Bagu like this

#7 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 26 August 2021 - 12:41 PM

I notice both responses seem to use 2.53 features only. Do you happen to be working in 2.55? If so, I could probably write a more compact script... regardless the others seem perfectly capable either way.


  • Bagu likes this


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users