Jump to content

Photo

Button-Item Shield


  • Please log in to reply
59 replies to this topic

#16 Jared

Jared

    Deified

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

Posted 21 May 2012 - 03:37 PM

I just set the dummy shield to an old item on a default subscreen. The dummy shield doesn't show up at all.

Edited by Jared, 21 May 2012 - 03:38 PM.


#17 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 21 May 2012 - 06:11 PM

That's not a problem with the script since it shouldn't give or take the item. Try using Link Data to see if you actually have the shield.

#18 SUCCESSOR

SUCCESSOR

    Apprentice

  • Banned
  • Real Name:TJ

Posted 21 May 2012 - 06:31 PM

Jared, What Class is it? If it shares a Class with another item that has a higher level it won't show up. Thats all i can think of.

I just tried it with all the shields. My "Dummy lShields" showed up on screen but didn't seem to trigger the script. I set the constants.

Edited by SUCCESSOR, 21 May 2012 - 06:32 PM.


#19 Jared

Jared

    Deified

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

Posted 21 May 2012 - 07:17 PM

MM, I pick up the item from the ground. I obviously pick it up. I HAVE the item.

And Successor, I'm using a new, blank quest file to test this. So that can't be the problem.

#20 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 21 May 2012 - 07:57 PM

Shouldnt there be a rule that all scripts come with functioning examples and instructions like the Joe123 site here it would be way easier to get them working if there was. This site setup is perfect for scripts.

ZC REALM

Edited by tox_von, 21 May 2012 - 07:58 PM.


#21 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 21 May 2012 - 10:44 PM

Functioning examples and instructions are great for database entries - this is something I just wrote up/modified for a quick request.

Edited and tested! I removed a lot of unnecessary code (since you didn't want strafing), so be sure to clear it out in your copy. Instead of six constants for six shields, use the new item script to determine the shield item that will be given (D0 argument).
CODE
//import "std.zh"

const int SFX_GBSHIELD = 17; //Shield active SFX

int shieldItem; //Shield item to give (set by item script, reset each frame)
bool shieldButton; //False = B, True = A

global script slot_2{
    void run(){
    //Initializations
    bool shieldOn;
        
        while(true){
            if( !shieldOn && shieldItem ){ //Enable shield when using dummy
                shieldOn=true; //Set shield state to on
                Link->Item[shieldItem]=true; //Give the shield
                Game->PlaySound(SFX_GBSHIELD); //Play the sound
            }
            else if( ( (shieldButton && !Link->InputA)||(!shieldButton && !Link->InputB)) //When button is released
            && shieldOn){ //And shield is still on
                Link->Item[shieldItem]=false;
                shieldItem = 0;
                shieldOn = false;
            }

            Waitframe();
        }                 // end while
    }                  //end void run
}

//D0: "Real" shield item to give
item script gbshield{
    void run ( int shield ){
        shieldItem = shield;
        if ( Link->PressB ) shieldButton = false;
        else if ( Link->PressA ) shieldButton = true;
    }
}


#22 SUCCESSOR

SUCCESSOR

    Apprentice

  • Banned
  • Real Name:TJ

Posted 22 May 2012 - 01:55 AM

Works perfectly. Good job.

Would you mind posting your original R-Triggered script?

#23 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 22 May 2012 - 07:23 AM

Sure thing (includes R trigger and strafing, NOT BY ME).
Original GBshield


#24 Jared

Jared

    Deified

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

Posted 22 May 2012 - 03:05 PM

I set it up. But, it's still not showing up in my subscreen. I have no idea why. Can you help me...again? And with a more detailed setup?

#25 SUCCESSOR

SUCCESSOR

    Apprentice

  • Banned
  • Real Name:TJ

Posted 22 May 2012 - 04:56 PM

Well since I have no idea what could be wrong i will just go through it all.

Create a new item: Say #255
Name it after what ever shield you want it to work as.
Set it's class to Custom Class 20
Set as Equipment Item
Set level 1 for Small Shield, 2 For Magic, 3 For mirror
pick the tile you want to use
Set the action script to whatever slot the shield script is on
set arguments

Edit the default subscreen (you can check which one is used by going to Quest > Dmaps > 0 > Appearance)
Right click on an item (the Bait for instance) and click properties.
Change item class to Custom Class 20
Your item should show up there now instead of the Bait.

Set the Item to a screen.

Now play the quest an it should pick up.

I just did exactlyl this on a brand new qst file and it worked(not perfectly as it did on my quest, i don't know why).

EDIT: (Obviously I also Imported the script, compiled it, and set it to Global slot 2, and an item slot)

Edited by SUCCESSOR, 22 May 2012 - 05:00 PM.


#26 Jared

Jared

    Deified

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

Posted 22 May 2012 - 09:19 PM

I did all of that! But it's still not showing up, and I can't use it.

Did I miss something in the new script that I have to edit or something??

#27 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 22 May 2012 - 09:28 PM

Would you mind sending me your file to see what you did wrong? Or else making a test quest how you set it up?

#28 Jared

Jared

    Deified

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

Posted 22 May 2012 - 10:17 PM

I have been using a test quest.

I put both the shield and shield dummy, because I didn't know if I needed both.

http://www.mediafire...p1ay849c7yzg1u1

#29 SUCCESSOR

SUCCESSOR

    Apprentice

  • Banned
  • Real Name:TJ

Posted 22 May 2012 - 10:22 PM

QUOTE(Jared @ May 22 2012, 08:19 PM) View Post

I did all of that! But it's still not showing up, and I can't use it.

Did I miss something in the new script that I have to edit or something??


The problem you are describing has nothing to do with the script. The script waits for you to get the item and use it which triggers the item script which in turn triggers the global script. If you cannot acquire the item then the problem is originating before the scripts come into play.

If the problem was that you acquired the dummy shield but when you used it it did nothing. That would be a problem with either the script or how the script was set up.

For instance when i loaded the script into a blank quest to test it out. I set up only the Magic Shield and when I acquired the dummy magic shield in game it set the small shield permanently, so pushing B basically toggled between the small and magic shield. Thats a script problem. Picking up the dummy shield but it not showing up in the subscreens isn't.

QUOTE(Jared @ May 22 2012, 09:17 PM) View Post

I have been using a test quest.

I put both the shield and shield dummy, because I didn't know if I needed both.

http://www.mediafire...p1ay849c7yzg1u1


Looks like you didn't set it up in the subscreen.

Edit Active (NEW, B) subscreen, right click on bait, click properties, change Class to Custom Class 1

Edited by SUCCESSOR, 22 May 2012 - 10:24 PM.


#30 Jared

Jared

    Deified

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

Posted 22 May 2012 - 10:23 PM

I did set it up! It's in the first subscreen. It has the sprite of the Z1 Mirror Shield.

Edit - Oh WOW! I forgot to set up the right subscreen! It works perfectly! I'm so sorry for all the trouble I've caused!

Is there a way for it to appear in Link's hand, but not be held up until he presses the shield button?

Thank you so much for the script, btw. Works perfectly. icon_smile.gif

Edited by Jared, 22 May 2012 - 10:26 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users