Jump to content

Photo

Statue when Link swings his sword.


  • Please log in to reply
6 replies to this topic

#1 Omega

Omega

    Yes

  • Members

Posted 30 July 2011 - 05:17 AM

I'd like to request a script if anyone thinks they can accomplish this. A statue that shoots fireballs when Link swings his sword.
They can shoot a fireball directly at link or shoot like the ones in LTTP. I have puzzle rooms these would work great in. icon_razz.gif

Edited by Franky, 30 July 2011 - 05:18 AM.


#2 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 30 July 2011 - 08:26 AM

QUOTE(Franky @ Jul 30 2011, 04:17 AM) View Post

I'd like to request a script if anyone thinks they can accomplish this. A statue that shoots fireballs when Link swings his sword.
They can shoot a fireball directly at link or shoot like the ones in LTTP. I have puzzle rooms these would work great in. icon_razz.gif


Do you want the fireball to go in four directions or iin links direction? The latter would be easier since that just requires use of Angular movement and the aTan2 function.

#3 Omega

Omega

    Yes

  • Members

Posted 30 July 2011 - 09:08 AM

QUOTE(blackbishop89 @ Jul 30 2011, 06:26 AM) View Post

Do you want the fireball to go in four directions or iin links direction? The latter would be easier since that just requires use of Angular movement and the aTan2 function.
Whichever is easier for you to do. icon_smile.gif

Both types are useful to me, so either one will work.

Edited by Franky, 30 July 2011 - 09:08 AM.


#4 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 30 July 2011 - 09:45 AM

Okay here it is. It's pretty easy to use. Just place a ffc ontop of a solid combo. And set the arguments as such: D0 = the damage in quarter hearts, D1 = the delay in frames between link using the sword and shooting a fireball, D2 = the speed of the fireball, D3 should be set to 0 if you want it to shoot directly at link, otherwise set it to 1 for 4 way aiming., and finally D4 is the sound to play when a shot is fired.

CODE

ffc script FireballShooter{
    void run(int damage, int delay, int speed, bool fourway, int firingsound){
        while(true){
            if(attacking()){
                Waitframes(delay);
                eweapon fireball= CreateEWeaponAt(EW_FIREBALL, this->X, this->Y);
                fireball->Damage = damage;
                if(!fourway){
                    fireball->Angular = true;
                    fireball->Angle = DegtoRad(Angle(this->X,this->Y,Link->X,Link->Y));
                    fireball->Dir = RadianAngleDir8(WrapAngle(fireball->Angle));
                }
                else if(CenterLinkX() < this->X) fireball->Dir = DIR_LEFT;
                else if(CenterLinkX() >= this->X + 16) fireball->Dir = DIR_RIGHT;
                else if(CenterLinkX() < this->Y) fireball->Dir = DIR_UP;
                else if(CenterLinkX() >= this->Y + 16) fireball->Dir = DIR_DOWN;
                fireball->Step = speed;
                Game->PlaySound(firingsound);
            }
            Waitframe();
        }      
    }
    bool attacking(){
        bool slashed = false;
        int swords[4] = {I_SWORD1, I_SWORD2, I_SWORD3, I_SWORD4};
        for(int i; i < SizeOfArray(swords); i++){
            if((GetEquipmentA() == swords[i] && Link->PressA) || (GetEquipmentB() == swords[i] && Link->PressB)) slashed = true;
        }
        return(slashed);
    }
}


EDIT About the array, the number 4 should be the number of swords in the game and the intergers of the array should be the IDs of the items. It's set up so the default four swords trigger the firing of fireballs. You can change this though if you have custom swords.

Edited by blackbishop89, 30 July 2011 - 09:47 AM.


#5 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 30 July 2011 - 10:14 AM

Wow, this is a great script (idea)! Should the integers of the array be I_150 or just 150?

#6 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 30 July 2011 - 10:33 AM

QUOTE(Avataro @ Jul 30 2011, 09:14 AM) View Post

Wow, this is a great script (idea)! Should the integers of the array be I_150 or just 150?


For sword with ID 150 it would be just 150, no I_ in front of it.

#7 Omega

Omega

    Yes

  • Members

Posted 31 July 2011 - 10:27 PM

Think you could make an edit of the first script that shoots out 4 directional fireballs when link swings his sword, instead of just one in links general direction. In other words, when I set D3 to 1, I want it to shoot a fireball up, left, right and down at the same time, instead of just one fireball in one of those directions.

Edited by Franky, 17 March 2012 - 05:01 AM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users