Log in

View Full Version : Item-2: Item-2 is here! Get your Shovels ready!



Nimono
02-09-2007, 04:03 PM
Okay, I couldn't resist. I basically did the same thing back at PureZC. SUE ME. :tongue:

Okay, here you go. This is the Oracles Shovel!


// Shovel- Well, what do you THINK it does? :P It digs up the ground directly in front of you,
// provided it's not solid or a certain combo. The combos it can't dig up are yours to decide!
// However, I give you three solid combos it CAN dig up, so use them wisely.
// Variables:
// ComboDug- Combo that appears when you dig in a diggable spot.
// Combo1- First Combo you can't dig in.
// Combo2- 2nd Combo you can't dig in.
// Combo3- 3rd No-Dig Combo.
// Combo4- 4th No-Dig Combo.
// Combo5- 5th No-Dig Combo.
// ComboS1- First Solid Combo you can dig in.
// ComboS2- 2nd Solid Dig Combo.
// ComboS3- 3rd Solid Dig Combo.

import "std.zh"
item script Shovel
{
int ComboDug = 0;
int Combo1 = 0;
int Combo2 = 0;
int Combo3 = 0;
int Combo4 = 0;
int Combo5 = 0;
int ComboS1 = 0;
int ComboS2 = 0;
int ComboS3 = 0;
int ComboX = 0;
int ComboY = 0;
int ComboSDug = 0;

void run()
{
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->ComboD [BlockPosition] == Combo1 || Screen->ComboD [BlockPosition] == Combo2 || Screen->ComboD [BlockPosition] == Combo3 || Screen->ComboD [BlockPosition] == Combo4 || Screen->ComboD [BlockPosition] == Combo5 || Screen->ComboD [BlockPosition] ==ComboDug) || (Screen->ComboS [BlockPosition] == 15 && (Screen->ComboD [BlockPosition] != ComboS1 && Screen->ComboD [BlockPosition] != ComboS2 && Screen->ComboD [BlockPosition] != ComboS3)) )
{
Game->PlaySound(6);
Quit();
}
ComboY = Link->Y - 16;
ComboX = Link->X;
float remainder = ComboX % 16;
if (remainder <= 8)
{
ComboX = ComboX - remainder;
}
else
{
ComboX = ComboX + 16 - remainder;
}
float remainderY = ComboY % 16;
if (remainderY <= 8)
{
ComboY = ComboY - remainderY;
}
else
{
ComboY = ComboY + 16 - remainderY;
}
int ComboPosition = (ComboY & 240)+(ComboX>>4);
if (Screen->ComboD [BlockPosition] == ComboS1 || Screen->ComboD [BlockPosition] == ComboS2 || Screen->ComboD [BlockPosition] == ComboS3)
{
Screen->ComboD [ComboPosition] = ComboSDug;
}
else
{
Screen->ComboD [ComboPosition] = ComboDug;
}
}
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->ComboD [BlockPosition] == Combo1 || Screen->ComboD [BlockPosition] == Combo2 || Screen->ComboD [BlockPosition] == Combo3 || Screen->ComboD [BlockPosition] == Combo4 || Screen->ComboD [BlockPosition] == Combo5 || Screen->ComboD [BlockPosition] == ComboDug) || (Screen->ComboS [BlockPosition] == 15 && (Screen->ComboD [BlockPosition] != ComboS1 && Screen->ComboD [BlockPosition] != ComboS2 && Screen->ComboD [BlockPosition] != ComboS3)) )
{
Game->PlaySound(6);
Quit();
}
ComboY = Link->Y + 16;
ComboX = Link->X;
float remainder = ComboX % 16;
if (remainder <= 8)
{
ComboX = ComboX - remainder;
}
else
{
ComboX = ComboX + 16 - remainder;
}
float remainderY = ComboY % 16;
if (remainderY <= 8)
{
ComboY = ComboY - remainderY;
}
else
{
ComboY = ComboY + 16 - remainderY;
}
int ComboPosition = (ComboY & 240)+(ComboX>>4);
if (Screen->ComboD [BlockPosition] == ComboS1 || Screen->ComboD [BlockPosition] == ComboS2 || Screen->ComboD [BlockPosition] == ComboS3)
{
Screen->ComboD [ComboPosition] = ComboSDug;
}
else
{
Screen->ComboD [ComboPosition] = ComboDug;
}
}
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->ComboD [BlockPosition] == Combo1 || Screen->ComboD [BlockPosition] == Combo2 || Screen->ComboD [BlockPosition] == Combo3 || Screen->ComboD [BlockPosition] == Combo4 || Screen->ComboD [BlockPosition] == Combo5 || Screen->ComboD [BlockPosition] == ComboDug) || (Screen->ComboS [BlockPosition] == 15 && (Screen->ComboD [BlockPosition] != ComboS1 && Screen->ComboD [BlockPosition] != ComboS2 && Screen->ComboD [BlockPosition] != ComboS3)) )
{
Game->PlaySound(6);
Quit();
}
ComboY = Link->Y;
ComboX = Link->X - 16;
float remainder = ComboX % 16;
if (remainder <= 8)
{
ComboX = ComboX - remainder;
}
else
{
ComboX = ComboX + 16 - remainder;
}
float remainderY = ComboY % 16;
if (remainderY <= 8)
{
ComboY = ComboY - remainderY;
}
else
{
ComboY = ComboY + 16 - remainderY;
}
int ComboPosition = (ComboY & 240)+(ComboX>>4);
if (Screen->ComboD [BlockPosition] == ComboS1 || Screen->ComboD [BlockPosition] == ComboS2 || Screen->ComboD [BlockPosition] == ComboS3)
{
Screen->ComboD [ComboPosition] = ComboSDug;
}
else
{
Screen->ComboD [ComboPosition] = ComboDug;
}
}
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->ComboD [BlockPosition] == Combo1 || Screen->ComboD [BlockPosition] == Combo2 || Screen->ComboD [BlockPosition] == Combo3 || Screen->ComboD [BlockPosition] == Combo4 || Screen->ComboD [BlockPosition] == Combo5 || Screen->ComboD [BlockPosition] == ComboDug) || (Screen->ComboS [BlockPosition] == 15 && (Screen->ComboD [BlockPosition] != ComboS1 && Screen->ComboD [BlockPosition] != ComboS2 && Screen->ComboD [BlockPosition] != ComboS3)) )
{
Game->PlaySound(6);
Quit();
}
ComboY = Link->Y;
ComboX = Link->X + 16;
float remainder = ComboX % 16;
if (remainder <= 8)
{
ComboX = ComboX - remainder;
}
else
{
ComboX = ComboX + 16 - remainder;
}
float remainderY = ComboY % 16;
if (remainderY <= 8)
{
ComboY = ComboY - remainderY;
}
else
{
ComboY = ComboY + 16 - remainderY;
}
int ComboPosition = (ComboY & 240)+(ComboX>>4);
if (Screen->ComboD [BlockPosition] == ComboS1 || Screen->ComboD [BlockPosition] == ComboS2 || Screen->ComboD [BlockPosition] == ComboS3)
{
Screen->ComboD [ComboPosition] = ComboSDug;
}
else
{
Screen->ComboD [ComboPosition] = ComboDug;
}
}
Game->PlaySound(61);
}
}

Yes, it's THAT big. Anyways, change these variables to the right values for the combos you want to use:

-ComboDug is the combo that appears when you dig in normal ground.
-Combo1-Combo5 are the 5 walkable combos you CAN'T dig in.
-ComboS1-S3 are 3 combos you CAN dig in. To save space, all other Solid combos are automatically given the "no-dig" flag. (An imaginary flag, by the way. ;))
-ComboSDug is the ground that appears when you dig up a solid diggable combo. In Oracles, digging up dirt or snow made normal ground appear. This combo can be anything, though.

And there you have it. Thanks to Koopa for helping me through all this. Without Koopa... This script would've ended a few days ago. :O Also, thanks to Beta Link for requesting this script. If you hadn't asked.... I wouldn't have made. XD Enjoy, guys.

Beta Link
02-09-2007, 04:35 PM
*Applause*
THANK YOU!!! Yet another awesome item script made by Matthew. Err... pikaguy! :tongue: This shovel script is being used in my quest. No ifs ands or buts. :)

Nimono
02-09-2007, 04:39 PM
Please, I don't mind you calling me Matthew here. :p I've actually been waiting for you to say something about this, but... Nice to see that people will actually use this. ;)

Din
02-10-2007, 03:20 PM
Nice! What's next for you pikaguy?

Nimono
02-10-2007, 03:41 PM
You'll see. ;) That's all I will say. By the way, I recently thought of something: For some tilesets, 5 combos WILL NOT be enough for no-dig. So, I'm off to suggest something....

Hot Water Music
02-10-2007, 09:56 PM
How can I set this up onto an item?

The_Amaster
02-10-2007, 10:34 PM
Yeah, I have it saved as a notepad file, but "Compile ZScript" doesn't have it on the load screen. Do I need to use one of the ASM import functions?
EDIT: Oh, wait. I read your Somaria thread. So, save it as .z, huh? Okay.

Nimono
02-10-2007, 10:34 PM
If using 16a/b/c:
Go to Quest>Graphics>Sprites>Items, choose an item, and tell it what script to use. You should've already compiled the script, by the way. Save the code as a .z file in Notepad, import it into the ZScript compiler, compile it, choose the Items tab, and save it there.

If using the newest Builds....
Same as above, but the path is Quest>Items.

Also, before importing into ZScript's compiler, be sure to edit the script's stated values under "Variables" so you can dig up only what you want to dig up. ;)

Nimono
03-04-2007, 10:19 AM
It may be a double post, but it's important. A basic copy-and-paste from PureZC:

The newest version of the Shovel script is here. It can create items and a few enemies, and you can get it here (http://www.geocities.com/pikachu_fan_13/Shovel.txt). It can create the following items and enemies:

-Heart
-Rupee (1)
-Rupee (5)
-Rupee (200) -Rare
-Rope
-Rope 2 -Rare

....And you are welcome to change these values. You may see that I have pre-defined variables. Those were for my test quest, so please, change them for your OWN uses. Also, I set up a special combo that you can dig in to get something other than what the normal ground would give you. No items or enemies from that.... I set up 4 combos, actually. Combo 1 is for making something like Stairs, while 2-4 are for digging up super-special items. I have yet to make code for that because I need to find a way to make that kind of secret one-time only. Get it once, you can't get it again. If you have an idea that doesn't involve the Secret Flags, LET ME KNOW IMMEDIATELY! Thank you. :) Enjoy. Big thanks to Koopa for solving my problems with Rand() and fixing up little bits of my script. :)

bigjoe
04-02-2007, 03:19 PM
I have a question. What item family is good to put the shovel in? I try putting it in a new family but I cant access new families on the subscreen editor. I tried "Letter" but that didnt seem to work. I'd really like to see a scripted item in action.

Nimono
04-02-2007, 03:24 PM
I have a question. What item family is good to put the shovel in? I try putting it in a new family but I cant access new families on the subscreen editor. I tried "Letter" but that didnt seem to work. I'd really like to see a scripted item in action.

Well, I put it on the Hammer, but, uh... If you wait for the next build, you can make a new family to put it in. ;) Also, let me know if it gives you a parsing error that mentions "Cannot cast from WTF to bool". It happens a lot for people who use my Cane of Somaria script, so it might happen on this one, too. >_<

bigjoe
04-02-2007, 03:40 PM
It seems to work now. I need to change which combo appears when you dig though. Currently, the item hurts me because it calls up a damage combo. :laughing:

cbailey78
04-06-2007, 03:41 PM
Why don't you post a demo quest to make it easier for people!

The_Amaster
05-17-2007, 07:31 PM
Arghhh!!! In 288, I'm still getting the "Fatal error poo: can't open or parse input file" I was hoping by now I'd be able to use this, dammit.

PizzaMan
08-28-2008, 12:58 AM
I set the shovel up as an item but every time I pick it up it instantly disappears from my inventory. Does anybody have any idea why?

Russ
08-28-2008, 01:05 AM
Do you have a slot for it in the subscreen? Is it set to an active item?

By the way, nice bumb. :)

Joe123
08-28-2008, 05:42 AM
Have you got the 'Equipment Item' flag checked on the data screen in the item editor?

PizzaMan
08-28-2008, 02:53 PM
Yeah I already did both of those things. Another strange thing is after the shovel disappears if I walk up to a ladder that uses a script the shovel appears but i can't use it. Then when I walk off the ladder it disappears again.

C-Dawg
08-29-2008, 07:15 PM
Could be a subscreen dmap issue. If you forget to tell a dmap to use your custom subscreen (with the new item) then it will use a default subscreen. The item won't show up.

pkmnfrk
08-29-2008, 11:24 PM
Yeah I already did both of those things. Another strange thing is after the shovel disappears if I walk up to a ladder that uses a script the shovel appears but i can't use it. Then when I walk off the ladder it disappears again.

Stupid question. Did you replace the hover boots with the shovel?

PizzaMan
08-29-2008, 11:51 PM
No.

pkmnfrk
08-30-2008, 04:10 AM
Did you modify either script? What item class is the shovel?

PizzaMan
08-30-2008, 05:17 PM
No, I didn't change the scripts at all. I put it under custom itemclass 1.

Dann Woolf
11-02-2008, 07:16 PM
I have come up with a solution for the "digging everywhere" problem.

I noticed in the list of flags five "General purpose (scripts)" flags. Perhaps you could set the script up so that you can not dig on one of these flags?