PDA

View Full Version : Bug with Bomb Arrows script



HylianGlaceon
02-08-2011, 12:23 AM
I'm using this script: (originally posted here http://www.purezc.com/forums/index.php?showtopic=39140)

The script works fine but for some reason if you have the Spin Attack scroll and you start charging your spin after firing a Bomb Arrow, it lands right on you instead of going with the arrow (usually killing Link). It does the same thing with the Quake Hammer Scroll and the regular Sword Slash.

I've pasted below what I believe is all of the bomb arrow script, I'm using, there's probably a few { missing here and there, but it already works, just has the bug mentioned above... Anyone know what to add so it doesn't land on Link when he charges the spin, hammer, or slashes with the sword?



//Input constants
const int ArrowDamage = 2; //Damage for Arrow to deal. Wooden sword deals 2 damage
const int BombDamage = 8; //Damage for explosion to deal
const int ArrowSpeed = 300; //Speed arrow moves at, in hundredths of pixels per frame
const int T_BOMBARROW = 855; //Arrange tiles in the order 'Up,Down,Left,Right' on the tilesheet. Set up-facing bomb arrow tile here

//Variables
int UseBombArrow;
int ArrowX; int ArrowY;

//bomb arrow functions
void BombArrow(){
if(UseBombArrow == 1){
lweapon Arrow = Screen->CreateLWeapon(LW_ARROW);
int x; int y;
if(Link->Dir > 1) x = (Link->Dir-2)*16-8;
else y = Link->Dir*16-8;
Arrow->X = Link->X+x;
Arrow->Y = Link->Y+y;
Arrow->Dir = Link->Dir;
Arrow->Tile = T_BOMBARROW;
Arrow->Tile += Link->Dir;

Arrow->Damage = ArrowDamage;
Arrow->Step = ArrowSpeed;
Game->PlaySound(SFX_ARROW);
Link->Action = LA_ATTACKING;
UseBombArrow++;
}else{
lweapon Arrow;
bool Found;
for(int i=1;i<=Screen->NumLWeapons();i++){
Arrow = Screen->LoadLWeapon(i);
if(Arrow->ID != LW_ARROW) continue;
Found = true;
}
if(Found){
ArrowX = Arrow->X;
ArrowY = Arrow->Y;
for(int j=-4;j<=4;j+=4){
for(int k=-4;k<=4;k+=4){
if(isSolid(Arrow->X+8+j,Arrow->Y+8+k)
|| ComboFI(ComboAt(Arrow->X+8+j,Arrow->Y+8+k),CF_BOMB)) Arrow->DeadState = 0;
}
}
}else{
lweapon Exp = Screen->CreateLWeapon(LW_BOMBBLAST);
Exp->Damage = BombDamage;
Exp->X = ArrowX;
Exp->Y = ArrowY;
UseBombArrow = 0;
}
}
}

item script BombArrows{
void run(){
if(Game->Counter[CR_BOMBS] > 0 && Game->Counter[CR_ARROWS] > 0 && UseBombArrow == 0){
UseBombArrow++;
Game->Counter[CR_BOMBS]--;
Game->Counter[CR_ARROWS]--;
}
}
}

(I'm using Beta 18 as well)