Jump to content

Photo

GB_Shield with flip and equipped tile modifiers ?


  • Please log in to reply
1 reply to this topic

#1 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 25 October 2016 - 11:46 PM

can someone modify this script so that it knocks back enemies and is interruptible by other items?

also I need it to use link tile modifiers for when the shield is equipped 

I would be willing to do it if someone could give me instruction on how to achieve the knock back effect

 

its from here

//Version 3 - update for Matthew
//Shield is used with a/b button, unlimited amount of shields, strafing optional, other weapons disabled while using shield (L and R are left alone though)

import "std.zh"

//Change these values as needed
const int SFX_GBSHIELD=0;
bool GBS_STRAFING=false;

//Global variables
bool enableshield=false;
bool shieldon=false;
int realshield=0;
int buttonpressed=0; // 0=none, 1=A button, 2=B button

//Attach this script to each dummy shield
//D0: Item id of the corresponding real shield
item script gbshield
{
    void run(int nextid)
    {
        if(shieldon) Quit();
        if(Link->InputB && !Link->InputA) buttonpressed=2;
        else if(Link->InputA && !Link->InputB) buttonpressed=1;
        else Quit();
        enableshield=true;
        realshield=nextid;
    }
}

//Gameboy shield: To use, set up fake items that look like shields. Assign them levels 1-x, where x
//    is the number of shields in your quest, and make them equipment items. Make any of them
//    consumable by enemies if you want. You can also give them an LTM that makes it look like Link is
//    carrying a shield beside him. Next go to the real shields and change each of them to level x+1
//    (and keep their equipment item status enabled). Set up the LTM's for them (if they are not done
//    already) to look like Link is holding the shield out in front of him. Give players the fake
//    shields during the game, not the real ones, and attach the gbshield item script to each one.
//    Remove the small shield from the initial data, and if you want Link to start with one of the
//    shields, just give him the fake version in the initial data as well. If you want strafing to work
//    correctly, you have to enable Z3 diagonal movement (in Graphics->Sprites->Link). Make sure that
//    the above global variables are correct (if you don't want a sound when Link uses the shield, leave
//    it as 0), and then attach this script to global slot 2.
global script slot_2
{
    void run()
    {
        //Initializations
        int lastdir;
        
        while(true)
        {
            //*************** Code for gameboy shield ***************//
            lastdir=Link->Dir; //used for strafing
            
            //Enable shield when a shield item is used
            if(enableshield)
            {
                Link->Item[realshield]=true;
                if(SFX_GBSHIELD>0) Game->PlaySound(SFX_GBSHIELD);
                shieldon=true;
                enableshield=false;
            }
            
            //Disable other button when shield is being used
            if(shieldon && buttonpressed==1) Link->InputB=false;
            else if(shieldon && buttonpressed==2) Link->InputA=false;
            
            //Remove shield when button is released
            if(shieldon && ((buttonpressed==1 && !Link->InputA) || (buttonpressed==2 && !Link->InputB)))
            {
                Link->Item[realshield]=false;
                shieldon=false;
            }
            
            //*************** End of gameboy shield ***************//
            
            //Add any other code that needs to be in a global script here...
            
            Waitdraw(); //Wait until other game processing is done, but before screen is rendered
            
            //Strafe if shield is being used and strafing is enabled
            if(shieldon && GBS_STRAFING) Link->Dir=lastdir;
            
            Waitframe();
        }
    }
}

Edited by Shadowblitz16, 30 October 2016 - 03:36 PM.


#2 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 30 October 2016 - 03:35 PM

I edit the tile I feel like it was a little rude to the people that made the various gb shield scripts 

 

anyways I still need this




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users