Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

ZScript: EW_BOMBBLAST and ew->Step=0

11 replies · 2,296 views · Started 02 March 2009

What is it meant to be? Is it a bomb explosion?

I've tried to script realBombchu that were in Majora's mask.

//
// This script attach a bomb to a npc.
//
//
// The unlit bomb graphic

const int BOMB_TILE = 429;
const int BOMB_CSET = 7;

// the lit bomb combo

const int BOMB_COMBO = 252;
const int BOMB_ASPEED = 10;
const int BOMB_AFRAMES = 9;

ffc script ZeldaMajoraMask_RealBombchu
{
//D0 : The number of the npc in the list to attach a bomb.
//D1 : The maximum distance between Link and the npc that the bomb isn't lit.
void run(int Npc, int distance)
{
Waitframes(4);

npc kamikaze = Screen->LoadNPC(Npc);
// The bomb is lit or not
bool lit;
int counter = BOMB_ASPEED*BOMB_AFRAMES;

eweapon bomb;

int previousHP = kamikaze->HP;

int bombx;
int bomby;

while(true)
{
if(kamikaze->isValid())
{
if(Abs(Distance(Link->X,Link->Y,kamikaze->X,kamikaze->Y))<= distance && lit==false)
lit = true;
if(kamikaze->Dir == DIR_UP)
{
if(lit)
Screen->DrawCombo(1, kamikaze->X, kamikaze->Y + 16, BOMB_COMBO, 1, 1,BOMB_CSET, 1, 0, 0, 0,0, 0, true, 128);
if(!lit)
Screen->DrawTile( 1 , kamikaze->X , kamikaze->Y + 16 , BOMB_TILE , 1 , 1 , BOMB_CSET, 1 , 0,0,0,0, true, 128);
}
if(kamikaze->Dir == DIR_DOWN)
{
if(lit)
Screen->DrawCombo(1, kamikaze->X, kamikaze->Y - 16, BOMB_COMBO, 1, 1,BOMB_CSET, 1, 0, 0, 0,0, 0, true, 128);
if(!lit)
Screen->DrawTile( 1 , kamikaze->X , kamikaze->Y - 16 , BOMB_TILE , 1 , 1 , BOMB_CSET, 1 , 0,0,0,0, true, 128);
}
if(kamikaze->Dir == DIR_LEFT)
{
if(lit)
Screen->DrawCombo(1, kamikaze->X + 16, kamikaze->Y, BOMB_COMBO, 1, 1,BOMB_CSET, 1, 0, 0, 0,0, 0, true, 128);
if(!lit)
Screen->DrawTile( 1 , kamikaze->X + 16 , kamikaze->Y , BOMB_TILE , 1 , 1 , BOMB_CSET, 1 , 0,0,0,0, true, 128);
}
if(kamikaze->Dir == DIR_RIGHT)
{
if(lit)
Screen->DrawCombo(1, kamikaze->X - 16, kamikaze->Y, BOMB_COMBO, 1, 1,BOMB_CSET, 1, 0, 0, 0,0, 0, true, 128);
if(!lit)
Screen->DrawTile( 1 , kamikaze->X - 16 , kamikaze->Y , BOMB_TILE , 1 , 1 , BOMB_CSET, 1 , 0,0,0,0, true, 128);
}
if(kamikaze->HP < previousHP || counter <= 0)
{
Explosion(kamikaze->X,kamikaze->Y);
previousHP = kamikaze->HP;
lit = false;
counter = BOMB_ASPEED*BOMB_AFRAMES;
}
if(lit)
counter-=1;
}
if(!kamikaze->isValid())break;
Waitframe();
}
}

void Explosion(int ex, int ey)
{
eweapon explosion = Screen->CreateEWeapon(EW_BOMBBLAST);
explosion->X = ex-16; explosion->Y = ey-16;
explosion->Step = 0; explosion->OriginalTile = 0;
explosion->ASpeed = 0;
}
}

It's supposed to attach a bomb to a npc, then if you come too close, the bomb is lit and then it's supposed to explode right where the npc is... The problem is that the npc is spawning bombs?!

Demo : http://www.mediafire.com/download.php?n5nnhgyqtn2

User posted image

lucas92 wrote:The problem is that the npc is spawning bombs?!

I think your problem is right here:

if(kamikaze->Dir == DIR_UP)
{
if(lit)
Screen->DrawCombo(1, kamikaze->X, kamikaze->Y + 16, BOMB_COMBO, 1, 1,BOMB_CSET, 1, 0, 0, 0,0, 0, true, 128);
if(!lit)
Screen->DrawTile( 1 , kamikaze->X , kamikaze->Y + 16 , BOMB_TILE , 1 , 1 , BOMB_CSET, 1 , 0,0,0,0, true, 128);
}
if(kamikaze->Dir == DIR_DOWN)
{
if(lit)
Screen->DrawCombo(1, kamikaze->X, kamikaze->Y - 16, BOMB_COMBO, 1, 1,BOMB_CSET, 1, 0, 0, 0,0, 0, true, 128);
if(!lit)
Screen->DrawTile( 1 , kamikaze->X , kamikaze->Y - 16 , BOMB_TILE , 1 , 1 , BOMB_CSET, 1 , 0,0,0,0, true, 128);
}
if(kamikaze->Dir == DIR_LEFT)
{
if(lit)
Screen->DrawCombo(1, kamikaze->X + 16, kamikaze->Y, BOMB_COMBO, 1, 1,BOMB_CSET, 1, 0, 0, 0,0, 0, true, 128);
if(!lit)
Screen->DrawTile( 1 , kamikaze->X + 16 , kamikaze->Y , BOMB_TILE , 1 , 1 , BOMB_CSET, 1 , 0,0,0,0, true, 128);
}
if(kamikaze->Dir == DIR_RIGHT)
{
if(lit)
Screen->DrawCombo(1, kamikaze->X - 16, kamikaze->Y, BOMB_COMBO, 1, 1,BOMB_CSET, 1, 0, 0, 0,0, 0, true, 128);
if(!lit)
Screen->DrawTile( 1 , kamikaze->X - 16 , kamikaze->Y , BOMB_TILE , 1 , 1 , BOMB_CSET, 1 , 0,0,0,0, true, 128);
}

Forgive me if I'm wrong, but doesn't DrawCombo and DrawTile draw permanent combos/tiles on the screen? It might be better to attach the ffc itself to the npc and give the bomb graphic to the ffc (not that I know how to do this).

Just check out the demo. You should see what's wrong. It spawns bombs instead of bomb explosions... :S

lucas92 wrote:It spawns bombs instead of bomb explosions... :S

But that doesn't make sense! EW_BOMBBLAST is supposed to be a bomb explosion.

{FYI, I rarely download anything unless it is very important because my college has a horrible internet connection. The normal rate of download over here is 0.1 bytes/sec (no, that is not a typo; I do mean bytes). Sorry about not looking at it first.}

pkmnfrk wrote:A bug, perchance?

Perhaps. lucas92, how about you try using EW_BOMB, and see if it gives you the desired result? The two could be backwards in the header file...

The two do the same exact thing! It spawns bombs instead of explosions! Link has to touch it to explode. :S

The reason it doesn't work is because of this:

explosion->Step = 0; 
Somehow, it prevents the bomb from detonating. Remove it, for now.

Bug verified!

{FYI, I rarely download anything unless it is very important because my college has a horrible internet connection. The normal rate of download over here is 0.1 bytes/sec (no, that is not a typo; I do mean bytes). Sorry about not looking at it first.}

go get a rusty axe and start hunting for the heads of the people doing P2P downloads. (torrents/limewire etc.)