PDA

View Full Version : Cane Of Somaria Is Here At Last



Nimono
01-14-2007, 10:39 PM
Rejoice, everyone! I have good news and bad news! Good news? Push flags work as Inherent Flags, but more importantly... I MADE A SCRIPT FOR THE CANE OF SOMARIA. AND IT WORKS!!!!


// Cane of Somaria- Changes certain attributes of FFC 32 on the
// current screen "Player" is on. It modifies the combo used,
// combo type, flags, etc. In the end, it looks like a block.
// This item will also change the location of the FFC so it
// always "spawns" 2 tiles away from Link in the direction he
// is currently facing. Becuase of limited knowledge, this
// script currently does not prevent you from walking onto the
// block. Any mention of "SomariaBlock" in the script refers to
// Freeform Combo 32. Have fun.

import "std.zh"
item script CaneSomaria
{
void run()
{
int sound=30;
ffc SomariaBlock= Screen->LoadFFC(32);
if(Link->Dir == 0)
{
SomariaBlock->X = Link->X;
SomariaBlock->Y = Link->Y - 16;
}
else if(Link->Dir == 1)
{
SomariaBlock->X = Link->X;
SomariaBlock->Y = Link->Y + 16;
}
else if(Link->Dir == 2)
{
SomariaBlock->X = Link->X - 16;
SomariaBlock->Y = Link->Y;
}
else if(Link->Dir == 3)
{
SomariaBlock->X = Link->X + 16;
SomariaBlock->Y = Link->Y;
}
float remainder = SomariaBlock->X % 16;
if ( remainder <= 8 )
{
SomariaBlock->X = SomariaBlock->X - remainder;
}
else
{
SomariaBlock->X = SomariaBlock->X + 16 - remainder;
}
SomariaBlock->Data = A;
SomariaBlock->CSet = B;
}
}

Replace A with the number of the combo this block uses and B with its Cset. It has no combo type BECAUSE IT CAN BE PUSHED REGARDLESS OF ENEMIES. The bad news? ...I can't make the block solid. Oh yeah, this script puts the block one space away from Link, but you can increase that if you wish. ;)

If you can make this block solid, let me know IMMEDIATELY so I can finally perfect this. By the way, yes, the FFC the Item (yes, ITEM) uses moves depending on where you are. Make it solid, and we've got the best puzzle EVER. Please help me. Oh yeah, thanks to C-Dawg for helping me learn how to script this. Thanks to him for also helping me with some code. Lastly, thanks to Fire Wizzrobe for telling me how to define "remainder" as a variable. :laughing: Enjoy.

Nimono
01-16-2007, 10:35 PM
Not sure what the rule for double-posting is here, but this is important.

I've revised the code. HERE IS CANE OF SOMARIA V2.0!


// Cane of Somaria- Changes attributes of combo 2 tiles in front of Link if it is not solid.
// If the combo is solid, this script does nothing.
// Variables:
// d0- The combo that the Cane switches a screen's combo to. Simply enter the combo number seen in the combo editor!
// d1- The CSet of the new combo. Only use 0-11 for best results.
// d2- Secret Flag of the new combo.
// d3- Inherent Flag of the new combo.
// d4- Combo type of the new combo.
// d5- Solidity of the new combo. Note: SOLIDITY USES THE BINARY SYSTEM. 1111 is total solidity, which is 15 in decimal.

import "std.zh"
item script CaneSomaria
{
void run()
{
int SomariaBlockX = Link->X;
int SomariaBlockY = Link->Y;
int d0 = 2123;
int d1 = 10;
int d2 = 61;
int d3 = 79;
int d4 = 0;
int d5 = 15;
if(Link->Dir == 0)
{
int BlockCheckY = Link->Y - 32;
int BlockCheckX = Link->X;
float BlockRmndrX = BlockCheckX % 16;
if ( BlockRmndrX <= 8 )
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if ( BlockRmndrY <= 8 )
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockY = SomariaBlockY - 32;
float remainder = SomariaBlockX % 16;
if ( remainder <= 8 )
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if ( remainderY <= 8 )
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = d0;
Screen->ComboC [SomariaBlockPosition] = d1;
Screen->ComboF [SomariaBlockPosition] = d2;
Screen->ComboI [SomariaBlockPosition] = d3;
Screen->ComboT [SomariaBlockPosition] = d4;
Screen->ComboS [SomariaBlockPosition] = d5;
}
else if(Link->Dir == 1)
{
int BlockCheckY = Link->Y + 32;
int BlockCheckX = Link->X;
float BlockRmndrX = BlockCheckX % 16;
if ( BlockRmndrX <= 8 )
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if ( BlockRmndrY <= 8 )
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockY = SomariaBlockY + 32;
float remainder = SomariaBlockX % 16;
if ( remainder <= 8 )
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if ( remainderY <= 8 )
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = d0;
Screen->ComboC [SomariaBlockPosition] = d1;
Screen->ComboF [SomariaBlockPosition] = d2;
Screen->ComboI [SomariaBlockPosition] = d3;
Screen->ComboT [SomariaBlockPosition] = d4;
Screen->ComboS [SomariaBlockPosition] = d5;
}

}
else if(Link->Dir == 2)
{
int BlockCheckY = Link->Y;
int BlockCheckX = Link->X - 32;
float BlockRmndrX = BlockCheckX % 16;
if ( BlockRmndrX <= 8 )
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if ( BlockRmndrY <= 8 )
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockX = SomariaBlockX - 32;
float remainder = SomariaBlockX % 16;
if ( remainder <= 8 )
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if ( remainderY <= 8 )
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = d0;
Screen->ComboC [SomariaBlockPosition] = d1;
Screen->ComboF [SomariaBlockPosition] = d2;
Screen->ComboI [SomariaBlockPosition] = d3;
Screen->ComboT [SomariaBlockPosition] = d4;
Screen->ComboS [SomariaBlockPosition] = d5;
}
}
else if(Link->Dir == 3)
{
int BlockCheckY = Link->Y;
int BlockCheckX = Link->X + 32;
float BlockRmndrX = BlockCheckX % 16;
if ( BlockRmndrX <= 8 )
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if ( BlockRmndrY <= 8 )
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockX = SomariaBlockX + 32;
float remainder = SomariaBlockX % 16;
if ( remainder <= 8 )
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if ( remainderY <= 8 )
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = d0;
Screen->ComboC [SomariaBlockPosition] = d1;
Screen->ComboF [SomariaBlockPosition] = d2;
Screen->ComboI [SomariaBlockPosition] = d3;
Screen->ComboT [SomariaBlockPosition] = d4;
Screen->ComboS [SomariaBlockPosition] = d5;
}
}
}
}
}

For some reason, it compiler expects an extra } at the end, which is LINE 255. Yes, TWO HUNDRED FIFTY-FIVE LINES.

The d-variables are for all 6 of the combo settings. I listed what each is at the top, but I want you to know this: THE VALUE OF COMBOS IS IN BINARY. For example, 15 in decimal equals 1111 in binary, which, when put as the value for ComboS, makes the affected combo totally solid. I'd suggest using only 0 or 15 for the combo. However.... If you'd rather have the combo be half solid, for Caves... Well, let me check first and I'll get back to you. ;)

My new version uses an actual combo instead of an FFC. To make things better: THIS BLOCK CAN BE PUSHED AND IS SOLID. Thus, I'm almost done. Plus, the block won't spawn on solid combos! I coded THAT myself. ;) The bugs? The item does nothing when used in any direction except north. I need someone to check this for me. Also, I have no idea (yet) how to make only one block appear at a time. To go with the tradition of OoA, the block has an inherent Sword trigger. You can remove that if you wish by writing 0 (or any other flag number) to d3. Other things?

...What? It's not enough that the block is solid? And can be removed? Oh well. Trigger one block, AND THEY'RE ALL TRIGGERED. It's because I used 2 flags already. Big deal. Oh yeah, hope you like it. Oh yeah, and by changing the solidity value checker-thing, you could make a Cane that creates a Cave if you use it on a wall with full solidity.... O_o

ENJOY!

_L_
01-18-2007, 12:37 AM
Well, in both LttP and FSA, when you waved the Cane and a block was already onscreen, the block vanished and released four magic beams in compass directions.

You can check to see if a block is already onscreen by ensuring that the block combo ID is never used elsewhere in the quest, and iterating through the screen combos and checking if instances of that combo ID are present.


for (int i=0; i<176; i++)
if (Screen->ComboD[i]==d0)
{
//remove block, and place four "wand magic" weapons at its location
}
I don't think weapon creation exists in ZScript yet, but I've seen ZASM codes for it.

Nimono
01-18-2007, 01:45 PM
_L_, jman, other devs, you may want to get ready for an onslaught of requests for the Cane of Somaria to be implemented straight into ZC. Why?

No words can express the joy I have because... I JUST PERFECTED THE CANE OF SOMARIA. Granted, right now it's only the Oracle of Ages version, but I'll work on the LttP/FSA version at a later time, when making Wand Magic spawn in 4 different directions is a bit more feasible. So, without further ado, I bring you...

THE CANE OF SOMARIA: ORACLE OF AGES VERSION. This is version 3.0 of my Cane of Somaria script. It has EVERYTHING: Only one block can be on the screen at a time, it can be pushed, slashing it gets rid of it, and anything you'd expect the OoA Cane of Somaria to do (Minus any picking up, of course).


// Cane of Somaria (OoA version)- When used, this item will create a block in front of Link if the block in front of him isn't solid.
// If the combo is solid, this script does nothing.
// Variables:
// Cmb- The combo that the Cane switches a screen's combo to. Simply enter the combo number seen in the combo editor!
// CmbC- The CSet of the new combo. Only use 0-11 for best results.
// CmbS- Secret Flag of the new combo.
// SomariaCheck- A special variable used only for checking if a Somaria Block is already on-screen. Creating a Block
// sets this Variable to 1. Destroying one sets it to 0. This variable is checked only by one function. DO NOT MESS WITH IT!!!!
// CmbR- The combo the Block resets to when SomariaCheck is set to 1 when you use this item.
// CmbRC- CSet the of the reset combo.
// CmbRS- Secret Flag of the reset combo.

import "std.zh"
item script CaneSomariaOoA
{
int SomariaBlockX = 0;
int SomariaBlockY = 0;
int SomariaCheck = 0;
int SomariaBlockPosition = 0;
int CurScreen = 0;
int LastScreen = 0;
int CurMap = 0;
int LastMap = 0;
int Cmb = A;
int CmbC = B;
int CmbS = C;
int CmbR = D;
int CmbRC = E;
int CmbRS = F;

void run()
{
CurScreen = Game->GetCurScreen();
CurMap = Game->GetCurMap();
if (CurScreen != LastScreen)
{
SomariaCheck = 0;
}
else if (CurMap != LastMap)
{
SomariaCheck = 0;
}
if (SomariaCheck == 1)
{
SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
if (Screen->ComboS [SomariaBlockPosition] == 15)
{
Screen->ComboD [SomariaBlockPosition] = CmbR;
Screen->ComboC [SomariaBlockPosition] = CmbRC;
Screen->ComboF [SomariaBlockPosition] = CmbRS;
SomariaCheck = 0;
}
}
if (Link->Dir == 0)
{
int BlockCheckY = Link->Y - 32;
int BlockCheckX = Link->X;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if (BlockRmndrY <= 8)
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockY = Link->Y - 32;
SomariaBlockX = Link->X;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}
}
else if (Link->Dir == 1)
{
int BlockCheckY = Link->Y + 32;
int BlockCheckX = Link->X;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if (BlockRmndrY <= 8)
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockY = Link->Y + 32;
SomariaBlockX = Link->X;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}

}
else if (Link->Dir == 2)
{
int BlockCheckY = Link->Y;
int BlockCheckX = Link->X - 32;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if (BlockRmndrY <= 8)
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockX = Link->X - 32;
SomariaBlockY = Link->Y;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}
}
else if (Link->Dir == 3)
{
int BlockCheckY = Link->Y;
int BlockCheckX = Link->X + 32;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if ( BlockRmndrY <= 8 )
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockX = Link->X + 32;
SomariaBlockY = Link->Y;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}
}
LastScreen = CurScreen;
LastMap = CurMap;
SomariaCheck = 1;
}
}
Replace "A" with the number of the combo the Cane will "spawn". If you wish to have a poof, use the "poof" animation as the starting combo and have it cycle to the pushable block. Just... Be careful. This script places the block on layer 0, so try to put the ground on Layers 1 or 2, okay? And give the poof the push flag, too. :) "B" is the Cset of the starting combo. "C" is its Secret Flag. I have it set to 79 because in OoA, hitting the block with your Sword made it vanish. ;) You can replace that with anything else if you want, EXCEPT THE PUSH FLAG. Unless you LIKE pushing non-solid ground. No fun, is it? That's why every pushable combo in the cycle MUST HAVE THE PUSH FLAG AS AN INHERENT COMBO. That way it vanishes. Since trigger flags remove themselves when you trigger them (even as normal flags), it's perfectly fine to use the Sword flag as a normal flag. However, no singular flags can be put on them this way. May I suggst 2.11's Slash->Next combo? Seriously, that'd be MUCH better (WHY DIDN'T I THINK OF THAT UNTIL JUST NOW?! XD). So, you can just leave "C" at 0 if you wish. "D" is the combo that is used to "remove" the Block if one is on the screen. Set it like you would Cmb, but remember, this one HAS to cycle back to normal, walkable ground! "E" is the CSet the combo uses when it "resets" to normal ground. Simple, no? Finally, "F" is, as you'd expect, the Secret Flag of the combo when "reset".

If you create a block but leave the screen, SomariaCheck (the Variable that tells if a Block is on the screen or not) will stay at 1 (Block is on the screen). Thus, you'd expect the script to try to remove a Block that isn't there anymore, right? That's what the CurScreen, LastScreen, CurMap, and LastMap variables are for. If CurScreen doesn't equal LastScreen, SomariaCheck is set to 0. If it does, then if CurMap and LastMap don't equal each other, SomariaCheck is set to 0. If all are equal to their Last counterparts, nothing happens.

But what if you make a Block, leave the screen, and come back without making a block on the other screen? The Block will be gone, but SomariaCheck is still 1! Wouldn't that make the script try to "remove" a Block that isn't there? Not a chance! I figured that in case something went wrong in the checking of the value of SomariaCheck, another check would be needed just in case. I never knew that THIS is what it'd be for. After checking the value of SomariaCheck, if it's 1, the script ALSO checks for Total Solidity (Screen->ComboS[] == 15) at the SomariaBlock's last location. If total solidity is there, the values of CmbR, CmbRC, and CmbRS are placed there. If not, it obviously means you switched screens and came back, so there's no Block there. And it actually works. It then resets SomariaCheck back to 0 (Just for completeness and because of common sense- It's not really needed, but SomariaCheck is 1 if there IS a block on the screen, so common sense says that it doesn't need to be 1 anymore if a block isn't there. ;)).

The rest places the block onto the screen. Now... I'd suggest you leave the script alone after this point, but just in case you wish to make the block spawn one tile in front of you instead, here you go:


// Cane of Somaria (OoA version)- When used, this item will create a block in front of Link if the block in front of him isn't solid.
// If the combo is solid, this script does nothing.
// Variables:
// Cmb- The combo that the Cane switches a screen's combo to. Simply enter the combo number seen in the combo editor!
// CmbC- The CSet of the new combo. Only use 0-11 for best results.
// CmbS- Secret Flag of the new combo.
// CmbI- Inherent Flag of the new combo.
// CmbT- Combo type of the new combo.
// CmbS- Solidity of the new combo. Note: SOLIDITY USES THE BINARY SYSTEM. 1111 is total solidity, which is 15 in decimal.
// SomariaCheck- A special variable used only for checking if a Somaria Block is already on-screen. Creating a Block
// sets this Variable to 1. Destroying one sets it to 0. This variable is checked only by one function. DO NOT MESS WITH IT!!!!
// CmbR- The combo the Block resets to when SomariaCheck is set to 1 when you use this item.
// CmbRC- CSet the of the reset combo.
// CmbRS- Secret Flag of the reset combo.

import "std.zh"
item script CaneSomariaOoA
{
int SomariaBlockX = 0;
int SomariaBlockY = 0;
int SomariaCheck = 0;
int SomariaBlockPosition = 0;
int CurScreen = 0;
int LastScreen = 0;
int CurMap = 0;
int LastMap = 0;
int Cmb = 2123;
int CmbC = 10;
int CmbS = 79;
int CmbR = 0;
int CmbRC = 2;
int CmbRS = 0;

void run()
{
CurScreen = Game->GetCurScreen();
CurMap = Game->GetCurMap();
if (CurScreen != LastScreen)
{
SomariaCheck = 0;
}
else if (CurMap != LastMap)
{
SomariaCheck = 0;
}
if (SomariaCheck == 1)
{
SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
if (Screen->ComboS [SomariaBlockPosition] == 15)
{
Screen->ComboD [SomariaBlockPosition] = CmbR;
Screen->ComboC [SomariaBlockPosition] = CmbRC;
Screen->ComboF [SomariaBlockPosition] = CmbRS;
SomariaCheck = 0;
}
}
if (Link->Dir == 0)
{
int BlockCheckY = Link->Y - 16;
int BlockCheckX = Link->X;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if (BlockRmndrY <= 8)
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockY = Link->Y - 16;
SomariaBlockX = Link->X;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}
}
else if (Link->Dir == 1)
{
int BlockCheckY = Link->Y + 16;
int BlockCheckX = Link->X;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if (BlockRmndrY <= 8)
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockY = Link->Y + 16;
SomariaBlockX = Link->X;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}

}
else if (Link->Dir == 2)
{
int BlockCheckY = Link->Y;
int BlockCheckX = Link->X - 16;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if (BlockRmndrY <= 8)
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockX = Link->X - 16;
SomariaBlockY = Link->Y;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}
}
else if (Link->Dir == 3)
{
int BlockCheckY = Link->Y;
int BlockCheckX = Link->X + 16;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if ( BlockRmndrY <= 8 )
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockX = Link->X + 16;
SomariaBlockY = Link->Y;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}
}
LastScreen = CurScreen;
LastMap = CurMap;
SomariaCheck = 1;
}
}

Same stuff as before, but all instances of the number "32" have been replaced with "16". ;) Have fun, and a special demo will come soon featuring the Cane of Somaria and many things you can do with it! :D

Oh yeah, and as for the LttP/FSA-style Cane, I'm planning on doing that next. You're not the only one who assumed I was making the original Cane of Somaria, _L_. :p

Dlbrooks33
01-18-2007, 09:43 PM
He got the idea of doing this from my game :). Its pretty good too.

Nimono
01-18-2007, 09:55 PM
He got the idea of doing this from my game :). Its pretty good too.

I already told you, I DIDN'T GET THE IDEA OF DOING THIS FROM YOUR GAME. You're just trying to steal my credit. :mad:

Oh, speaking of credit... Heh, I forgot to give it.

C-Dawg: Helping me understand ZScript and a few commands I had trouble comprehending. Also gave me the code I used for positioning the block. :)
Fire Wizzrobe: Helping me a tiny bit with my script by giving me a few pieces of code to use for lining the block up JUST RIGHT. ;)
Saffith: Helping me greatly clean up my code by alerting me to some of my errors. Also taught me how to declare global variables. XD
Nintendo: Making the Cane of Somaria. DUH! :laughing:

:D Did I forget anyone? And no Revfan, you don't get credit for the little mentions of ZASM you did. How would that have helped? :p

C-Dawg
01-19-2007, 10:31 AM
Good job.

But, holy shit, "I'd like to thank all the people who made this possible!"? You didn't win an academy award, bro. Chill out.

Nimono
01-19-2007, 12:26 PM
Good job.

But, holy shit, "I'd like to thank all the people who made this possible!"? You didn't win an academy award, bro. Chill out.

Sorry. :D I just wanted to show my appreciation. Is that so wrong? :rolleyes: But in all honesty, I was about to give up on the script. It took me a little while to remember that at first, no matter what the values of CurScreen, LastScreen, CurMap, and LastMap were set to, the end result would be the same- SomariaCheck would be 0. :laughing: I don't know why it took me as long as itdid to figure that out. I mean, it was so obvious.

FIERCEDEITY
01-19-2007, 07:01 PM
how do you get the item after you load the script?

Nimono
01-19-2007, 07:09 PM
Give the script to an item that can already be placed in the subscreen AND be used, like the Wand! :D

FIERCEDEITY
01-19-2007, 07:41 PM
ok, but HOW exactly do I do that?
(sorry, i'm new to scripting)

Nimono
01-19-2007, 08:12 PM
No, it's alright. I should stop expecting people to know how to do it. Okay, follow these steps:

Step 1: Importing and compiling the script. (You can skip this if you know how, or have already done it.)

1: Start by saving the script as a *.z file.
2: Open up ZQuest's "Compile ZScript" dialogue. (It's under "Tools", at the very bottom.)
3: Click on "Import ZScript".
4: Choose the new *.z file you just made. Done with importing.
5 (optional): If required, edit certain values in the script. For my script, those values are listed. And don't tell me "Oh, I don't know how to script, so you must tell me what to place there". THE INSERTION OF THE VALUES HAS NOTHING TO DO WITH SCRIPTING. Just insert the value as if you were using numbers to place a combo onto the screen. Say you wanted to use Combo 2, CSet 5, Flag 60 for my Block. You'd set Cmb to 2, CmbC to 5, and CmbS to 60. Cmb is the combo number (look in the combo editor for those values), CmbC is the CSet (You must not have read the Readme if you don't know the applicable (or, if you prefer, AVAILABLE) values), and CmbS is the secret flag to place on it. I'd suggest leaving that at 79 or setting it to 0.
6: Click on "Compile".
7: If all goes well, it'll say "Press any key to continue" after "Assembling". Click. Now, depending on what word was used in "___ script script_name", you must place the script in the appropriate tab. If it was "ffc", don't change tabs. "global" must be placed in global (I assume), and "item" is placed in the items tab. This script is an Item Script, so you know it goes in the Item tab. ;) Put your script in the first open file, and... You're done. :)

Step 2: Placing the Item Script on an Item.

1: Go to Quest>Graphics>Sprites>Items.
2: Find an item you wish to give a script to and double-click it. For this script, I suggest the Wand.
3: Go to the Actions tab.
4: Edit the box labelled "Script". Place the number of the script you wish it to use in this box. Clcik okay. You're done. :)

Please remember that items use ITEM SCRIPTS, not Freeform Combo (FFC) scripts! So don't try to import a script as an FFC script and expect to be able to attach it to an item! It'll read from the Item tab instead!

FIERCEDEITY
01-19-2007, 09:42 PM
when i load my zquest file, it says:
"Reading Maps...Okay,
Bad token! Searching...
Found.
Reading Color Data..."
And then it crashes...
this started happening when i imported the zscript :(
WHAT'S WRONG?! :'(

bluedeath
01-19-2007, 09:51 PM
Not sure what the rule for double-posting is here, but this is important.
use the edit button.

_L_
01-21-2007, 02:10 AM
A suggestion for the current script:

* There should probably be some provisions for cases where you create a Somaria block on top of a combo with a Block Trigger or Block Hole flag.

Nimono
01-21-2007, 02:21 PM
A suggestion for the current script:

* There should probably be some provisions for cases where you create a Somaria block on top of a combo with a Block Trigger or Block Hole flag.

You're right! Well, right now, I'm working on a Shovel script. Since I'm making it end the script when you use it in front of a certain combo(s).... Once I get the working and understand it, I'll use that sort of thing in this script so it won't spawn on any combo you'd think about putting Block Holes on, like Direct Warps. But then there's the problem of your new combo types! XD Oh well. I'll fix it when I get there, alright? ;)

_L_
02-06-2007, 10:59 AM
A-and another thing! I haven't checked yet, but maybe if you set Link->Action to LA_ATTACKING during the script, Link would make the "using item" gesture while it's happening. And maybe with those drawing commands you could draw the Cane into Link's hand.

Nimono
02-06-2007, 12:44 PM
A-and another thing! I haven't checked yet, but maybe if you set Link->Action to LA_ATTACKING during the script, Link would make the "using item" gesture while it's happening. And maybe with those drawing commands you could draw the Cane into Link's hand.

Huh??? Is that command even in Beta 16c?

By the way... Uhh.... I don't think I could make it trigger Block Holes or Triggers. Block Holes- Most likely not. Triggers.... Eh, there'd have to be a way to make Secret Flags trigger by way of script for that. Oh yeah, block holes.... Umm.... Remember in OoA how if you tried to create the Somaria Block on top of a pit, it'd vanish. Soo.... Basically, I'd just have to make it not appear if you try to make it on a pit.

By the way, do you have any idea how to delay the creation of the block? Currently, the way it stands, the block is made the instant you use the Cane, but in games that had the Cane, it appeared AFTER the Animation reached the point where the Cane is if front of Link...

The_Amaster
02-10-2007, 10:42 PM
Wait...so I set the Cmb variables at the very top to be my combos, but I leave the X and Y pos alone, right? And is the reset combo what appears when the block dissapears?

Oh, and for some reason, whenever I try to import this or your shovel script, I get an error saying that it "can't open or parse input file"
I havent tried with any other scripts, so it may be scripts in general.

Nimono
02-10-2007, 10:50 PM
Wait...so I set the Cmb variables at the very top to be my combos, but I leave the X and Y pos alone, right? And is the reset combo what appears when the block dissapears?

Oh, and for some reason, whenever I try to import this or your shovel script, I get an error saying that it "can't open or parse input file"
I havent tried with any other scripts, so it may be scripts in general.

Hmmm.... Did you open it in 119? Because it doesn't compile right in that version. There was a compiler bug. Open it in 2.11 beta 16c. Yes, leave X and Y pos alone. Yes, the reset combo is what appears when the block vanishes. THIS is why your ground MUST be on Layers 1 or 2....

The_Amaster
02-10-2007, 10:56 PM
No, I'm in 16c. I'm not sure what the problem is.
I even tried it in ol' 16. Same error.

Nimono
02-11-2007, 12:01 AM
O.o I have no clue what the problem is. You're probably specifying something invalid.

SaiyanKirby
08-27-2007, 11:42 AM
(I know this is a really old topic, but whatever.)

Open it in 2.11 beta 16c.
Where do I download 2.11? The newest version shown on Zeldaclassic.com is 2.10, which apperently doesn't have any support for scripts, because I don't see anything about scripts in it.

C-Dawg
08-27-2007, 11:59 AM
Or a dummy item you're not using for anything else.

PROTIP: Any item can be made "useable" or "selectable" in your sub-screen editor. So some items you might not be using for anything else, like the letter or something, can be made into a new custom item. At least until the z255 blank items are working properly.

Russ
08-27-2007, 12:01 PM
SaiyanKirby, you can dowload 2.11 betas at shardstom.com (http://shardstorm.com). But note they can be stable, but they can also be extremely buggy.

ShadowMancer
08-27-2007, 02:26 PM
By the way, do you have any idea how to delay the creation of the block? Currently, the way it stands, the block is made the instant you use the Cane, but in games that had the Cane, it appeared AFTER the Animation reached the point where the Cane is if front of Link... There are 2 ways I can think of to do this.
1> Make a global varible (somthing like BLOCK_TIMER = -1) (I like to use all caps for global vars just a personal pref)
in the item script instead of createing tohe block stright foward just have the item script set the global varible to something other thatn -1 (the number of frames to wait)
Then make a global script that will actually create the block after the timer reaches 0
something like:



if (BLOCK_TIMER != -1) {
if (BLOCK_TIMER > 0) {
BLOCK_TIMER-=1;
Waitframe();
}
else {
BLOCK_TIMER = -1;
//Put script to create block here
}
}


2>The other way would be to use a similar technique but instead of a global script use a FFC for the block itself (This may require an almost entire rewrite) But this could also achive Lttp style; just make the FFC damage enemies that are nearby (i wrote a simple script to do that). You can also make it explode into four parts with FFC's and a enemy damage script, and if you modify my pickup rock script you could lift and throw the block as well.

The_Amaster
11-23-2007, 01:08 PM
Okay, I've finally worked up the confidence in ZScript to try importing this and...it works! Gloriously, it works. I love it. However, I do have one question. (This cna apply to anyone, not just Matthew)

I want the item to be useable everywhere, which raises the undercombo problem. Is there any way to somehow make the undercombo noexistent, or transparent, or something where I don't have to draw the ground for EVERY SCREEN on layers 1 or 2?

EDIT: And I just noticed a possible bug/mistake on my part. If you create a block, and then push it, you can create another block without removing the first.

Nimono
11-23-2007, 01:34 PM
Okay, I've finally worked up the confidence in ZScript to try importing this and...it works! Gloriously, it works. I love it. However, I do have one question. (This cna apply to anyone, not just Matthew)

I want the item to be useable everywhere, which raises the undercombo problem. Is there any way to somehow make the undercombo noexistent, or transparent, or something where I don't have to draw the ground for EVERY SCREEN on layers 1 or 2?

EDIT: And I just noticed a possible bug/mistake on my part. If you create a block, and then push it, you can create another block without removing the first.

Yes, I know about that stuff. I'm currently pondering how to fix that. I have an idea, but I can't do it without finding some way to check a combo's x and y seperately instead of together. If anyone knows how to do this, let me know IMMEDIATELY!!

Joe123
11-23-2007, 01:37 PM
Can't you do this with ComboAt?

The_Amaster
11-23-2007, 04:08 PM
Idea! Although in my ignorance of scripting, I have no idea weather it's plausable or not.

Is it posible to set it so that the script creates the block on level 1. What if one of the variables was a specially set aside(by the questmaker) blank screen soley for the purpose of layering the block. Then the undercombo doesn't matter.

Nimono
11-23-2007, 07:11 PM
Can't you do this with ComboAt?

No. Unless you only want to check the position right in front of Link. I have to check every. single. combo for the block. Here's my plan:

1: Check for the block
2: If found, set 4 variables to the combos on all four spots around it
3: Set its current location
4: If moved, place the reset combo where it once was, set new location, and set the reset combo to the combo it overwrote

Yeeeeah. But since ComboAt and that stuff _L_'s Switch Gate script uses to check for the blocks use one single number... I can't change the x or y positions to work. Thus, no script. D: If anyone's got an idea how to do "for(int i, blah blah blah)" so it keeps the X and Y seperate until ready to be used to look for the block, let me know IMMEDIATELY. I can't perfect the script without it.

Gleeok
11-24-2007, 04:46 AM
Howabout using the item script in cunjunction with a ffc script. FFC's arent solid, but I beleive you can fein solidity by changing the combo at the ffc x,y location to solid, push type. This would also give the cane an ffc animation, sfx, etc, as well. As for the undercombos, I really don't know if your able to fix that, but you're a much better scripter than I am. ;) You could add a ffc->Data check, variable, or something similar for pressing B again to shoot projectiles in 4 directions also. Just throwing out idea's. It's a cool script.

Nimono
11-24-2007, 12:30 PM
Howabout using the item script in cunjunction with a ffc script. FFC's arent solid, but I beleive you can fein solidity by changing the combo at the ffc x,y location to solid, push type. This would also give the cane an ffc animation, sfx, etc, as well. As for the undercombos, I really don't know if your able to fix that, but you're a much better scripter than I am. ;) You could add a ffc->Data check, variable, or something similar for pressing B again to shoot projectiles in 4 directions also. Just throwing out idea's. It's a cool script.

I'm not using JUST an item script anymore. I know you don't know all that I'm doing, but it's not helping trying to assume that I'm trying to keep it nothing but an item script, now is it? It'll be Item + Global script. Not FFC, since some of you might be using so many FFCs on a single screen, it wouldn't be right to use an FFC script for this. Plus, you'd have to set it for every screen you could possibly start on. Which would you rather do? Put an FFC script on every screen you can start on so the Cane can be used? Or just load the item and global scripts, and just set the item script to an item, and be done with it? Also, FFC = No, because I could never get them to be solid without making the whole SCREEN solid. (And worse yet, THEY CAN'T WORK WITH ANY FLAGS.)

idontknow
12-16-2007, 10:58 PM
Hey is it possible to modify this script so that you can only do it once per screen and you can't delete the block once you create it, however, it auomtatically disappears when you leave the screen & comes back?

Nimono
12-17-2007, 12:20 AM
Hey is it possible to modify this script so that you can only do it once per screen and you can't delete the block once you create it, however, it auomtatically disappears when you leave the screen & comes back?

Yup.


// Cane of Somaria (OoA version)- When used, this item will create a block in front of Link if the block in front of him isn't solid.
// If the combo is solid, this script does nothing.
// Variables:
// Cmb- The combo that the Cane switches a screen's combo to. Simply enter the combo number seen in the combo editor!
// CmbC- The CSet of the new combo. Only use 0-11 for best results.
// CmbS- Secret Flag of the new combo.
// SomariaCheck- A special variable used only for checking if a Somaria Block is already on-screen. Creating a Block
// sets this Variable to 1. Destroying one sets it to 0. This variable is checked only by one function. DO NOT MESS WITH IT!!!!
// CmbR- The combo the Block resets to when SomariaCheck is set to 1 when you use this item.
// CmbRC- CSet the of the reset combo.
// CmbRS- Secret Flag of the reset combo.


int SomariaBlockX = 0;
int SomariaBlockY = 0;
int SomariaCheck = 0;
int SomariaBlockPosition = 0;
int CurScreen = 0;
int LastScreen = 0;
int CurMap = 0;
int LastMap = 0;
const int Cmb = A;
const int CmbC = B;
const int CmbS = C;
const int NoBlock = D;

import "std.zh"
item script CaneSomariaOoA
{
void run()
{
CurScreen = Game->GetCurScreen();
CurMap = Game->GetCurMap();
if (CurScreen != LastScreen)
{
SomariaCheck = 0;
}
else if (CurMap != LastMap)
{
SomariaCheck = 0;
}
if (SomariaCheck == 1)
{
Game->PlaySound[NoBlock];
}
if (Link->Dir == 0)
{
int BlockCheckY = Link->Y - 32;
int BlockCheckX = Link->X;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if (BlockRmndrY <= 8)
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockY = Link->Y - 32;
SomariaBlockX = Link->X;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}
}
else if (Link->Dir == 1)
{
int BlockCheckY = Link->Y + 32;
int BlockCheckX = Link->X;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if (BlockRmndrY <= 8)
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockY = Link->Y + 32;
SomariaBlockX = Link->X;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}

}
else if (Link->Dir == 2)
{
int BlockCheckY = Link->Y;
int BlockCheckX = Link->X - 32;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if (BlockRmndrY <= 8)
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockX = Link->X - 32;
SomariaBlockY = Link->Y;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
int SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}
}
else if (Link->Dir == 3)
{
int BlockCheckY = Link->Y;
int BlockCheckX = Link->X + 32;
float BlockRmndrX = BlockCheckX % 16;
if (BlockRmndrX <= 8)
{
BlockCheckX = BlockCheckX - BlockRmndrX;
}
else
{
BlockCheckX = BlockCheckX + 16 - BlockRmndrX;
}
float BlockRmndrY = BlockCheckY % 16;
if ( BlockRmndrY <= 8 )
{
BlockCheckY = BlockCheckY - BlockRmndrY;
}
else
{
BlockCheckY = BlockCheckY + 16 - BlockRmndrY;
}
int BlockPosition = (BlockCheckY & 240)+(BlockCheckX>>4);
if (Screen->ComboS [BlockPosition] == 0)
{
SomariaBlockX = Link->X + 32;
SomariaBlockY = Link->Y;
float remainder = SomariaBlockX % 16;
if (remainder <= 8)
{
SomariaBlockX = SomariaBlockX - remainder;
}
else
{
SomariaBlockX = SomariaBlockX + 16 - remainder;
}
float remainderY = SomariaBlockY % 16;
if (remainderY <= 8)
{
SomariaBlockY = SomariaBlockY - remainderY;
}
else
{
SomariaBlockY = SomariaBlockY + 16 - remainderY;
}
SomariaBlockPosition = (SomariaBlockY & 240)+(SomariaBlockX>>4);
Screen->ComboD [SomariaBlockPosition] = Cmb;
Screen->ComboC [SomariaBlockPosition] = CmbC;
Screen->ComboF [SomariaBlockPosition] = CmbS;
}
}
LastScreen = CurScreen;
LastMap = CurMap;
SomariaCheck = 1;
}
}

That should do it. :D If it doesn't, I'll check it out later...

idontknow
12-17-2007, 03:30 AM
I'm getting the following when i try to compile the above script.

line 22: syntax error: unexpected identifier, expecting number, on token A
Fatal Error P00: can't open or erase input file!

I am doing it "as is" however, so i haven't put in any variables or anything. Do i need to edit this script prior to compiling it? If so, how exactly?

idontknow
12-17-2007, 07:42 AM
Actually, i changed my mind--i want to know if this is possible for you to do & if so, can you script this:

First of all, make it so that when he uses this item, he does the "casting" animation that he does for Nayru's Love. Additionally, sound effect #43 plays. (for whatever reason, when its a custom item, no sound plays by simply inputing 43 into the "sound" box in the item editor) I want it to appear as if he's summoning a copy of himself. The object that appears is a single-tile statue of himself that he can push. It will be a required item for my quest. It's basically used only in certain rooms, like when there's a push block puzzle.

Make it so that it can only appear on certain combos; perhaps either the first "Unused" combo type, or it can only appear on flag #98, General Purpose 1 (Scripts). Either way, the script checks to see that Link is standing 2 tiles away (or 1 tile away if using the 1-tile script) from an "unused" combo or flag 98 (preferablly the latter, the flag, actually). If so, then it will create the block. If not, nothing happens.

The reason i want this is so that I can limit the use of this item so that it can only be done on specific tiles, identical looking tiles actually. I want this to be a required item for block puzzles but i dont want it able to appear on some tiles, such as those with a layer on them, like dungeon borders. Additionally, if i can make it appear only on identical looking combos, i can make the block first appear as a "poof" by taking spawn tiles & overlapping them with the floor tile on which the block can appear.

And lastly, if you try to use it on a space with which you already have used it (so the space is already occupied by a CoS block / statue, then it won't let you do it. Right now, it appears as if it does nothing, but it actually creates a copy of the block / statue right over the existing one, thereby causing you to lose magic. (I have a script assigned to it but it also consumes magic) If you don't have enough magic, you can't use it (and that does happen apparently without a script) Except as is, you continue to lose magic when you use it on a space that you already used it on.