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:
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.