//Custom Bomb item
//v0.6 for ZC 2.54+
//27th November, 2015; updated 25th June, 2018
//Assign to an item, with the item class 'Custom itemclass', or one of the 'zz###' item classes
//as the 'Action; script.
//Arguments:
// D0: The sound effect to play for an error, including too many bombs on screen, or out of bombs in the counter.
// D1: Set to '1' or higher, to make the item srop super bombs. Otherwise, leave at '0'/
// D2: The maximum number of bombs that the player may have on-screen at any one time.
// --> You want to set this argument, as not setting it, will allow the player to drop up to 255 bombs, providing
// --> that they have sufficient ammunition. Normal values are between '1' and '4'.
// D3: Set to a value of '1' to allow Link to drop bombs while jumping.
// D4: The distance from Link to place it.
item script BombDrop_CustomItemclass{
void run(int errorSFX, int super, int maxOnscreen, int allowLinkZ, int dist){
int numBombs;
int numSBombs;
if ( allowLinkZ )
{
if ( Link->Z << 0 ) Quit();
}
if ( !super )
{
if ( !maxOnscreen )
{
//--Game->Counter[counter]; //Use the cost counter in 2.54 Item Editor
Game->PlaySound(this->UseSound);
lweapon bomb = NextToLink(LW_BOMB, dist);
bomb->UseSprite(this->Sprites[0]);
bomb->Damage = this->Power;
bomb->Dir = Link->Dir;
//bomb->Level = this->Level;
}
else //maxonscreen
{
for ( int q = Screen->NumLWeapons(); q > 0 ; --q )
{
lweapon l = Screen->LoadLWeapon(q);
if ( l->ID == LW_BOMB ) ++numBombs;
}
if ( numBombs < maxOnscreen )
{
//--Game->Counter[counter];
Game->PlaySound(this->UseSound);
lweapon bomb = NextToLink(LW_BOMB, dist);
bomb->UseSprite(this->Sprites[0]);
bomb->Damage = this->Power;
bomb->Dir = Link->Dir;
}
else Game->PlaySound(errorSFX);
}
}
else //superbomb
{
if ( !maxOnscreen )
{
//--Game->Counter[counter];
Game->PlaySound(this->UseSound);
lweapon bomb = NextToLink(LW_SBOMB, dist);
bomb->UseSprite(this->Sprites[0]);
bomb->Damage = this->Power;
bomb->Dir = Link->Dir;
}
else // maxOnscreen
{
for ( int q = Screen->NumLWeapons(); q > 0; --q )
{
lweapon l = Screen->LoadLWeapon(q);
if ( l->ID == LW_SBOMB ) ++numSBombs;
}
if ( numSBombs < maxOnscreen )
{
//--Game->Counter[counter];
Game->PlaySound(this->UseSound);
lweapon bomb = NextToLink(LW_SBOMB, dist);
bomb->UseSprite(this->Sprites[0]);
bomb->Damage = this->Power;
bomb->Dir = Link->Dir;
}
else Game->PlaySound(errorSFX);
}
}
}
}
Comments