Jump to content

Photo

Stamina Bar/Magic Meter with Spin Attack


  • Please log in to reply
24 replies to this topic

#1 Jared

Jared

    Deified

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

Posted 25 May 2012 - 03:30 PM

So, I guess I'm asking for a script that lets you run faster with L and R, while using up the Stamina Bar(Or, the Magic Meter. icon_razz.gif) and it replenishes itself over time.
I also need it so that when a Spin Attack is executed, magic/stamina is used. The Staff/Wand in my quest will use the Stamina (Magic xD) on it's own, so I got that covered.

So,
  • When L or R is pressed, and the player moves, they run fast and stamina (magic) is used at a certain speed.
  • Spin Attack uses stamina (magic)


Is it possible to do this? And will it work with Magic Upgrades? Thanks to whoever can help me with this!

#2 SUCCESSOR

SUCCESSOR

    Apprentice

  • Banned
  • Real Name:TJ

Posted 25 May 2012 - 04:35 PM

Consolidated scripts to one post.

Run / Magic as Stamina



I modified this http://www.purezc.co...showtopic=51319

It seems to work but I just threw it together and didn't really test it. UPDATE: I fixed it so Magic wont drain if Scrolling or holding L. Added constants so the script is more customizable. Added a dashing sound, default uses Grass Cut SFX.


Run with independent stamina meter


Modified to have an independent meter. With item for increasing "stamina" and amount of "cells" to display on screen.


Stamina Meter with refill delay and button disabling


Stamina Meter script modified to delay refill and disable all action buttons when Meter is drained to 0.


I intend to add SFX to all scripts, and dust graphics when running. Also looking into changing the meter to use combos instead of simple rectangles. I will take any suggestions to improve the scripts. And if there are any scripts that make custom meters i'd love to see them.

I am also considering combining all scripts with values to select which features to use.

Edited by SUCCESSOR, 27 May 2012 - 06:15 AM.


#3 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 25 May 2012 - 05:29 PM

dude, this script crashed my zelda classic! hahaha

edit: it's ok now with the new scripts :)

Edited by accela2me, 27 May 2012 - 10:06 PM.


#4 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 25 May 2012 - 05:39 PM

You forgot a Waitframe(). Very easy, very common mistake (that I make myself quite often).

Go to this line:
CODE
if(Link->MP < Link->MaxMP && CheckNoAction() && globaltime % 60 == 0)
                {    if(Link->MaxMP - Link->MP < 8) Link->MP = Link->MaxMP;
                else Link->MP += 8; }

And add this in the line below it:
CODE
Waitframe();


#5 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 25 May 2012 - 06:00 PM

While not a script, I can help you here.
QUOTE(Jared @ May 25 2012, 01:30 PM) View Post

Spin Attack uses stamina (magic)

Just set the spin attack scroll to consume magic in the item editor. Easier as that, I think.

#6 SUCCESSOR

SUCCESSOR

    Apprentice

  • Banned
  • Real Name:TJ

Posted 25 May 2012 - 06:35 PM

QUOTE(MoscowModder @ May 25 2012, 04:39 PM) View Post

You forgot a Waitframe(). Very easy, very common mistake (that I make myself quite often).

Go to this line:
CODE
if(Link->MP < Link->MaxMP && CheckNoAction() && globaltime % 60 == 0)
                {    if(Link->MaxMP - Link->MP < 8) Link->MP = Link->MaxMP;
                else Link->MP += 8; }

And add this in the line below it:
CODE
Waitframe();




Yeah i wrote the script inside of my Global Script so when I pulled it out to stand alone I forgot to add Waitframe(). Oh and believe me I have crashed ZC a time or two.

#7 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 25 May 2012 - 07:15 PM

the script is great now! thanks, guys!
but... (oh no, more questions??) is it possible to create a stamina bar just for this function (independent of the magic bar) and that can be enabled through an item?

#8 Jared

Jared

    Deified

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

Posted 25 May 2012 - 07:33 PM

Works pretty great! However, is there a way to make a dashing sound effect when the running is used, and a sound effect when stamina is out? Will the stamina/magic out need a different script?
Maybe even dust tiles behind Link, to show he's actually running? Or an sfx that is constantly played when he is moving with the L button held down?

Also, can the magic only be used when he's actually running, and not holding it down and standing in one spot?

Edited by Jared, 25 May 2012 - 07:35 PM.


#9 SUCCESSOR

SUCCESSOR

    Apprentice

  • Banned
  • Real Name:TJ

Posted 25 May 2012 - 09:03 PM

accela2me: I just finished something like that.

It is still very basic. If you just hold L or L and *DIR* while scrolling the meter will keep draining.


Run with independent stamina meter


I took inspiration(which is to say i stole a chunk of code and modified it to my needs) from Z2 Boss Health Meter: http://www.purezc.co...showtopic=54090

Edited by SUCCESSOR, 25 May 2012 - 10:48 PM.


#10 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 25 May 2012 - 10:34 PM

Very cool, dude! But one thing is happening: the stamina bar is being hidden in the elements of layer 3. There's something in the script where I can change the bar to be visible above all layers?

It reminds me that my greatest desire is to remove the passive subscreen, leaving everything visible on the screen (like the mirror of the moon project).

#11 SUCCESSOR

SUCCESSOR

    Apprentice

  • Banned
  • Real Name:TJ

Posted 25 May 2012 - 10:53 PM

I updated it to draw on the 6th layer. You can also change the first value of Screen->Rectangle to the layer you want the meter to be on.


Also I made a second version by changing the script a little. Pressing A and B now reduce some of the Stamina Meter. If the Stamina Meter hits 0 there is a delay before it starts to refill and while it's empty all buttons but the direction buttons are disabled.

Edited by SUCCESSOR, 27 May 2012 - 05:19 AM.


#12 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 26 May 2012 - 09:53 AM

problem with the layers: solved! thanks again :)
but new issues have appeared XD
the function is still enabled without requiring an item for it. i didn't understand why this is happening.
about using stamina with buttons A and B, it makes sense, but it would be disastrous in boss fights! so I preferred to disable this part of the script by changing the values ​​of InpA and InpB to zero.

sorry to ask so many things, buddy. i would like to help more if I knew Zscript...

#13 SUCCESSOR

SUCCESSOR

    Apprentice

  • Banned
  • Real Name:TJ

Posted 26 May 2012 - 11:31 AM

QUOTE(accela2me @ May 26 2012, 08:53 AM) View Post

problem with the layers: solved! thanks again icon_smile.gif
but new issues have appeared XD
the function is still enabled without requiring an item for it. i didn't understand why this is happening.
about using stamina with buttons A and B, it makes sense, but it would be disastrous in boss fights! so I preferred to disable this part of the script by changing the values ​​of InpA and InpB to zero.

sorry to ask so many things, buddy. i would like to help more if I knew Zscript...


Like I said the script is still basic. Do you mean that if you push A or B and there is no item set there it still uses Stamina? I didn't think that was much of an issue and unless your repeatedly hitting a button that (at that point) does nothing then I doubt most people would notice it. But I will fix it eventually. And about the disabling of buttons when at 0 being disastrous in a Boss Fight, that is kind of the point. The player has to manage their usage, not just go running and slashing about.

If you don't care for the feature where buttons get disabled when Stamina Meter is 0 use the first script.

Edited by SUCCESSOR, 26 May 2012 - 11:33 AM.


#14 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 26 May 2012 - 02:49 PM

My plan for this script is to enable the function only when the item is being used (just as the most of the Link's weapons). case it is implemented in the script, will be very useful :) I also think interesting the changes that Jared suggested. I just don't know if it is easy to adapt to the script...

About the problem with buttons A and B, I really will not use this function, so I'll do what you suggested and use the 1st script.
Thanks a lot for the help and patience, dude!

#15 Jared

Jared

    Deified

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

Posted 26 May 2012 - 02:52 PM

I am completely lost. Where is my version, and has it been updated yet?


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users