Jump to content

Photo

In Global Script how do I code if an Item is A or B item something hap


  • Please log in to reply
2 replies to this topic

#1 LikeLike888

LikeLike888

    Spicy food lover!!

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

Posted 03 March 2018 - 02:57 PM

Reason I am asking for doing something if item A or B is an item and appropriate button is pushed something happens is because item script can only be used for 1 frame so to get around it a global or ffc script needs to be used for more than one frame.

 

 

 

Code question #1: How do I code that

if at DMap 2

and at Screen 16

and if blue bomb is item that is treated as B button to use

and if treated as B button is pressed

and if blue bomb is at x and y 17

Rupees go up by 1 gradually 158 times?

 

 

 

Code question #2: How do I code that

if at DMap 17

and at Screen 09

and if Hookshot (Long) is item that is treated as A button to use

and if treated as A button is pressed

Rupees go up by 1 gradually 216 times?



#2 LikeLike888

LikeLike888

    Spicy food lover!!

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

Posted 13 March 2018 - 12:01 AM

^ reason I am asking up above two codes is so that people who want to code similar (or exact) to up above can know how to code what needs to be coded.

#3 ZoriaRPG

ZoriaRPG

    The Timelord

  • ZC Developers
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 13 March 2018 - 02:33 AM


ffc script Justin888_Bomb_example
{
     void run()
     {
          while(1)
          {
               //if at DMap 2
               if ( Game->GetCurDMap() == 2 )
               {
                    //and at Screen 16
                    if ( Game->GetCurScreen() == 0x16 ) //Unless you meant 16 decimal, which is 0x10
                    {
                         //and if blue bomb is item that is treated as B button to use
                         if ( GetEquipmentB() == I_BOMB )
                         {
                              //and if treated as B button is pressed
                              if ( Link->PressB )
                              {
                                   //and if blue bomb is at x and y 17
                                   for ( int q = Screen->NumLWeapons(); q > 0; --q )
                                   {
                                        lweapon l = Screen->LoadLWeapon(q);
                                        if ( l->ID == LW_BOMB )
                                        {
                                             if ( l->X == 17 && l->Y == 17 )
                                             {
                                                  //Rupees go up by 1 gradually 158 times?
                                                  Game->DCounter[CR_RUPEES] += 158;
                                             }
                                        }
                                   }
                              }
                         }
                    }
               }
               Waitframe();
          } //end infinite loop
     } //end run()
} //end script
 

ffc script Justin888_Hokshot_example
{
     void run()
     {
          while(1)
          {
               //if at DMap 17
               if ( Game->GetCurDMap() == 17 )
               {
                    //and at Screen 9
                    if ( Game->GetCurScreen() == 0x09 )
                    {
                         //and if longshot is on item A
                         if ( GetEquipmentA() == I_HOOKSHOT2 )
                         {
                              //and if treated as B button is pressed
                              if ( Link->PressA )
                              {
                                   //Rupees go up by 1 gradually 216 times?
                                   Game->DCounter[CR_RUPEES] += 216;
                               }
                         }
                    }
               }
               Waitframe();
          } //end infinite loop
     } //end run()
} //end script




I have absolutely no idea why you want any of this. Have fun.
  • LikeLike888 likes this


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users