Nimono
02-16-2007, 04:00 PM
I don't know the rules about double-posting here, so I'm just making a new thread. Sorry.
I'm having a problem with Rand() in this script:
// 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.
// Random/Random2/Random3- Don't mess with these.
// BuriedItem- What Special Item you get from certain combos.
// ComboX & ComboY- Leave this alone.
// SpclItmCmb1-Cmb4- These 4 combos are the combos that give you special items when dug up! :D
// ModItem- Leave this alone.
// NewItem- Leave this alone.
// ModNPC- See Above.
// NewNPC- See above, also.
// Note: Wow! So many variables! Ummm... Nothing I can do about it. =/
import "std.zh"
item script Shovel
{
int ComboDug = 55;
int Combo1 = 47;
int Combo2 = 0;
int Combo3 = 0;
int Combo4 = 0;
int Combo5 = 0;
int ComboS1 = 322;
int ComboS2 = 0;
int ComboS3 = 0;
int ComboX = 0;
int ComboY = 0;
int ComboSDug = 1;
int Random = 0;
int Random2 = 0;
int Random3 = 0;
int BuriedItem = 0;
int SpclItmCmb1 = 0;
int SpclItmCmb2 = 0;
int SpclItmCmb3 = 0;
int SpclItmCmb4 = 0;
int ModItem = 0;
int NewItem = 0;
int ModNPC = 0;
int NewNPC = 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);
Random = Floor(Random);
Random = Rand(19);
Random2 = Floor(Random2);
Random2 = Rand (4);
int ComboPosition = (ComboY & 240)+(ComboX>>4);
if (Screen->ComboD [ComboPosition] != SpclItmCmb1 && Screen->ComboD [ComboPosition] != SpclItmCmb2 && Screen->ComboD [ComboPosition] != SpclItmCmb3 && Screen->ComboD [ComboPosition] != SpclItmCmb4 && Screen->ComboD [ComboPosition] != ComboS1 && Screen->ComboD [ComboPosition] != ComboS2 && Screen->ComboD [ComboPosition] != ComboS3)
{
if (Random == 0 || Random == 1 || Random == 2 || Random == 3 || Random == 4 || Random == 11)
{
Quit();
}
else if (Random == 5 || Random == 6 || Random == 7 || Random == 8 || Random == 16 || Random == 17)
{
if (Random2 == 0 || Random2 == 1 || Random2 == 2)
{
Screen->CreateItem(0);
NewItem = Screen->NumItems();
item ModItem = Screen->LoadItem(NewItem);
ModItem->X = ComboX;
ModItem->Y = ComboY;
}
else if (Random2 == 3)
{
Screen->CreateItem(2);
NewItem = Screen->NumItems();
item ModItem = Screen->LoadItem(NewItem);
ModItem->X = ComboX;
ModItem->Y = ComboY;
}
}
else if (Random == 9 || Random == 10)
{
Screen->CreateItem(5);
ModItem = Screen->NumItems();
item NewItem = Screen->LoadItem(ModItem);
NewItem->X = ComboX;
NewItem->Y = ComboY;
}
else if (Random == 12 || Random == 13)
{
Screen->CreateNPC(44);
ModNPC = Screen->NumNPCs();
npc NewNPC = Screen->LoadNPC(ModNPC);
NewNPC->X = ComboX;
NewNPC->Y = ComboY;
}
else if (Random == 14)
{
Screen->CreateItem(40);
NewItem = Screen->NumItems();
item ModItem = Screen->LoadItem(NewItem);
ModItem->X = ComboX;
ModItem->Y = ComboY;
}
else if (Random == 15)
{
Screen->CreateNPC(80);
ModNPC = Screen->NumNPCs();
npc NewNPC = Screen->LoadNPC(ModNPC);
NewNPC->X = ComboX;
NewNPC->Y = ComboY;
}
}
else if (Screen->ComboD [ComboPosition] == ComboS1 || Screen->ComboD [ComboPosition] != ComboS2 || Screen->ComboD [ComboPosition] != ComboS3)
{
Random3 = Floor(Random3);
Random3 = Rand(13);
if (Random3 == 0 || Random3 == 1 || Random3 == 2 || Random3 == 3 || Random3 == 4 || Random3 == 5 || Random3 == 6)
{
Quit();
}
else if (Random3 == 7 || Random3 == 8 || Random3 == 9 || Random3 == 10 || Random3 == 11 || Random3 == 12)
{
if (Random2 == 0 || Random2 == 1 || Random2 == 2)
{
Screen->CreateItem(0);
NewItem = Screen->NumItems();
item ModItem = Screen->LoadItem(NewItem);
ModItem->X = ComboX;
ModItem->Y = ComboY;
}
else if (Random2 == 3)
{
Screen->CreateItem(2);
NewItem = Screen->NumItems();
item ModItem = Screen->LoadItem(NewItem);
ModItem->X = ComboX;
ModItem->Y = ComboY;
}
}
}
}
}
I asked Koopa for help earlier, and he told me to use "Random=Floor(Random)" to turn the Random variables back into ints, but.... It's not working. The last bit of code that begins all the randomizing and stuff is supposed to randomly create certain things when you use it on a diggable combo. Problem is, NOTHING HAPPENS. Koopa says that Rand() keeps turning out 0, but.... I can't fix it, and Koopa left me NO instructions on how to use it. (He also said he fixed the code and got it to work, but never sent it to me. :() So, I'm at a loss. Yes, this is my Shovel script, but it'll never be complete until it can produce items. Does anyone know what I'm doing wrong?
I'm having a problem with Rand() in this script:
// 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.
// Random/Random2/Random3- Don't mess with these.
// BuriedItem- What Special Item you get from certain combos.
// ComboX & ComboY- Leave this alone.
// SpclItmCmb1-Cmb4- These 4 combos are the combos that give you special items when dug up! :D
// ModItem- Leave this alone.
// NewItem- Leave this alone.
// ModNPC- See Above.
// NewNPC- See above, also.
// Note: Wow! So many variables! Ummm... Nothing I can do about it. =/
import "std.zh"
item script Shovel
{
int ComboDug = 55;
int Combo1 = 47;
int Combo2 = 0;
int Combo3 = 0;
int Combo4 = 0;
int Combo5 = 0;
int ComboS1 = 322;
int ComboS2 = 0;
int ComboS3 = 0;
int ComboX = 0;
int ComboY = 0;
int ComboSDug = 1;
int Random = 0;
int Random2 = 0;
int Random3 = 0;
int BuriedItem = 0;
int SpclItmCmb1 = 0;
int SpclItmCmb2 = 0;
int SpclItmCmb3 = 0;
int SpclItmCmb4 = 0;
int ModItem = 0;
int NewItem = 0;
int ModNPC = 0;
int NewNPC = 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);
Random = Floor(Random);
Random = Rand(19);
Random2 = Floor(Random2);
Random2 = Rand (4);
int ComboPosition = (ComboY & 240)+(ComboX>>4);
if (Screen->ComboD [ComboPosition] != SpclItmCmb1 && Screen->ComboD [ComboPosition] != SpclItmCmb2 && Screen->ComboD [ComboPosition] != SpclItmCmb3 && Screen->ComboD [ComboPosition] != SpclItmCmb4 && Screen->ComboD [ComboPosition] != ComboS1 && Screen->ComboD [ComboPosition] != ComboS2 && Screen->ComboD [ComboPosition] != ComboS3)
{
if (Random == 0 || Random == 1 || Random == 2 || Random == 3 || Random == 4 || Random == 11)
{
Quit();
}
else if (Random == 5 || Random == 6 || Random == 7 || Random == 8 || Random == 16 || Random == 17)
{
if (Random2 == 0 || Random2 == 1 || Random2 == 2)
{
Screen->CreateItem(0);
NewItem = Screen->NumItems();
item ModItem = Screen->LoadItem(NewItem);
ModItem->X = ComboX;
ModItem->Y = ComboY;
}
else if (Random2 == 3)
{
Screen->CreateItem(2);
NewItem = Screen->NumItems();
item ModItem = Screen->LoadItem(NewItem);
ModItem->X = ComboX;
ModItem->Y = ComboY;
}
}
else if (Random == 9 || Random == 10)
{
Screen->CreateItem(5);
ModItem = Screen->NumItems();
item NewItem = Screen->LoadItem(ModItem);
NewItem->X = ComboX;
NewItem->Y = ComboY;
}
else if (Random == 12 || Random == 13)
{
Screen->CreateNPC(44);
ModNPC = Screen->NumNPCs();
npc NewNPC = Screen->LoadNPC(ModNPC);
NewNPC->X = ComboX;
NewNPC->Y = ComboY;
}
else if (Random == 14)
{
Screen->CreateItem(40);
NewItem = Screen->NumItems();
item ModItem = Screen->LoadItem(NewItem);
ModItem->X = ComboX;
ModItem->Y = ComboY;
}
else if (Random == 15)
{
Screen->CreateNPC(80);
ModNPC = Screen->NumNPCs();
npc NewNPC = Screen->LoadNPC(ModNPC);
NewNPC->X = ComboX;
NewNPC->Y = ComboY;
}
}
else if (Screen->ComboD [ComboPosition] == ComboS1 || Screen->ComboD [ComboPosition] != ComboS2 || Screen->ComboD [ComboPosition] != ComboS3)
{
Random3 = Floor(Random3);
Random3 = Rand(13);
if (Random3 == 0 || Random3 == 1 || Random3 == 2 || Random3 == 3 || Random3 == 4 || Random3 == 5 || Random3 == 6)
{
Quit();
}
else if (Random3 == 7 || Random3 == 8 || Random3 == 9 || Random3 == 10 || Random3 == 11 || Random3 == 12)
{
if (Random2 == 0 || Random2 == 1 || Random2 == 2)
{
Screen->CreateItem(0);
NewItem = Screen->NumItems();
item ModItem = Screen->LoadItem(NewItem);
ModItem->X = ComboX;
ModItem->Y = ComboY;
}
else if (Random2 == 3)
{
Screen->CreateItem(2);
NewItem = Screen->NumItems();
item ModItem = Screen->LoadItem(NewItem);
ModItem->X = ComboX;
ModItem->Y = ComboY;
}
}
}
}
}
I asked Koopa for help earlier, and he told me to use "Random=Floor(Random)" to turn the Random variables back into ints, but.... It's not working. The last bit of code that begins all the randomizing and stuff is supposed to randomly create certain things when you use it on a diggable combo. Problem is, NOTHING HAPPENS. Koopa says that Rand() keeps turning out 0, but.... I can't fix it, and Koopa left me NO instructions on how to use it. (He also said he fixed the code and got it to work, but never sent it to me. :() So, I'm at a loss. Yes, this is my Shovel script, but it'll never be complete until it can produce items. Does anyone know what I'm doing wrong?