Jump to content

Photo

Using up counters on Use of Item


  • Please log in to reply
29 replies to this topic

#16 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 04 April 2014 - 06:44 PM

Remove the semicolon after import "std.zh". Alternatively, you can replace CR_BOMBS with 2. :)

#17 strike

strike

    life is fragile, temporary, and precious

  • Members
  • Real Name:Olórin

Posted 04 April 2014 - 09:25 PM

I took away the semicolon and when I got it, my bombs were raised to 65,533 and when I used the boots they didn't drop. What have I done??!?!?!

 

I think I might have made it an item script on accident. Would that do it?

 

Thanks for all the help!!!!

 

-Helpless Motor Bike

 

EDIT: The weird amount increase was my mistake. I had the increase amount set to -3. There still is not a decrease in bombs though. Let me look some more.


Edited by strike, 04 April 2014 - 09:30 PM.


#18 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 04 April 2014 - 09:30 PM

Well, there's 2 ways items can run scripts. On picking up the item, or on using the item. You'll have to set the item script to it's active script instead of the pickup one.

#19 strike

strike

    life is fragile, temporary, and precious

  • Members
  • Real Name:Olórin

Posted 04 April 2014 - 09:40 PM

Okay, thanks. It is working much better now. The only problem is that if you use it without bombs your counter goes up to 65,533.

 

Thanks for all the help! I probably shouldn't be using Zquest right now as my brain is dead.

 

I officially volunteer you for saint hood after helping me with this. :lol:

 

-Strike



#20 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 04 April 2014 - 10:06 PM

Well, actually the global script is supposed to prevent just that. :(
Check if you imported the global script under the global tab, after you press compile and see if you have the active script imported into the "active" slot, when you get the chance to. Also make sure you replaced the 0 in my script with the correct number of your screen jumping item. I hope this helps :)

#21 strike

strike

    life is fragile, temporary, and precious

  • Members
  • Real Name:Olórin

Posted 05 April 2014 - 07:29 AM

I've replaced the zero. I have the script running under the item tab and I don't know how to switch it to Global. Another problem, not very important, is that is if you press the item while you are in midair it decreases your bombs even though you gain no height.

 

-Strike


Edited by strike, 05 April 2014 - 07:34 AM.


#22 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 05 April 2014 - 10:40 AM

I think you may need to re-script the Roc's Feather from scratch to make this work as it should. Fortunately, the Roc's Feather is easy to script.

 

Attach this item script to the action slot of a "Custom Itemclass xx" class item.

import "std.zh"

//D0: How high to jump in combos (*16 pixels)
//D1: How many bombs to use up
item script bombFeather{
    void run(int height, int bombs, int sfx){
        if(onGround() && Game->Counter[CR_BOMBS] >= bombs){
            Game->PlaySound(sfx);
            Link->Jump = height;
            Game->Counter[CR_BOMBS] -= bombs;
        }
    }
}

bool onGround(){
    if(IsSideview())
        return OnSidePlatform(Link->X, Link->Y);
    return Link->Z == 0;
}

Edited by MoscowModder, 05 April 2014 - 09:21 PM.

  • Avaro and strike like this

#23 strike

strike

    life is fragile, temporary, and precious

  • Members
  • Real Name:Olórin

Posted 05 April 2014 - 08:43 PM

Thanks so much!

One Small Thing, One Big Thing:

Small Thing: Is it possible to add a sound effect when you jump?

BIG THING: When you are falling, not touching anything, you can press again to jump in mid air. Repeatedly doing this and hitting your head on a ceiling will force you up through the ceiling. Anyway to fix this?

Thanks everyone for your help. I appreciate it.

-Strike

EDIT: I don't know how to script, but if there is not an easy way to tell if Link is in the air, you could have the script delay for two frames and see if Link's value on the y axis decreases and if so stop the script from running.

EDIT2: Or increases for that matter. I just realized that it blows up when rising to.

Edited by strike, 05 April 2014 - 09:09 PM.


#24 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 05 April 2014 - 09:08 PM

Small thing: Fixed above.

 

Big thing: The Link->Z == 0 part should prevent that. How odd.



#25 Cjc

Cjc

    Cor Blimey!

  • Members

Posted 05 April 2014 - 09:18 PM

Small thing: Fixed above.

 

Big thing: The Link->Z == 0 part should prevent that. How odd.

That will only work in top-down screens.  In sideview the Z axis does nothing.  I think you need to check if the screen has the sideview flag as a secondary case and then check if Link->Jump == 0.

 

It's a bummer that sideview is an xy plane instead of an xz plane.  It would simplify so many scripts.



#26 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 05 April 2014 - 09:21 PM

Ahh, forgot about that! Thanks!



#27 strike

strike

    life is fragile, temporary, and precious

  • Members
  • Real Name:Olórin

Posted 06 April 2014 - 09:38 AM

It works perfectly! :D Thanks for all the help!

 

Both of you will be included in the credits. I know it is annoying working with people who don't know what they're doing.

 

-Strike



#28 Cjc

Cjc

    Cor Blimey!

  • Members

Posted 06 April 2014 - 11:29 AM

Don't include me in the credits, Strike, MoscowModder did all of the work.



#29 strike

strike

    life is fragile, temporary, and precious

  • Members
  • Real Name:Olórin

Posted 06 April 2014 - 12:16 PM

Was talking about Avataro and Moscow. Avataro for suffering me and writing a script.

-Strike

#30 Cjc

Cjc

    Cor Blimey!

  • Members

Posted 06 April 2014 - 12:44 PM

Yeah, I just realized that and now I feel like a narcissist.  Sorry!


Edited by Cjc, 06 April 2014 - 12:45 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users