JayPee Posted December 29, 2011 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 633 Reputation: 78 Joined: 11/14/11 Last Seen: September 20, 2017 Share Posted December 29, 2011 (edited) This is my first script in which I use setd and getd to create a some what a MultiDimensional Array Script Name: Just Another Quest NPC Version: 1 Developed By: JayPee Mateo Description: This is my first script using SETD and GETD. My Concept here is just a simple quest NPC where you declared the reward and multiple requirements. Limitation: This can only give 1 Reward pero quest Format: CATEGORYCOUNTER = this counter must be start to zero ex: setd ".Categories_0$","TITLE"; CATEGORY = is the array index use in a category ex: setd ".Categories_0$","Headgear"; is in index 0 ITEMIDCOUNTER = must be start to 0 this is for ITEMID Counter = must be start to 0 Categories: setd ".Categories_CATEGORYCOUNTER$","TITLE"; Reward/Item: setd ".Item_CATEGORY_ITEMIDCOUNTER",ITEMID; setd ".Item_CATEGORY_ITEMIDCOUNTER_0",AMOUNT; = This is always in 0 index Requirements: setd ".Item_CATEGORY_ITEMIDCOUNTER_Counter",REQUIRED_ITEMID; setd ".Item_CATEGORY_ITEMIDCOUNTER_Counter_1",REQUIRED_Amount; = This is always in 1 index prontera,153,169,4 script ItemGiver 123,{ //Configuration: set .npcname$,"Item Giver"; set .arrayCounter,0; //Categories // This are the Categories of your Items setd ".Categories_0$","Headgear"; setd ".Categories_1$","Armors"; setd ".Categories_2$","Footgears"; //Headgears setd ".Item_0_0",501; //ItemID setd ".Item_0_0_0",124; //Amount setd ".Item_0_0_0_0",506; //Required ITEMID setd ".Item_0_0_0_0_1",20; //Required Amount setd ".Item_0_0_0_1",507; //Required ITEMID setd ".Item_0_0_0_1_1",20; //Required Amount setd ".Item_0_1",502; //ItemID setd ".Item_0_1_0",124; //Amount setd ".Item_0_1_0_0",506; //Required ITEMID setd ".Item_0_1_0_0_1",20; //Required Amount setd ".Item_0_1_0_1",507; //Required ITEMID setd ".Item_0_1_0_1_1",20; //Required Amount //Armors setd ".Item_1_0",503; //ItemID setd ".Item_1_0_0",20; //Amount setd ".Item_1_0_0_0",506; //Required ITEMID setd ".Item_1_0_0_0_1",20; //Required Amount setd ".Item_1_0_0_1",507; //Required ITEMID setd ".Item_1_0_0_1_1",20; //Required Amount setd ".Item_1_1",504; //ItemID setd ".Item_1_1_0",124; //Amount setd ".Item_1_1_0_0",506; //Required ITEMID setd ".Item_1_1_0_0_1",20; //Required Amount setd ".Item_1_1_0_1",507; //Required ITEMID setd ".Item_1_1_0_1_1",20; //Required Amount //Footgears setd ".Item_2_0",505; //ItemID setd ".Item_2_0_0",20; //Amount //Format: //.Item_Cateogry_ItemID_0_RequiredITEMID //.Item_Cateogry_ItemID_0_RequiredITEMID_AMOUNT = 1 setd ".Item_2_0_0_0",506; //Required ITEMID setd ".Item_2_0_0_0_1",20; //Required Amount setd ".Item_2_0_0_1",507; //Required ITEMID setd ".Item_2_0_0_1_1",20; //Required Amount setd ".Item_2_0_0_2",508; //Required ITEMID setd ".Item_2_0_0_2_1",20; //Required Amount setd ".Item_2_0_0_3",508; //Required ITEMID setd ".Item_2_0_0_3_1",20; //Required Amount mes .npcname$; mes "Hello how may I help you?"; callsub CountArrayString,".Categories_",""; //Count the Elements to a given setd array set .makeMenu$,""; set .categoryCount,.arrayCounter; for(set .i,0;.i<.arrayCounter;set .i,.i+1) { if(.makeMenu$=="") set .makeMenu$,getd(".Categories_"+.i+"$"); else set .makeMenu$,.makeMenu$+":"+getd(".Categories_"+.i+"$"); } set .selectMenu,select(.makeMenu$); mes getd(".Categories_"+(.selectMenu-1)+"$"); set .makeMenu$,""; callsub CountArrayInt,".Item_"+(.selectMenu-1)+"_",(-1); //Count the Elements to a given setd array for(set .j,0;.j<.arrayCounter;set .j,.j+1) { if(.makeMenu$=="") set .makeMenu$,"["+getd(".Item_"+(.selectMenu-1)+"_"+.j+"_0")+" pc(s).] - "+getitemname(getd(".Item_"+(.selectMenu-1)+"_"+.j)); else set .makeMenu$,.makeMenu$+":"+"["+getd(".Item_"+(.selectMenu-1)+"_"+.j+"_0")+" pc(s).] - "+getitemname(getd(".Item_"+(.selectMenu-1)+"_"+.j)); } set .selectItem,select(.makeMenu$); callsub CountArrayInt,".Item_"+(.selectMenu-1)+"_"+(.selectItem-1)+"_0_",(-1); //Count the Elements to a given setd array next; set .isNotAllowed,2; mes .npcname$; mes "Requirements:"; for(set .i,0; .i<.arrayCounter;set .i,.i+1) { mes "["+getd(".Item_"+(.selectMenu-1)+"_"+(.selectItem-1)+"_0_"+.i+"_1")+" pcs. ] "+getitemname(getd(".Item_"+(.selectMenu-1)+"_"+(.selectItem-1)+"_0_"+.i)); if(countitem(getd(".Item_"+(.selectMenu-1)+"_"+(.selectItem-1)+"_0_"+.i)) < getd(".Item_"+(.selectMenu-1)+"_"+(.selectItem-1)+"_0_"+.i+"_1")) { set .isNotAllowed,1; } } set .yesno,select("Yes:No"); if(.yesno==1 && .isNotAllowed==2) { for(set .i,0; .i<.arrayCounter;set .i,.i+1) { delitem getd(".Item_"+(.selectMenu-1)+"_"+(.selectItem-1)+"_0_"+.i),getd(".Item_"+(.selectMenu-1)+"_"+(.selectItem-1)+"_0_"+.i+"_1"); } getitem getd(".Item_"+(.selectMenu-1)+"_"+(.selectItem-1)),getd(".Item_"+(.selectMenu-1)+"_"+(.selectItem-1)+"_0"); } else { next; mes .npcname$; mes "You do not meet the requirements"; mes "Please go away!"; } close; CountArrayInt: //Use Count Array Like Integer Variables set .arrayCounter,0; while(1) { if(getarg(1)>=0) set .arrname$,getarg(0)+(.arrayCounter)+getarg(1); else set .arrname$,getarg(0)+(.arrayCounter); if(getd(.arrname$)==0) { set .arrname$,""; return; } else { set .arrayCounter,.arrayCounter+1; continue; } } end; CountArrayString: //Use Count Array Like String Variables set .arrayCounter,0; while(1) { if(getarg(1)!="") set .arrname$,getarg(0)+(.arrayCounter)+getarg(0)+"$"; else set .arrname$,getarg(0)+(.arrayCounter)+"$"; if(getstrlen(getd(.arrname$))==0) { set .arrname$,""; return; } else { set .arrayCounter,.arrayCounter+1; continue; } } end; } Edited December 29, 2011 by JayPeeMateo Quote Link to comment Share on other sites More sharing options...
Eucharist96 Posted December 29, 2011 Group: Members Topic Count: 17 Topics Per Day: 0.00 Content Count: 54 Reputation: 2 Joined: 12/09/11 Last Seen: February 28, 2013 Share Posted December 29, 2011 Nice Script Jaypee =)) i love this @request Sir Jaypee can you make another like this? For Example HeadGear,Feather Beret etc. Change for pods =)) Quote Link to comment Share on other sites More sharing options...
Emistry Posted December 29, 2011 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10017 Reputation: 2369 Joined: 10/28/11 Last Seen: 6 hours ago Share Posted December 29, 2011 @request Sir Jaypee can you make another like this? For Example HeadGear,Feather Beret etc. Change for pods =)) it sound just like a POD exchanger or trader.....so..go search for POD exchanger / trader in the forum. Quote Link to comment Share on other sites More sharing options...
Eucharist96 Posted December 30, 2011 Group: Members Topic Count: 17 Topics Per Day: 0.00 Content Count: 54 Reputation: 2 Joined: 12/09/11 Last Seen: February 28, 2013 Share Posted December 30, 2011 Not Like That. I think what your saying is a shop Right?? but i want is like a Quest npc =(( Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.