User Tag List

Results 1 to 10 of 10

Thread: MSU's Individual Item Shop Script

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    クールな男
    MasterSwordUltima's Avatar
    Join Date
    Jul 2001
    Location
    Keystonia
    Age
    36
    Posts
    5,588
    Mentioned
    20 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    8,615
    Level
    27
    vBActivity - Bars
    Lv. Percent
    99.77%

    MSU's Individual Item Shop Script

    So I'm sure this has been done before in various ways - this is just my method. There is definitely room for improvement, but I don't see anything listed here on AGN specifically, so here goes.

    [UPDATE]: Added option for buying ammo types, which you can keep buying without leaving the screen.

    Code:
     ffc script MSUShop {
      void run(int M_BUY, int I_ITEM, int I_COST, int M_BROKE, int M_SOLDOUT, int I_TYPE) {
    // D0 - M_BUY = the message when you make the buy
    // D1 - I_ITEM = the item number
    // D2 - I_COST = the amount of rupees item costs
    // D3 - M_BROKE = the message that plays if you haven't enough cash!    
    // D4 - M_SOLDOUT = the message that plays if you already have that item
    // D5 - I_TYPE = 0 for reg item, 1 for keys, 2 for arrows, 3 for bombs
    
    	while(true) {
          while(Link->X < this->X - 8 || Link->X > this->X + 24 || Link->Y < this->Y || Link->Y > this->Y + 24 || 
    
    Link->Dir != DIR_UP || !Link->InputA) {
            Waitframe();
          }      
    
    	Link->InputA = false;
    	
    
    	if(Link->Item[I_ITEM] && I_TYPE == 0)
    		{
    		Screen->Rectangle(1, 26, 9, 232, 22, 0, 1, 0, 0, 0, 1, OP_OPAQUE);
    		Screen->Message(M_SOLDOUT);
    		}
    		else if(Game->Counter[CR_RUPEES]<I_COST && !Link->Item[I_ITEM] == 1)	
    		{
    		Screen->Rectangle(1, 26, 9, 232, 22, 0, 1, 0, 0, 0, 1, OP_OPAQUE);
    		Screen->Message(M_BROKE);		
    		}
    	else if(Game->Counter[CR_RUPEES]>=I_COST && (!Link->Item[I_ITEM] || I_TYPE != 0))
    		{
    		Screen->Rectangle(1, 26, 9, 232, 22, 0, 1, 0, 0, 0, 1, OP_OPAQUE);
    		Screen->Message(M_BUY);
    			if(I_TYPE != 0){
    				if(I_TYPE == 1){Game->Counter[CR_KEYS]++;}
    				if(I_TYPE == 2){Game->Counter[CR_ARROWS]++;}
    				if(I_TYPE == 3){Game->Counter[CR_BOMBS]++;}
    				   }
    			else if(I_TYPE == 0){	
    					Link->Item[I_ITEM] = true;
    					this->Data = 0;
    					}
    		Game->PlaySound(20);
    		Game->Counter[CR_RUPEES] = Game->Counter[CR_RUPEES] - I_COST;		
    		}      	
    
    
    
          while(Link->X >= this->X - 8 && Link->X <= this->X + 24 && Link->Y >= this->Y && Link->Y <= this->Y + 24 && 
    
    Link->Dir == DIR_UP) {
            Waitframe();
          }
          
          Screen->Message(0);	
          Link->InputA = true;
    	}
    	     
        
      }
    }
    As explained in the code itself;

    D0 = the string that will show when you successfully buy the item
    D1 = the item number itself
    D2 = the cost of the item (in rupees)
    D3 = the string that will show if you don't have enough rupees
    D4 = the string that will show if you already have the item
    D5 = determines if the item is an ammo type. 0 = regular item. 1 = keys. 2 = arrows. 3 = bombs. 4 = superbombs.

    I've also used font SS3, with a Y axis of 4 for this to line up properly. I should probably add a sound in there, but haven't brushed up on the particulars of those variables. All feedback is welcome.
    Last edited by MasterSwordUltima; 02-02-2014 at 01:45 PM.

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social