Jump to content
  • 0
Tio Akima

script FRUIT (menu and array)

Question

Hi guys
I'm really bad with scripts
So I made the logic of an npc and I'm looking for help to finish.
If anyone knows.

It is a npc that checks if the player has some fruit.
Then, through a Menu, shows the fruits that the player has.
Then, the player selects the fruit he wants to change.

There are 3 levels of food.

(There are a lot of things wrong there, because like I said, it's just logic.)

 

	
	//Legenda:
	//
	// == fruits ID:
	//
	// apple:40010
	// banana:40011
	// abobora:40012
	//
	// == fruit candy ID:
	//
	// apple candy:40020
	// banana candy:40021
	// pumpkin candy:40022
	//
	// = fruit food ID
	//
	// apple food:40030
	// banana food:40031
	// pumpkin food:40032
	
	//I intend to add several fruits
	
	switch ( select ("Level 1","Level 2","Level 3","Cancelar.") )
		{
		
			case 1:

				setarray @fruits[0],40010,40011,40012;
				
				for(@i=0, @i < @fruits[0], @i++  ){	//to go through the array
				
				if(countitem(@fruits[@i])
									
						//add the fruit ID's that the player has in some variable?
						//need to store the fruits found in a new array?
				}		
				callsub MakeFood;
				break;
			
			case 2:

				setarray @fruits[0],40020,40021,40022;
				
				for(@i=0, @i < @fruits[0], @i++  ){	//to go through the array
				
				if(countitem(@fruits[@i])
									
						//add the fruit ID's that the player has in some variable?
						//need to store the fruits found in a new array?
				}		
				callsub MakeFood;
				break;
			
			case 3:

				setarray @fruits[0],40030,40031,40032;
				
				for(@i=0, @i < @fruits[0], @i++  ){	//to go through the array
				
				if(countitem(@fruits[@i])
									
						//add the fruit ID's that the player has in some variable?
						//need to store the fruits found in a new array?
				}		
				callsub MakeFood;
				break;
	
		}

MakeFood:

				if (fruits in inventary <= 1){		//found no fruit (or more than 1.)
					mes .NpcName$;
					mes "Oh... sorry...";
					mes "When you have two or more fruits equals";
					mes "come back here.";
				close;
				}

				mes .NpcName$;
				mes "These are your fruits.;
				mes "Which would you like to do";
								
				menu("@item_name+ @quantity, @item_name+ @quantity, @item_name+ @quantitye"); //menu with the fruits found in the player
				//will you need a FOR to make this menu?
	
				mes "You chose the " + @item_name + ", we can continue?";
				
					if(select("Yes, we can!:No...better not...") == 2){
						mes .NpcName$;
						mes "Ok, bye.";
						close;        
					}
					if(checkweight is 90%){	 //check if the luggage is overweight
						mes .NpcName$;
						mes "You're carrying a lot of weight..";
						mes "sorry.";
						close;
					}
				
				del item: @item_id_old,2; 	//delete two fruits old
				set item: @item_id_new;		//new food delivery
			
return;	

 

 

 

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.