Jump to content

Photo

Need a bug fix with Bomb Arrows..


  • Please log in to reply
3 replies to this topic

#1 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 05 June 2011 - 08:48 PM

I'm using this script: http://www.purezc.co...showtopic=39140

Right now it works fine, except there's a pretty big bug. If Link fires a bomb arrow and before it goes off, swings his sword or or uses the hammer, the explosion from the Bomb Arrow will be on him and not where the arrow actually hit, usually causing massive damage as well..

So pretty much, I need something added so the explosion happens where the bomb arrow hits the wall, even if Link swings his sword or uses the hammer.

Also, if it isn't too much to ask, could something be added so I could adjust the amount of damage it causes to Link? Right now the only way I can adjust it is by changing the amount of damage it does to enemies.

I suck at scripting, so I have no idea what to do with it..

#2 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 01 July 2011 - 06:09 PM

Bumping this for hope of a fix. If a fix for this is too much, could somebody maybe make a Bomb Arrow script that will not have this bug?

#3 Saffith

Saffith

    IPv7 user

  • Members

Posted 01 July 2011 - 07:18 PM

It's pretty old, and could stand to be completely rewritten... But I think this'll be enough to fix that problem.

CODE
//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    = 205;        //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;

//Functions
//Check inherent and regular flags at the same time
bool ComboFI(int loc,int combotype){
if(Screen->ComboF[loc] == combotype
|| Screen->ComboI[loc] == combotype) return true;
}
//Solidity Check, by Saffith
bool isSolid(int x,int y){
if(x<0 || x>255 || y<0 || y>175) return false;
int mask = 1111b;
if(x%16<8) mask &= 0011b;
else mask &= 1100b;
if(y%16<8) mask &= 0101b;
else mask &= 1010b;
int ret = Screen->ComboS[ComboAt(x,y)]&mask;
return ret != 0;
}

global script Slot_2{
    void run(){
        while(true){
            //Call bomb arrow functions
            if(UseBombArrow > 0) BombArrow();
            
        Waitframe();
        }
    }
    //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;
                break;
            }
            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]--;
        }
    }
}


#4 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 02 July 2011 - 10:19 PM

K, tried it and it works perfectly now, thanks!


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users