Jump to content

JayPee

Members
  • Posts

    633
  • Joined

  • Last visited

Everything posted by JayPee

  1. Script Name: Package Item Trader Description: This script allows you to make the NPC to require multiple items and give multiple items. Version: 1.0 Syntax: callsub(ADD_PACKAGE,"Reward",<itemid,quantity,{itemid,quantity}...>,"Required",<itemid,quantity,{itemid,quantity}...>,"Zeny",zeny,PACKAGETITLE,CATEGORY); Keywords: Reward - this is an indicator that your adding items that the npc will give to the player Required - this is an indicator that your adding items that the player must give to the npc Zeny - this is an indicator that your requiring a zeny payment set the zeny to 0 if your dont want to require zeny payment. //Script Name: Package Item Trader //Developer: JayPee Mateo //Description: This is package item trade is where you can set the NPC to require multiple items and give multiple items also. //Version: 1.0 //Some Explanation: //LABEL or CALLSUB FUNCTION NAME: ADD_PACKAGE //Zeny Payment: If you dont want to not require a zeny set it to Zero (0) //PACKAGETITLE - what do you want to call that Package //CATEGORY - on what group does it belong just to be cleaner //Syntax:callsub(ADD_PACKAGE,"Reward",<itemid,quantity,{itemid,quantity}...>,"Required",<itemid,quantity,{itemid,quantity}...>,"Zeny",zeny,PACKAGETITLE,CATEGORY); //Script royal_room3,84,136,5 script Item Trader 70,{ //Initialized Variables: set .npcName$,"^FF3300[ Trader ]^000000"; set @ctr_id,1; set @selected,0; //Clear Values deletearray @selected_ctrid[0],128; deletearray .@tmp_CatArr$[0],128; //Initialized Packages //You must initialize the item packages after the clearing and intialization of the variables //Example 1: //Reward or Item to give:Rice Cake Stick(2 pcs), Traditional Rice Cake (1pc) and Neatly Sliced Rice Cake(3 pcs) //Item Requirements: Shining Stone (1) //Zeny Payment: 1z //Title is Example 1 //Category is Category1 callsub(ADD_PACKAGE,"Reward",555,1,556,2,557,3,"Required",640,1,"Zeny",1,"Example 1","Category1"); //Example 2: //Reward or Items the npc will give: Level 1 Frost Diver //Item Requirements: Rice Cake Stick(2 pcs), Traditional Rice Cake (1pc) and Neatly Sliced Rice Cake(3 pcs) //Zeny Payment: 0z or no required zeny //Title is Example 2 //Category is Category2 callsub(ADD_PACKAGE,"Reward",700,1,"Required",555,1,556,2,557,3,"Zeny",0,"Example 2","Category2"); set .@makeString$,""; for(set .@i,1; .@i<@ctr_id; set .@i,.@i+1) { set .@tmp_cat$,getd("."+.@i+"_category$"); if(.@makeString$ == "") { setarray .@tmp_CatArr$[getarraysize(.@tmp_CatArr$)],.@tmp_cat$; set .@makeString$,.@tmp_cat$; } else { if(compare(.@makeString$,.@tmp_cat$)==0) { setarray .@tmp_CatArr$[getarraysize(.@tmp_CatArr$)],.@tmp_cat$; set .@makeString$,.@makeString$+":"+.@tmp_cat$; } } } mes .npcName$; mes "Please choose the ^FF0000item category^000000:"; set @selected,select(.@makeString$); set .@tmp_cat$,.@tmp_CatArr$[@selected-1]; set .@hasValue,callsub(getCTRIDByCAT,.@tmp_cat$,@ctr_id); if(.@hasValue==1) { goto LIST_TITLES; } else mes "Weird....Nothing found!"; close; LIST_TITLES: next; mes .npcName$; mes "Kindly choose the ^FF0000item package^000000:"; set .@makeString$,""; for(set .@i,0; .@i<getarraysize(@selected_ctrid); set .@i,.@i+1) { if(.@makeString$ == "") { set .@tmp_cat$,getd("."+@selected_ctrid[.@i]+"_title$"); set .@makeString$,.@tmp_cat$; } else { set .@tmp_cat$,getd("."+@selected_ctrid[.@i]+"_title$"); set .@makeString$,.@makeString$+":"+.@tmp_cat$; } } set @selected,select(.@makeString$)-1; set .@tmp_cat$,getd("."+@selected_ctrid[@selected]+"_title$"); goto LIST_INFO; end; LIST_INFO: set .@tmp_CTRID,@selected_ctrid[@selected]; next; mes "^FF3300"+.@tmp_cat$+" Information^000000"; //List rewards mes "Reward:"; for(set .@i,0; .@i<getd("."+.@tmp_CTRID+"_rew_size"); set .@i,.@i+1) { set .@tmp_name$,getitemname(getd("."+.@tmp_CTRID+"_item_rew_id["+.@i+"]")); set .@tmp_quantity,getd("."+.@tmp_CTRID+"_item_rew_quantity["+.@i+"]"); mes "* "+.@tmp_name$+" - "+.@tmp_quantity+" pc(s)."; } mes "\n"; //List requirements mes "Requirements:"; for(set .@i,0; .@i<getd("."+.@tmp_CTRID+"_req_size"); set .@i,.@i+1) { set .@tmp_itemid,getd("."+.@tmp_CTRID+"_item_req_id["+.@i+"]"); set .@tmp_name$,getitemname(.@tmp_itemid); set .@tmp_quantity,getd("."+.@tmp_CTRID+"_item_req_quantity["+.@i+"]"); if(countitem(.@tmp_itemid)<.@tmp_quantity) setarray .@errors$[getarraysize(.@errors$)],.@tmp_name$+" -[ "+countitem(.@tmp_itemid)+" / "+.@tmp_quantity+" ]"; mes "* "+.@tmp_name$+" - "+.@tmp_quantity+" pc(s)."; } set .@tmp_zeny_req,getd("."+.@tmp_CTRID+"_zeny_req"); //Check if there is a zeny requirements if(.@tmp_zeny_req>0) mes "* Zeny - "+.@tmp_zeny_req+" z."; //Zenny Requirements: it will skip the zeny requirements if set to 0 if(Zeny<.@tmp_zeny_req && .@tmp_zeny_req>0) setarray .@errors$[ getarraysize(.@errors$)],"Zenny - ["+Zeny+"/ "+.@tmp_zeny_req+" ]"; switch(select("Claim Reward:I'll be back")) { case 1: next; mes "^FF3300"+.npcName$+" - Claim Reward^000000"; if(getarraysize(.@errors$)>0) { mes "You dont have all the required items:"; for(set .@i,0; .@i<getarraysize(.@errors$); set .@i,.@i+1) { mes (.@i+1)+".] "+.@errors$[.@i]; } close; } else { //Consuming all the requirements for(set .@i,0; .@i<getd("."+.@tmp_CTRID+"_req_size"); set .@i,.@i+1) { set .@tmp_itemid,getd("."+.@tmp_CTRID+"_item_req_id["+.@i+"]"); set .@tmp_quantity,getd("."+.@tmp_CTRID+"_item_req_quantity["+.@i+"]"); delitem .@tmp_itemid,.@tmp_quantity; } //Consuming the zeny if(.@tmp_zeny_req>0) set Zeny,Zeny-.@tmp_zeny_req+" z."; //Giving all the rewards mes "Rewards Given:"; for(set .@i,0; .@i<getd("."+.@tmp_CTRID+"_rew_size"); set .@i,.@i+1) { set .@tmp_itemid,getd("."+.@tmp_CTRID+"_item_rew_id["+.@i+"]"); set .@tmp_quantity,getd("."+.@tmp_CTRID+"_item_rew_quantity["+.@i+"]"); mes "* "+getitemname(.@tmp_itemid)+" - "+.@tmp_quantity+" pc(s)."; getitem .@tmp_itemid,.@tmp_quantity; } } mes "Here you go! Hope you enjoy the reward"; close; case 2: next; mes "^FF3300"+.npcName$+"^000000"; mes "Okay, bye!"; close; } end; ADD_PACKAGE: set .@keywordFinder,0; //This is the indicator if the keyword has been found set .@shift,0; //This is for itemid and quantity set .@pairChecker,0; //Checks if there are missing arguments example: itemid itemid quantity //Important Keywords //Reward = for the reward items //Required = for the required items //Zeny = if you want to specify a zenny //Returned Variables: //@ctr_id - is the number of packages produced //@ctr_id_rew_size = arraysize of the reward array; //@ctr_id_req_size = arraysize of the required array; //@ctr_id_item_rew_id[index] = arrayvariable of rewards itemid //@ctr_id_item_rew_quantity[index] = arrayvariable of rewards quantity //@ctr_id_item_req_id[index] = arrayvariable of required itemid //@ctr_id_item_req_quantity[index] = array variable of the required quantity //@ctr_id_zeny_req = zeny requirements this is not an array //@ctr_id_title$ = title of the package //@ctr_id_category$ = name of the group of the package //Check if the Reward keyword is found else report error if(""+getarg(0)!="Reward") { debugmes "The first argument for ADD_ITEM callsub function must be Reward. Error occur at counter id: "+@ctr_id; return 0; } //This will be use in the array index set .@tmp_loopctr,0; //Loop all the initialize requirements for(set .@add,1; .@add<getargcount(); set .@add,.@add+1) { //If Required keyword has been found break loop if(""+getarg(.@add)=="Required") { //Store the number value where the Required keyword has been found set .@keywordFinder,.@add; break; } if(.@shift==0) { if(getarg(.@add)==0) { debugmes "The item id for Reward and Requirements cannot be zero. Error occur at counter id: "+@ctr_id; end; } setd "."+@ctr_id+"_item_rew_id["+(.@tmp_loopctr)+"]",getarg(.@add); set .@shift,1; } else { if(getarg(.@add)==0) { debugmes "The quantity for items Reward and Requirements cannot be zero. Error occur at counter id: "+@ctr_id; end; } setd "."+@ctr_id+"_item_rew_quantity["+(.@tmp_loopctr)+"]",getarg(.@add); set .@tmp_loopctr,.@tmp_loopctr+1; set .@shift,0; } set .@pairChecker,.@pairChecker+1; } setd "."+@ctr_id+"_rew_size",.@pairChecker/2; //Store the arraysize of the Reward Items //If there are missing arguments in Rewards its either quantity or itemid //Check if the itemid and quantity match. //Error Example: 1100,111,111 //Right Example: 1100,111,1101,111 if(.@pairChecker%2==1) { debugmes "Missing arguments in Reward. Error Occured at counter id: "+@ctr_id; end; } //If Required Keyword has been found //it must not be equal to zero to verify that required keyword has been found if(.@keywordFinder == 0) { debugmes "No Required Keyword Found. Error occured at counter id: "+@ctr_id; end; } //Required Keyword set .@pairChecker,0; //Reset the pair checker set .@tmp_keywordFinder,.@keywordFinder; //Store the last keywordfinder value to a temporary variable set .@shift,0; //For itemid and quantity shifting //This will be use as the array index/key set .@tmp_loopctr,0; //Get all the Required Items for(set .@add,.@keywordFinder+1; .@add<getargcount(); set .@add,.@add+1) { //Check if the Zeny Keyword has been found else continue looping if(""+getarg(.@add)=="Zeny") { //Store the number value where the Required keyword has been found set .@keywordFinder,.@add; break; } if(.@shift == 0) { if(getarg(.@add)==0) { debugmes "The item id for Reward and Requirements cannot be zero. Error occur at counter id: "+@ctr_id; end; } setd "."+@ctr_id+"_item_req_id["+(.@tmp_loopctr)+"]",getarg(.@add); set .@shift,1; } else { if(getarg(.@add)==0) { debugmes "The quantity for items Reward and Requirements cannot be zero. Error occur at counter id: "+@ctr_id; end; } setd "."+@ctr_id+"_item_req_quantity["+(.@tmp_loopctr)+"]",getarg(.@add); set .@tmp_loopctr,.@tmp_loopctr+1; set .@shift,0; } set .@pairChecker,.@pairChecker+1; } setd "."+@ctr_id+"_req_size",.@pairChecker/2; //Array size of the required items //If there are missing arguments in Rewards its either quantity or itemid if(.@pairChecker%2==1) { debugmes "Missing arguments in Required Keyword. Error Occured at counter id: "+@ctr_id; end; } //If reward has not been found if(.@keywordFinder == .@tmp_keywordFinder) { debugmes "No Zeny Keyword Found. Error occured at counter id: "+@ctr_id; end; } //Zeny Keyword if(getarg(.@keywordFinder+1)<0) { debugmes "Negative Zeny Requirments Not Allowed. Error occured at counter id: "+@ctr_id; end; } setd "."+@ctr_id+"_zeny_req",getarg(.@keywordFinder+1); //Title if(""+getarg(.@keywordFinder+2)==""+0) { debugmes "Title Required. Error occured at counter id: "+@ctr_id; end; } setd "."+@ctr_id+"_title$",getarg(.@keywordFinder+2); //Category if(""+getarg(.@keywordFinder+3)==""+0) setd "."+@ctr_id+"_category$","Uncategorized"; else setd "."+@ctr_id+"_category$",getarg(.@keywordFinder+3); set @ctr_id,@ctr_id+1; return 1; //Return a 1 if success end; getCTRIDByCAT: //Getting the CTR ID's related to the assigned to a category //getarg(0) - is the category //getarg(1) - is the total ctr id set .@tmp_ctr,0; for(set .@i,1; .@i<getarg(1); set .@i,.@i+1) { set .@tmp_strcat$,getd("."+.@i+"_category$"); if(.@tmp_strcat$ == getarg(0)) { setarray @selected_ctrid[.@tmp_ctr],.@i; set .@tmp_ctr,.@tmp_ctr+1; } } if(getarraysize(@selected_ctrid)>0) return 1; //Return 1 if there is a CTRID's found return 0; end; }
  2. This is just a additional script command for Math Function. Since I dont know yet on how to make a .diff file we will just do it manually. Function: abs(<numbe); 1.) Edit src/map/script.c 2.) Find BUILDIN_FUNC(distance) then add this below //JayPee Additional Math Function: absolute BUILDIN_FUNC(abs) { int a; int x; x = script_getnum(st,2); a = abs(x); script_pushint(st,a); return 0; } 3.) Now find BUILDIN_DEF(set,"rv"), then add this below. BUILDIN_DEF(abs,"i"), //JayPee 4.) Recompile your server.
  3. you can disable the 3rd job quest @ npc/scripts_jobs.conf
  4. i think that happens when you have 0 deaths because if you have zero death it will lead to a undefined result example: 14 kills / 0 deaths = undefined. I think if you have 0 deaths you should have a 14.0 ratio. My guess is to make +1 to deaths so it would be 14 kills / 0+1 deaths = 14.0 ratio
  5. Script Name: strDivide Type: Function Link: http://rathena.org/b...ue-in-division/ Script Name: Package Item Trader Type: Item Trader Link: http://rathena.org/b...ge-item-trader/ Script Name: Server Users Online Highest Peak Type: Invicible NPC Link: http://rathena.org/b...ighest-peak-10/ Script Name: Server Users Online Highest Peak Type: Item Trader Link: http://rathena.org/b...eforpoints-npc/ Script Name: Speed Pots Minigame Type: Minigame Link: http://rathena.org/board/topic/60688-speed-pots-minigame/page__pid__87806#entry87806/
  6. you should have the unlock date data where it should be unlock like this algorithm
  7. for group 0 or normal player group use [true,false] so that they cant use # which is to invoke a command to another character.
  8. JayPee

    FluxCP

    try cleaning up your data/tmp/ folder
  9. Baka di naka on ung Map Server kaya rejected
  10. as far as I know you dont need to restart the server when you use init_set(); and also clear your fluxCP cache here at data/tmp/
  11. @glemor i think it might be a lua problem, try to check if you have this in your data folder ChatWndInfo_U.lua and OptionInfo.lua they must be in the data folder, if you put them inside the grf youll get an error similar to what you have been experiencing.
  12. here is the link: http://www.brothersoft.com/mysql-query-browser-for-windows-71868.html
  13. dapat nasa ibang level sya kung gusto mo syang lagyan ng @item command
  14. I dont know if Iam right coz I think Merchants are allowed to use vending outside the twon? If yes, I think it will be tedious for him to add all the maps in the novending.txt mapflag.
  15. That is the command you will use if your using Linux with no GUI. mysqldump -u [user] -p[password] [database_name] > [backupfile].sql but if your using Windows and you have phpmyadmin or MySQL Workbench, you just need to find Export.
  16. As far as I remember when you visit the itemshop page there is a link Add Item something like that in the main content
  17. I think this is the reverse of the mapflag novending and this will required a SRC modification. Since if will take ages to write down all the maps in the novending mapflag
  18. can you try your root account in mysql? if does work i think the problem is the ragnarok account.
  19. php.ini is like configuration file. But i think in shared webhosting they do not allow you to edit the php.ini instead you use init_set() function like this: init_set("safe_mode","0"); I think you put this code inside index.php at the top or beginning. Please make sure that your not using PHP 5.4 because I read in php.net that safe_mode is removed in PHP 5.4
  20. In windows you need to enable word wrapping which is in the Format
  21. Here is the breakguild command: @guildbreak - only the game master can break the guild find: ACMD_FUNC(guild) add the code below the function ACMD_FUNC(guildbreak) { struct guild *g; nullpo_retr(-1,sd); g=guild_search(sd->status.guild_id); if(g==NULL) { clif_displaymessage(fd, "You dont have a guild."); return -1; } if (strcmp(g->master, sd->status.name) != 0) { clif_displaymessage(fd, "Only the guild master can break this guild."); return -1; } //Verified that the player is the guild master. guild_broken(g->guild_id,0); return 0; } The result looks like this: then now find: ACMD_DEF(guild), add below: ACMD_DEF(guildbreak),//JayPee The result looks like this: Now recompile your server.
×
×
  • Create New...