Jump to content

Photo

How do I code if Link is on a combo113 one rupee gets drained constant


  • Please log in to reply
9 replies to this topic

#1 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 19 June 2018 - 07:19 PM

Please correct my coding if it is wrong thank you and will
if (Link->X == Combo113-> && Link->Y == Combo 113->Y)
{
  Game[CR_DRupees] -= 1;
}
work error free or how exactly do I change up above code to do what I need to do please?

#2 klop422

klop422

    Guess I'm full of monsters and treasure

  • Members
  • Real Name:Not George
  • Location:Planet Earth

Posted 19 June 2018 - 07:32 PM

Don't really know how ZScript works, but, first of all, your Link->X is set to be checked against something from Combo113, but you haven't filled that in.

In short, try changing that to Combo113->X, and that should solve something, at least.

 

Also, is CR_DRupees a function? Again, don't quite know how this works.



#3 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 19 June 2018 - 07:56 PM

You want
Game->DCounter[CR_RUPEES] -= 1;

#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 19 June 2018 - 08:16 PM

Please correct my coding if it is wrong thank you and will

if (Link->X == Combo113-> && Link->Y == Combo 113->Y)
{
  Game[CR_DRupees] -= 1;
}
work error free or how exactly do I change up above code to do what I need to do please?

 

if (Link->X == ComboX(113) && Link->Y == ComboY(113))
{
Game->DCounter[CR_RUPEES] -= 1;
}

:

You probably want a global frame counter, and to reduce if frame%30 == 0. Further, I'd suggest distance <= 4 instead of precise coordinates.

int frame; //Global frame counter.
global script a
{
    void run()
    {
        int frame = -1;
        while(1)
        {
            if ( ++frame > 59 ) { frame = 0; } //increment the frame, and loop the frame if needed.
            Waitdraw();
            Waitframe();
            
        }
    }
}

ffc script drainRupeesOnCombo
{
    void run()
    {
        while(1)
        {
            if ( frame&30 == 0 ) //two rupees per second
            {
                if ( Abs(Link->X-ComboX(113)) <= 4 )
                {
                    if ( Abs(Link->Y-ComboY(113)) <= 4 )
                    {
                        Game->DCounter[CR_RUPEES] -= 1;
                    }
                }
            }
            Waitframe();
        }
    }
}

ffc script drainRupeesOnComboArgs //With D* args.
{
    void run(int pos, int distance, int frame_val, int amount)
    {
        while(1)
        {
            if ( frame&frame_val == 0 )
            {
                if ( Abs(Link->X-ComboX(pos)) <= distance )
                {
                    if ( Abs(Link->Y-ComboY(pos)) <= distance )
                    {
                        Game->DCounter[CR_RUPEES] -= amount;
                    }
                }
            }
            Waitframe();
        }
    }
}
    
      


#5 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 19 June 2018 - 09:53 PM

if (Abs(Link->X - ComboX(113)) < 6 && Abs(Link->Y - ComboY(113)) < 6) Game->Counter[CR_RUPEE]--;


#6 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 20 June 2018 - 06:00 PM

if (Abs(Link->X - ComboX(113)) < 6 && Abs(Link->Y - ComboY(113)) < 6) Game->Counter[CR_RUPEE]--;

Cumulative?

#7 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 20 June 2018 - 06:19 PM

Cumulative?

Where did he ask for that? He's using DCounter because that's what he thinks will drain the rupees IIRC. This one is "constant", like he asked.



#8 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 20 June 2018 - 06:34 PM

I think people are just using DCounter so that if he changes the rupee amount, it will still drain, instead of just removing.

#9 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 20 June 2018 - 07:43 PM

But it's only one rupee; there's no difference between draining and just removing manually



#10 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 20 June 2018 - 08:57 PM

Hence why I said "if he changes the rupee amount". IF he decides, say, that  he'd rather have it take 5 rupees away, using DCounter is preferable. I mean, yes, for only one rupee, it doesn't matter, but for consistency's sake, and for the sake of keeping it more moddable. Actually, I'm kinda wondering why not just do the whole thing as an FFC script. Then you can throw both the combo number to activate the effect and the rupee amount it pulls into the D args.

 

EDIT: Which is exactly what Zoria's script did. Sorry, I wasn't paying attention.


Edited by Binx, 20 June 2018 - 08:58 PM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users