Jump to content

Photo

GB Shield Item needed!


  • Please log in to reply
11 replies to this topic

#1 Jared

Jared

    Deified

  • Members
  • Real Name:Jared
  • Pronouns:He / Him
  • Location:New Hampshire

Posted 06 February 2012 - 05:39 PM

Can anyone make this an ITEM for me? Like, you put it to A or B, and you can buy it normally, etc? And you use it by pressing the button, with NO strafing?
Also, can you make it so if you have it on A or B, it shows up (On his arm), but not when you don't have it on A or B?
Thank you SO much!

On a side note, would it be possible to make Link use a "push" tile when he pushes on a block flag? That's be awesome too!

#2 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 06 February 2012 - 06:23 PM

Alright, I tried my hand at this. I couldn't get the part where it Link's sprites change if he has the shield equipped to work, because I don't know how to properly check what item he currently has equipped ( icon_redface.gif ), but I tried my best at the rest of it. It compiles alright, but I didn't have time to test it, so let me know if it screws up (it probably will...) Instructions after the code

CODE

bool shielding = false;
int shieldingup = 1;
int shieldingdown = 2;
int shieldingleft = 3;
int shieldingright = 4;
int shield = 12;


item script GBshield {
    void run() {
        shielding = true;
    }
}


global script slot_2 {
    void run() {
        while (true) {
            if (shielding == false) {
                Link->Invisible = false;
            }
            if (shielding == true) {
                Link->InputUp = false;
                Link->InputDown = false;
                Link->InputLeft = false;
                Link->InputRight = false;
                Link->Item[shield] = true;
                Link->Invisible = true;
                if (Link->Dir == 0) {
                    Screen->DrawTile(0, Link->X, Link->Y, shieldingup, 0, 0, 6, -1, -1, 0, 0, 0, 0, true, 128);
                }

                if (Link->Dir == 1) {
                    Screen->DrawTile(0, Link->X, Link->Y, shieldingdown, 0, 0, 6, -1, -1, 0, 0, 0, 0, true, 128);
                }

                if (Link->Dir == 2) {
                    Screen->DrawTile(0, Link->X, Link->Y, shieldingleft, 0, 0, 6, -1, -1, 0, 0, 0, 0, true, 128);
                }

                if (Link->Dir == 3) {
                    Screen->DrawTile(0, Link->X, Link->Y, shieldingright, 0, 0, 6, -1, -1, 0, 0, 0, 0, true, 128);
                }
                shielding = false;
            }
                Waitframe();
        }
    }
}


You're going to need four tiles, tiles showing Link holding up his shield while facing up, down, left, and right. Put the numbers for those tiles into the four variables at the top of the script (the ones like "int shieldingup"). Then, go to the item edtior. Find whatever shield you want Link to actually use (for example, if you want this to be the level 2 shield, grab that item's id number). Put that into the variable "int shield" at the top of the script.

Now, make a dummy shield item, and attach the item script "GBshield" to it. Then load the global script into slot 2, combining it with other global scripts if you need to.

Like I said, I don't have time to test this. I tested to make sure it compiles, but I didn't test if it actually works, so let me know what happens so I can try to fix it (if it's broken).

#3 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 06 February 2012 - 06:27 PM

I think it would be much easier to handle Link's graphics with Link Tile Modifiers instead of drawtiles. You may want to use the code from the old GBshield script. It is similar to what you want except that it activates the shield when you press R and it has strafing.

Script


When I have more free time I could try to modify this for you.

#4 Jared

Jared

    Deified

  • Members
  • Real Name:Jared
  • Pronouns:He / Him
  • Location:New Hampshire

Posted 06 February 2012 - 10:19 PM

Well, I could just make Link hold the shield idly until he puts it on a button item. So no tile editors are needed. ^^
I'll try it. Thank you Russ!

MM, I know, you used that script in PoS. And to be honest, I HATED it. I hated how you had to hold the button that was so far (If you didn't want to move the default button). Pressing 3 buttons at once happened once I think...wasn't pretty. And the strafing I don't like.

Russ, do I make separate items for each shield direction?

#5 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 06 February 2012 - 10:46 PM

No, just one item. Set a different tile for each direction instead.

#6 Jared

Jared

    Deified

  • Members
  • Real Name:Jared
  • Pronouns:He / Him
  • Location:New Hampshire

Posted 06 February 2012 - 10:51 PM

So he'll float around with one tile, instead of walking?? O_o

#7 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 06 February 2012 - 10:53 PM

That's why I suggested a modification of the old script, which relies on LTMs.

#8 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 06 February 2012 - 11:20 PM

No, he won't walk when he's shielding. I thought you said you didn't want him to be able to. If you do, I'll have to modify the script to use LTMs instead.

#9 Jared

Jared

    Deified

  • Members
  • Real Name:Jared
  • Pronouns:He / Him
  • Location:New Hampshire

Posted 07 February 2012 - 06:06 PM

I just thought it would be easier for you. But, I need him to walk.

I tired the script ,and set up the tiles (Just for now), and I couldn't move anything when I started the game. I couldn't even pause. icon_frown.gif

#10 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 07 February 2012 - 06:09 PM

He forgot to put a Waitframe(); right before the end of the while(true) loop. Very common mistake.

#11 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 07 February 2012 - 06:19 PM

Yeah I'm just gonna shoot myself now. You have no idea how many times I make that mistake... I added the waitframe, but since Link can't move with the script, I guess I'll need to rework it anyways.

#12 Jared

Jared

    Deified

  • Members
  • Real Name:Jared
  • Pronouns:He / Him
  • Location:New Hampshire

Posted 07 February 2012 - 09:19 PM

Okay, no problem. Thanks so much, Russ(el?). icon_smile.gif


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users