Edited by Jared, 21 May 2012 - 03:38 PM.
Button-Item Shield
#16
Posted 21 May 2012 - 03:37 PM
#17
Posted 21 May 2012 - 06:11 PM
#18
Posted 21 May 2012 - 06:31 PM
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
Posted 21 May 2012 - 07:17 PM
And Successor, I'm using a new, blank quest file to test this. So that can't be the problem.
#21
Posted 21 May 2012 - 10:44 PM
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).
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
Posted 22 May 2012 - 01:55 AM
Would you mind posting your original R-Triggered script?
#23
Posted 22 May 2012 - 07:23 AM
#24
Posted 22 May 2012 - 03:05 PM
#25
Posted 22 May 2012 - 04:56 PM
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
Posted 22 May 2012 - 09:19 PM
Did I miss something in the new script that I have to edit or something??
#27
Posted 22 May 2012 - 09:28 PM
#28
Posted 22 May 2012 - 10:17 PM
I put both the shield and shield dummy, because I didn't know if I needed both.
http://www.mediafire...p1ay849c7yzg1u1
#29
Posted 22 May 2012 - 10:22 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??
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.
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
Posted 22 May 2012 - 10:23 PM
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.
Edited by Jared, 22 May 2012 - 10:26 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users