Jump to content

Photo

Shield Script


  • Please log in to reply
12 replies to this topic

#1 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 14 August 2011 - 01:43 PM

I thought I remembered seeing a script like this, but didn't find it in the database or submissions boards.

Anyhow, I'm looking for a script that equips the shield and modifies Link's tiles only as long as you
have the button pressed down. (Meaning that the Shield would have to be made into a button item)

#2 Mero

Mero

    Touch Fluffy Tail

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

Posted 14 August 2011 - 02:04 PM

QUOTE(Cukeman @ Aug 14 2011, 12:43 PM) View Post

I thought I remembered seeing a script like this, but didn't find it in the database or submissions boards.

Anyhow, I'm looking for a script that equips the shield and modifies Link's tiles only as long as you
have the button pressed down. (Meaning that the Shield would have to be made into a button item)


I don't think it's possible directly to modify link's tiles through scripting. You'll have to play give and take with an item. And you'll need both an global script and an item script.

Edited by blackbishop89, 14 August 2011 - 02:05 PM.


#3 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 14 August 2011 - 02:06 PM

QUOTE(blackbishop89 @ Aug 14 2011, 12:04 PM) View Post
You'll have to play give and take with an item.


If it works, it's all the same to me.

#4 Mero

Mero

    Touch Fluffy Tail

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

Posted 14 August 2011 - 02:14 PM

Do you think you could resized the Lttp Rocklops/Eyegore sprites down to 16x16 so I can show them off in my next script vid.
EDIT: Oh and so that doesn't count as spam, I'll be requesting that in exchange for the shield script. icon_wink.gif
EDIT2: Are you using any custom shields? Or just the default ones.

Edited by blackbishop89, 14 August 2011 - 02:17 PM.


#5 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 14 August 2011 - 02:26 PM

There is already a shield script, though it might not be in the DB. Here's my copy:
CODE
//import "std.zh"

//Change these values to match your item setup
const int GBS_SMALL=93;
const int GBS_MAGIC=8;
const int GBS_MIRROR=37;
const int GBS_FAKESMALL=123;
const int GBS_FAKEMAGIC=124;
const int GBS_FAKEMIRROR=125;
const int SFX_GBSHIELD=17;

global script slot_2{
    void run(){
    //Initializations
    bool shieldon;
    int lastdir;
    int gbsound;
        
        while(true){
            //Code for gameboy shield
            if( (!(Link->Action==LA_ATTACKING))
            && (!(Link->Action==LA_CHARGING))
            && (!(Link->Action==LA_SPINNING))) {lastdir=Link->Dir;}
             //used for strafing

        int nw = ComboAt(Link->X + 8, Link->Y + 12);

        if(nowalkshield(nw)){          
                Link->Item[GBS_MIRROR]=false;
                Link->Item[GBS_MAGIC]=false;
                Link->Item[GBS_SMALL]=false;
                shieldon=false;
        }

            else if(Link->InputR && !shieldon){ //Enable shield when R is pressed
                shieldon=true;
                gbsound=SFX_GBSHIELD;
                if(Link->Item[GBS_FAKEMIRROR]) Link->Item[GBS_MIRROR]=true;
                else if(Link->Item[GBS_FAKEMAGIC]) Link->Item[GBS_MAGIC]=true;
                else if(Link->Item[GBS_FAKESMALL]) Link->Item[GBS_SMALL]=true;
                else{
                    gbsound=0;
                    shieldon=false;
                }
                if(gbsound>0) Game->PlaySound(SFX_GBSHIELD);
            }
        else if(!Link->InputR && shieldon){ //Remove shield when R is released
                Link->Item[GBS_MIRROR]=false;
                Link->Item[GBS_MAGIC]=false;
                Link->Item[GBS_SMALL]=false;
                shieldon=false;
            }

        //check if the hookshot is on screen
        bool nohookshotonscreen = true;

        for(int i=1;i<=Screen->NumLWeapons();i++){
        lweapon testedlw = Screen->LoadLWeapon(i);
        if(testedlw->ID == LW_HOOKSHOT){nohookshotonscreen=false;}
        }



            //Add any other code that needs to be in a global script here...
            
         Waitdraw();  

            //Strafe while R is held down
            if(Link->InputR
        && shieldon
        && (!(Link->Action==LA_ATTACKING))
        && (!(Link->Action==LA_CHARGING))
        && (!(Link->Action==LA_SPINNING))
        && nohookshotonscreen) {Link->Dir=lastdir;}

            //Turn off inputs "L" and "R".
            Link->InputL=false;
            Link->InputR=false;
                
        Waitframe();
        }                 // end while
    }                  //end void run

    bool nowalkshield(int underlink){
        underlink = ComboAt(Link->X, Link->Y + 8);
        return (Screen->ComboT[underlink] == 31) || (Screen->ComboT[underlink] == 32) || (Screen->ComboT[underlink] == 33) || (Screen->ComboT[underlink] == 34)
         || (Screen->ComboT[underlink] == 120) || (Screen->ComboT[underlink] == 121) || (Screen->ComboT[underlink] == 122) || (Screen->ComboT[underlink] == 19)
         || (Screen->ComboT[underlink] == 89) || (Screen->ComboT[underlink] == 90) || (Screen->ComboT[underlink] == 91) || (Screen->ComboT[underlink] == 6)
         || (Screen->ComboT[underlink] == 18) || (Screen->ComboT[underlink] == 86) || (Screen->ComboT[underlink] == 87) || (Screen->ComboT[underlink] == 88)
         || (Screen->ComboT[underlink] == 38) || (Screen->ComboT[underlink] == 36) || (Screen->ComboT[underlink] == 39) || (Screen->ComboT[underlink] == 40)
         || (Screen->ComboT[underlink] == 37) || (Screen->ComboT[underlink] == 3);
    }

}


#6 Isdrakthül

Isdrakthül

    Apprentice

  • Members

Posted 14 August 2011 - 02:28 PM

CODE

int shielduseitem = 0; //the item that is equipped to the button to give Link the shield
int shielditem = 0; //the shield

global script Slot2{
    void run(){
    while(true){
        if(GetEquipmentA() == shielduseitem && Link->InputA == true){
            Link->Item[shielditem]=true;
            Link->InputB=false;
        }
        else if(GetEquipmentB() == shielduseitem && Link->InputB == true){
            Link->Item[shielditem]=true;
            Link->InputA=false;
        }
        else Link->Item[shielditem]=false;
        Waitframe();
    }
    }
}

item script changeShield{
    void run(int newuse, newshield){
        shielduseitem=newuse;
        shielditem=newshield;
    }
}


The integers are explained in the comments. The item script is a pickup to change the integers; shielduseitem becomes D0 and shielditem becomes D1. I don't have time to test this, but it should work.

EDIT: Ninja'd.

Edited by Isdrakthül, 14 August 2011 - 02:31 PM.


#7 Mero

Mero

    Touch Fluffy Tail

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

Posted 14 August 2011 - 03:02 PM

Okay that's just rude. I say I'm going to do it, and you two come along with your own copies of the script.

Shame on you both. >_>

#8 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 14 August 2011 - 03:06 PM

Thanks for the scripts! I'll try 'em out.
blackbishop89 I'll PM you icon_wink.gif

#9 Isdrakthül

Isdrakthül

    Apprentice

  • Members

Posted 14 August 2011 - 03:17 PM

Hey, you were making demands of him in exchange for the script. I'd say that's fairly rude as well, and it's the sole reason that I posted my version.

If you're going to put prices on scripts, I see no reason why we can't offer competitive pricing.

#10 Mero

Mero

    Touch Fluffy Tail

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

Posted 14 August 2011 - 03:20 PM

QUOTE(Isdrakthül @ Aug 14 2011, 02:17 PM) View Post

Hey, you were making demands of him in exchange for the script. I'd say that's fairly rude as well, and it's the sole reason that I posted my version.

If you're going to put prices on scripts, I see no reason why we can't offer competitive pricing.


I didn't demand it, I said I expected it. Theres a difference, whether he agreed or not I would post mine regardless. >_>
And I don't put prices on scripts thank you.


#11 HollowKnight

HollowKnight

    Doyen(ne)

  • Members

Posted 14 August 2011 - 03:30 PM

I believe you said you requested a sprite in exchange for the script. How is that not putting a price on it?

Its irrelevant anyway. He has his script, it was already made, time to move on.

#12 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 14 August 2011 - 03:32 PM

If you think you can make a better script, go right ahead. I may even swap out that one for yours.

#13 Mero

Mero

    Touch Fluffy Tail

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

Posted 14 August 2011 - 03:33 PM

QUOTE(HollowKnight @ Aug 14 2011, 02:30 PM) View Post

I believe you said you requested a sprite in exchange for the script. How is that not putting a price on it?

Its irrelevant anyway. He has his script, it was already made, time to move on.


Like I said, Because I would make it available regardless...


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users