Jump to content

Photo

refill arrows to 99 when touching script flag 98


  • Please log in to reply
18 replies to this topic

#16 Lemmy Koopa

Lemmy Koopa

    We are the champions

  • Members
  • Location:Ohio

Posted 12 November 2009 - 03:10 AM

The reason I want this script is because arrows are now "water", and I want to be able to refill in water combos, or rather flag no 98, in case I don't want it filled up in specific water tiles.

#17 Joe123

Joe123

    Retired

  • Members

Posted 12 November 2009 - 05:49 AM

Come on guys, all you have to do is check for Screen->ComboI aswell as Screen->ComboF...

#18 Elmensajero

Elmensajero

    Doyen(ne)

  • Members
  • Real Name:John
  • Location:Raleigh, North Carolina

Posted 12 November 2009 - 01:48 PM

Taking into account inherent flags and whether or not the combo type is water. And I actually tested it this time...

CODE

import "std.zh"

global script slot2
{
    void run()
    {
        while(true)
        {
            Waitframe();
            SetCounter(98,CT_WATER,CR_ARROWS,99,SFX_SCALE);
        }
    }
}

// If player is touching combo of "combotype" with specified flag, the ammo is refilled to the given amount
void SetCounter(int flag, int combotype, int ammotype, int ammoamount, int sfx)
{
    //If counter is already set, return to global function
    if(Game->Counter[ammotype] == ammoamount) return;
    
    //Get the four combos that Link is touching
    int combo[4];
    combo[0] = ComboAt(Link->X,Link->Y);
    combo[1] = ComboAt(Link->X+16,Link->Y);
    combo[2] = ComboAt(Link->X,Link->Y+16);
    combo[3] = ComboAt(Link->X+16,Link->Y+16);
    
    //If any of those 4 combos have the specified flag, update the counter and play the sound
    for(int i=0;i<4;i++)
    {
        if((Screen->ComboF[combo[i]] == flag || Screen->ComboI[combo[i]] == flag) && Screen->ComboT[combo[i]] == combotype)
        {
            Game->Counter[ammotype] = ammoamount;
            Game->PlaySound(sfx);
            return;
        }
    }
}


#19 Lemmy Koopa

Lemmy Koopa

    We are the champions

  • Members
  • Location:Ohio

Posted 13 November 2009 - 01:45 PM

Thanks for the help guys.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users