Jump to content

Racaae

Members
  • Posts

    132
  • Joined

  • Last visited

  • Days Won

    13

Everything posted by Racaae

  1. EXAMPLE Open a text editor program and paste the whole card seller script. Click the save option, save it in your server folder /npc/ and name it carloscardseller.txt Now on npc/scripts_custom, add a empty new line at the end of the file and add: If you are using rAthena: npc: npc/carloscardseller.txt Just like this, if you are using Hercules: // Custom "npc/custom/support_me.txt", "npc/carloscardseller.txt", All NPCs in the server comes from txt files. Each line is a different file. So you're adding your file with your NPC so the server knows where it is, simple.
  2. Hi. From rAthena wiki: New scripts must be saved as a text file first. The file may be located anywhere in the rAthena directory, but is in the npc folder by default. So create a .txt file and paste the script in it. For an NPC to be loaded, it needs to be added to a .conf file. This is typically npc/scripts_custom.conf. Add a line, and enter your NPC file in the following format: npc: npc/path/to/your_card_seller_script.txt After adding the script, it must be loaded before the script contents take effect in game. There are a few ways to do this. The map server can be rebooted. This is generally the safest route though not the most convenient for active servers. The GM command @reloadscript maybe used in game, though this may cause monster spawn bugs.
  3. Hi. Update your rAthena or find all lines with enablenpc(); / disablenpc(); and add strnpcinfo(0) between the round brackets. Example: enablenpc(); disablenpc(); To: enablenpc(strnpcinfo(0)); disablenpc(strnpcinfo(0));
  4. Hi. Yeah, giving custom points to things like Blacksmith' weapon forging, or Alchemist's potion creation is not possible with default scripting. But if it's "crafting" using NPCs, its simple using variables. "custom_points" is not the same as "@custom_points". @variables are lost when the player logout. Just remove the @ and the points will stay. More here: (from \doc\script_commands.txt) mes "Click me to gain points"; next; switch(select("- Get Points:- Cancel")){ case 1: mes "(script get points) +1 custom points"; // Increase the value by 1. Basically gives 1 point to the player custom_points += 1; close; case 2: mes "Cancel"; close; } More Examples: mes "You got 3 points"; custom_points += 3; mes "You made the potion You got 1 point"; custom_points++; mes "You crafted the armor. You got 98346 points"; custom_points += 98346; mes "You did my task. You got 100 temporary points."; mes "You will lose them when you logout"; mes "They are unrelated to others points."; @custom_points += 100; mes "You crafted all the armors."; mes "You got 50 account points. Every character you have can spend them."; mes "They are unrelated to others points."; #custom_points += 50; Spending means losing, so just decrease the variable. Examples: mes "Ok. I will give you the Emperium for 5 points"; custom_points -= 5; getitem "EMPELIUM", 1; mes "Ok. I will give you the 15 Apples for 1 point"; custom_points--; getitem "APPLE", 15; mes "Ok. I will give you the this special buff effect. You spent 8151 points for it."; custom_points -= 8151; sc_start SC_GLORIA,300000,5; mes "OK. You spent 100 points to unlock +10 DMG weapons chance."; weapon_points -= 100; unlocked_10_dmg = true;
  5. Oi, acha essa linha: getmapxy(.M$,.x,.y,1,strnpcinfo(0)); E substitui por: getmapxy(.M$,.x,.y,BL_NPC);
  6. Hello. Useable Item function example: - Id: 12000000 AegisName: Task_Book Name: Task Book Type: DelayConsume Script: | callfunc "F_custom_points_item"; function script F_custom_points_item { mes "You have ^0055FF" + @custom_points + "^000000 Points."; close; } //===== rAthena Script ======================================= //= Hunting Missions //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.4 //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= Random hunting missions. //= Rewards are based on quest difficulty. //= //= NOTE: Requires SQL mob database. //===== Additional Comments: ================================= //= 1.0 Initial script. //= 1.1 Small improvements and fixes. //= 1.2 Added party support and replaced blacklists with an //= SQL query, both thanks to AnnieRuru. //= 1.3 Re-added a blacklist adapted for the SQL query. //= 1.3a Added mission reset options. //= 1.3b Function updates. //= 1.4 Check for deleted characters, thanks to AnnieRuru. //= Syntax updates and style cleaning. //============================================================ yuno,160,85,3 script Hunting Tasks 4_F_EDEN_MASTER,{ function Chk; cutin "arquien_n_atnad01", 2; mes "[Hunting Tasks]"; mes "Hello, " + strcharinfo(0) + "!"; if (!#Task_Delay) { next; mes "[Hunting Tasks]"; mes "I can't find any records..."; mes "You must be new here!"; emotion ET_HUK; next; callsub Task_Info; emotion ET_GO; #Task_Delay = 1; close3; } mes F_Rand("Working hard, as always...", "Not slacking, I hope..."); mes "Is there anything I can help"; mes "you with?"; mes " "; mes "^777777~ You've completed " + F_InsertPlural(Task_Total,"task",0,"^0055FF%d^777777 %s") + ". ~^000000"; next; switch(select( ((!Task0) ? " ~ New Task::" : ": ~ Task Status: ~ Abandon Task") + ": ~ Information: ~ Task Shop: ~ View Top Hunters: ~ ^777777Cancel^000000" )) { case 1: mes "[Hunting Tasks]"; if (#Task_Count) { mes "You've started a task"; mes "on another character."; if (!@hm_char_del_check) { // check for deleted character query_sql("SELECT 1 FROM `char_reg_num` WHERE `key` = 'Task0' AND `char_id` IN(SELECT `char_id` FROM `char` WHERE `account_id` = " + getcharid(3) + ")", .@i); if (!.@i) { next; mes "[Hunting Tasks]"; mes "I can't seem to find any records"; mes "for that character, though..."; mes "One moment, please."; emotion ET_SCRATCH; #Task_Count = 0; } @hm_char_del_check = true; } close3; } if (#Task_Delay > gettimetick(2) && .Delay) { mes "I'm afraid you'll have to wait " + Time2Str(#Task_Delay) + " before taking another task."; close3; } mes "You must hunt:"; if (.no_sql) { for (.@i = 0; .@i < .Quests; .@i++) { do { .@id = getrandmobid(MOBG_BRANCH_OF_DEAD_TREE, RMF_ALL, BaseLevel+15); } while (countinarray(.@mob, .@id) || (BaseLevel<=99 && strmobinfo(3,.@id) < BaseLevel-20) || (BaseLevel>99 && strmobinfo(3,.@id) < 90)); setarray .@mob[.@i],.@id; } } else query_sql("SELECT ID FROM `" + .mob_db$ + "` WHERE left(name_aegis, 4) != 'meta' AND left(name_aegis, 2) != 'E_' AND base_exp > 0 AND job_exp > 0 AND (class != 'boss' OR class is null) AND (drop3_item like '%_card' OR drop4_item like '%_card' OR drop5_item like '%_card' OR drop6_item like '%_card' OR drop7_item like '%_card' OR drop8_item like '%_card' OR drop9_item like '%_card' OR drop10_item like '%_card') AND ID < 2000 AND instr('"+.Blacklist$+"',ID) = 0 ORDER BY rand() LIMIT " + .Quests, .@mob); for (.@i = 0; .@i < .Quests; .@i++) { setd "Task" + .@i, .@mob[.@i]; setd "Task" + .@i +"_", 0; } #Task_Count = rand(.Count[0], .Count[1]); callsub Task_Status; next; mes "[Hunting Tasks]"; mes "Report back when"; mes "you've finished."; mes "Good luck!"; close3; case 2: mes "[Hunting Tasks]"; mes "Task status:"; callsub Task_Status; close3; case 3: mes "[Hunting Tasks]"; mes "Do you really want to"; mes "abandon your task?"; if (.Reset < 0 && .Delay) mes "Your delay time will not be reset."; else if (.Reset > 0) mes "It will cost " + F_InsertComma(.Reset) + " Zeny."; next; switch(select(" ~ Abandon...: ~ ^777777Cancel^000000")) { case 1: if (.Reset > 0) { if (Zeny < .Reset) { mes "[Hunting Tasks]"; mes "You don't have enough"; mes "Zeny to drop this task."; emotion ET_SORRY; close3; } Zeny -= .Reset; emotion ET_MONEY; } mes "[Hunting Tasks]"; mes "Alright, I've dropped"; mes "your current task."; specialeffect2 EF_STORMKICK4; for (.@i = 0; .@i < .Quests; .@i++) { setd "Task"+.@i, 0; setd "Task"+.@i+"_", 0; } #Task_Count = 0; if (.Reset < 0 && .Delay) #Task_Delay = gettimetick(2) + (.Delay * 3600); close3; case 2: mes "[Hunting Tasks]"; mes "I knew you were kidding!"; mes "Keep up the good work."; emotion ET_SMILE; close3; } case 4: callsub Task_Info; close3; case 5: mes "[Hunting Tasks]"; mes "You have ^0055FF" + @custom_points + "^000000 Task Points."; mes "Use them well!"; callshop "task_shop",1; npcshopattach "task_shop"; end; case 6: mes "[Hunting Tasks]"; mes "The top hunters are:"; query_sql("SELECT char_id AS id, (SELECT `name` FROM `char` WHERE char_id = id),`value` FROM `char_reg_num` WHERE `key` = 'Task_Total' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 5", .@id, .@name$, .@val); for (.@i = 0; .@i < 5; .@i++) mes " [Rank " + (.@i+1) + "] " + ((.@name$[.@i] == "") ? "^777777none" : "^0055FF" + .@name$[.@i]+"^000000 : ^FF0000" + .@val[.@i] + " pt.") + "^000000"; close3; case 7: mes "[Hunting Tasks]"; mes "Nothing? Okay..."; emotion ET_SCRATCH; close3; } end; Task_Status: @f = false; deletearray .@j[0], getarraysize(.@j); for (.@i = 0; .@i < .Quests; .@i++) { .@j[.@i] = getd("Task" + .@i); .@j[.Quests] = .@j[.Quests] + strmobinfo(3,.@j[.@i]); .@j[.Quests+1] = .@j[.Quests+1] + (strmobinfo(6,.@j[.@i]) / (getbattleflag("base_exp_rate") / 100) * .Modifier[0]); .@j[.Quests+2] = .@j[.Quests+2] + (strmobinfo(7,.@j[.@i]) / (getbattleflag("job_exp_rate") / 100) * .Modifier[1]); mes " > "+Chk(getd("Task"+.@i+"_"),#Task_Count) + strmobinfo(1,.@j[.@i]) + " (" + getd("Task"+.@i+"_") + "/" + #Task_Count + ")^000000"; } // Reward formulas: .@Task_Points = 3 + (.@j[.Quests] / .Quests / 6); .@Base_Exp = #Task_Count * .@j[.Quests+1] / 5; .@Job_Exp = #Task_Count * .@j[.Quests+2] / 5; .@Zeny = #Task_Count * .Quests * .@j[.@i] * .Modifier[2]; next; mes "[Hunting Tasks]"; mes "Task rewards:"; mes " > Task Points: ^0055FF" + .@Task_Points + "^000000"; if (.Modifier[0]) mes " > Base Experience: ^0055FF" + F_InsertComma(.@Base_Exp) + "^000000"; if (.Modifier[1]) mes " > Job Experience: ^0055FF" + F_InsertComma(.@Job_Exp) + "^000000"; if (.Modifier[2]) mes " > Zeny: ^0055FF" + F_InsertComma(.@Zeny) + "^000000"; if (@f) { @f = false; return; } next; mes "[Hunting Tasks]"; mes "Oh, you're done!"; mes "Good work."; mes "Here's your reward."; emotion ET_BEST; specialeffect2 EF_ANGEL; specialeffect2 EF_TRUESIGHT; @custom_points += .@Task_Points; BaseExp += .@Base_Exp; JobExp += .@Job_Exp; Zeny += .@Zeny; for (.@i = 0; .@i < .Quests; .@i++) { setd "Task" + .@i, 0; setd "Task" + .@i+"_", 0; } #Task_Count = 0; if (.Delay) #Task_Delay = gettimetick(2) + (.Delay * 3600); Task_Total++; if (Task_Total == 1) query_sql("INSERT INTO `char_reg_num` (`char_id`,`key`,`index`,`value`) VALUES (" + getcharid(0) + ",'Task_Total','0',1)"); else query_sql("UPDATE `char_reg_num` SET `value` = " + Task_Total + " WHERE `char_id` = " + getcharid(0) + " AND `key` = 'Task_Total'"); close3; Task_Info: mes "[Hunting Tasks]"; mes "If you so choose, I can assign"; mes "you a random hunting quest."; mes "Some are easier than others, but"; mes "the rewards increase with difficulty."; next; mes "[Hunting Tasks]"; mes "Tasks points are shared"; mes "amongst all your characters."; if (.Delay) mes "Delay time is, too."; mes "You can't take tasks on"; mes "multiple characters at once."; next; mes "[Hunting Tasks]"; mes "You can start a quest"; mes (.Delay ? "every " + ((.Delay == 1) ? "hour." : .Delay + " hours.") : "whenever you want."); mes "That's everything~"; return; function Chk { if (getarg(0) < getarg(1)) { @f = true; return "^FF0000"; } else return "^00FF00"; } OnBuyItem: .@size = getarraysize(@bought_nameid); for (.@i = 0; .@i < .@size; .@i++) { .@j = inarray(.Shop, @bought_nameid[.@i]); .@cost += (.Shop[.@j+1] * @bought_quantity[.@i]); } mes "[Hunting Tasks]"; if (.@cost > @custom_points) mes "You don't have enough Task Points."; else { for (.@i = 0; .@i < .@size; .@i++) { getitem @bought_nameid[.@i], @bought_quantity[.@i]; dispbottom "Purchased " + @bought_quantity[.@i] + "x " + getitemname(@bought_nameid[.@i]) + "."; } @custom_points -= .@cost; mes "Deal completed."; emotion ET_MONEY; } deletearray @bought_nameid[0], .@size; deletearray @bought_quantity[0], .@size; close3; OnNPCKillEvent: if (!getcharid(1) || !.Party) { if (!#Task_Count || !Task0) end; for (.@i = 0; .@i < .Quests; .@i++) { if (strmobinfo(1,killedrid) == strmobinfo(1,getd("Task" + .@i))) { if (getd("Task" + .@i + "_") < #Task_Count) { dispbottom "[Hunting Task] Killed " + (set(getd("Task" + .@i + "_"),getd("Task" + .@i + "_") + 1)) + " of " + #Task_Count + " " + strmobinfo(1,killedrid) + "."; end; } } } } else if (.Party) { .@mob = killedrid; getmapxy(.@map1$,.@x1,.@y1); getpartymember getcharid(1),1; getpartymember getcharid(1),2; for (.@i = 0; .@i < $@partymembercount; .@i++) { if (isloggedin($@partymemberaid[.@i], $@partymembercid[.@i])) { set .@Task_Count, getvar(#Task_Count, $@partymembercid[.@i]); set .@Task0, getvar(Task0, $@partymembercid[.@i]); set .@HP, readparam(HP, $@partymembercid[.@i]); if (.@Task_Count && .@Task0 && .@HP > 0) { getmapxy(.@map2$,.@x2,.@y2,BL_PC,rid2name($@partymemberaid[.@i])); if ((.@map1$ == .@map2$ || .Party == 1) && (distance(.@x1,.@y1,.@x2,.@y2) <= 30 || .Party < 3)) { for (.@j = 0; .@j < .Quests; .@j++) { .@my_mob_id = getvar( getd("Task"+.@j),$@partymembercid[.@i] ); .@my_count = getvar( getd("Task"+.@j+"_"), $@partymembercid[.@i] ); if (strmobinfo(1,.@mob) == strmobinfo(1,.@my_mob_id)) { if (.@my_count < .@Task_Count) { setd "Task"+.@j+"_", (.@my_count+1), $@partymembercid[.@i]; dispbottom "[Hunting Task] Killed " + (.@my_count+1) + " of " + .@Task_Count + " " + strmobinfo(1,.@mob) + ".", 0x777777, $@partymembercid[.@i]; break; } } } } } } } } end; OnInit: .Delay = 1; // Quest delay, in hours (0 to disable). .Quests = 3; // Number of subquests per task (increases rewards). .Party = 3; // Party options: 0 (exclude party kills), 1 (include party kills), 2 (same map only), 3 (screen area only) .Reset = 0; // Reset options: -1 (abandoning task sets delay time), 0 (no delay time), [Zeny] (cost to abandon task, no delay time) setarray .Count[0], // Min and max monsters per subquest (increases rewards). 20,50; setarray .Modifier[0], // Multipliers for Base Exp, Job Exp, and Zeny rewards. 0,0,0; .mob_db$ = // Table name of SQL mob database (checkre(0))?"mob_db_re":"mob_db"; setarray .Shop[0], // Reward items: <ID>,<point cost> (about 10~20 points per hunt). 512,1,513,1,514,1,538,5,539,5,558,10,561,10; .Blacklist$ = // Blacklisted mob IDs. "1062,1088,1183,1186,1200,1212,1220,1221,1234,1235,"+ "1244,1245,1250,1268,1290,1293,1294,1296,1298,1299,"+ "1300,1301,1303,1304,1305,1306,1308,1309,1311,1313,"+ "1515,1588,1618,1676,1677,1678,1679,1796,1797,1974,"+ "1975,1976,1977,1978,1979"; .no_sql = 1; // Ignore sql mob database npcshopdelitem "task_shop",512; for (.@i = 0; .@i < getarraysize(.Shop); .@i += 2) npcshopadditem "task_shop", .Shop[.@i], .Shop[.@i+1]; end; } - shop task_shop -1,no,512:-1
  7. Hi yuno,160,80,3 script 3D Printer 4_MACHINE_DEVICE,{ .@custom_coin_ID = 675451; .@custom_coin_qty = 3; if (countitem(.@custom_coin_ID) < .@custom_coin_qty) { npctalk "You need " + .@custom_coin_qty + " " + getitemname(.@custom_coin_ID) + " to generate a item.", strnpcinfo(0), bc_self; end; } npctalk "Type the ID of the item to generate.", strnpcinfo(0), bc_self; input .@item_id; if (getitemname(.@item_id) == "null") { npctalk "ID is invalid / item not found.", strnpcinfo(0), bc_self; end; } mes "[" + strnpcinfo(1) + "]"; mes "Confirm generation of"; mes "<ITEM>" + getitemname(.@item_id) + "<INFO>" + .@item_id + "</INFO></ITEM>?"; next; if (select("Cancel", "Confirm") == 1) close; mes "[" + strnpcinfo(1) + "]"; mes "Starting..."; close2; if (countitem(.@custom_coin_ID) < .@custom_coin_qty) { npctalk "You need " + .@custom_coin_qty + " " + getitemname(.@custom_coin_ID) + " to generate a item.", strnpcinfo(0), bc_self; end; } if (checkweight(.@item_id,1) == 0) { npctalk "Overweight detected. You cannot proceed.", strnpcinfo(0), bc_self; end; } delitem .@custom_coin_ID, .@custom_coin_qty; getitem .@item_id, 1; npctalk "Generated.", strnpcinfo(0), bc_self; specialeffect EF_OVERTHRUST; end; }
  8. yuno,165,80,3 script Entrance Guard#guild 4_M_UNCLEKNIGHT,{ if (getgroupid() >= 90) callsub S_Control; mes "[" + strnpcinfo(1) + "]"; mes "I can take you to the area if you're in a registered guild."; next; switch(select("Enter area", "Finish conversation")) { case 1: if (!getcharid(2)) { mes "[" + strnpcinfo(1) + "]"; mes "You are not in a guild."; close; } if (inarray($registered_guilds, getcharid(2)) < 0) { mes "[" + strnpcinfo(1) + "]"; mes "Your guild did not register."; close; } mes "[" + strnpcinfo(1) + "]"; mes "You're with the ^895818" + strcharinfo(2) + "^000000, correct?"; mes "I will send you there."; close2; warp "que_qsch05",346,32; end; case 2: mes "[" + strnpcinfo(1) + "]"; mes F_Bye; close; } S_Control: if(select("Default NPC", "^0000FFGM Control^000000") == 1) return; switch(select("Register guild", "Remove all guilds", "Cancel")) { case 1: switch(select("Enter guild member name", "Enter guild name")) { case 1: input .@playername$; query_sql "SELECT `name`,`guild_id` FROM `char` WHERE `name` like '%"+.@playername$+"%'",.@p_name$,.@GID; query_sql "SELECT `name`,`guild_lv` FROM `guild` WHERE `guild_id` = "+.@GID,.@NAME$,.@GLVL; if (getarraysize(.@p_name$) > 1) { mes "[" + strnpcinfo(1) + "]"; mes "More than one player with this name was found."; mes "Type again. Be more specific, please!"; close; } if (.@p_name$ == "") { mes "[" + strnpcinfo(1) + "]"; mes "I didn't find anything. Check for typos. You don't need to input the whole name."; close; } if (!.@GID) { mes "[" + strnpcinfo(1) + "]"; mes "" + .@p_name$ + " does not have a guild."; close; } break; case 2: input .@guildname$; query_sql "SELECT `guild_id`,`name`,`guild_lv` FROM `guild` WHERE `name` like '%"+.@guildname$+"%'",.@GID,.@NAME$,.@GLVL; if (getarraysize(.@GID) > 1) { mes "[" + strnpcinfo(1) + "]"; mes "More than one guild with this name was found."; mes "Type again. Be more specific, please!"; close; } if (!.@GID) { mes "[" + strnpcinfo(1) + "]"; mes "I didn't find anything. Check for typos. You don't need to input the whole name."; close; } break; } getguildmember .@GID, 1; getguildmember .@GID, 2; .@QTM = $@guildmembercount; for(.@i=0; .@i < $@guildmembercount; .@i++) if (isloggedin($@guildmemberaid[.@i],$@guildmembercid[.@i])) .@online++; mes "[" + strnpcinfo(1) + "]"; if (.@p_name$ != "" && .@p_name$ != getguildmaster(.@GID)) mes "" + .@p_name$ + "'s guild"; mes "Name: ^0000FF" + .@NAME$ + "^000000 (Lv " + .@GLVL + ")"; mes "Master: " + getguildmaster(.@GID); mes "Members: "+.@QTM+" / Online: "+.@online; mes " "; if (inarray($registered_guilds, .@GID) >= 0) { mes "Guild registered already."; close; } mes "Are you sure you want to register this guild?"; next; if(select("No", "Yes, register guild") == 1) close; .@i = getarraysize($registered_guilds); setarray $registered_guilds[.@i], .@GID; mes "[" + strnpcinfo(1) + "]"; mes "Guild ^895818" + getguildname(.@GID) + "^000000 registered!"; mes "Guild members can now enter."; close; case 2: mes "[" + strnpcinfo(1) + "]"; mes "Are you sure you want to remove all registered guilds?"; mes "^FF0000THIS CANNOT BE UNDONE.^000000"; next; if(select("On second thought, no.", "I'm aware, go on.") == 1) close; deletearray $registered_guilds, getarraysize($registered_guilds); mes "[" + strnpcinfo(1) + "]"; mes "Done."; close; case 3: end; } }
  9. Hello. There's a missing ; (semicolon) Find: .@reussite = 100; .@prix = 50000} Change to: .@reussite = 100; .@prix = 50000;}
  10. Hey new_1-3,114,64,6 script Stone Pile 1_JOURNEY_STONE_D,{ mes "I need to stay put for 60 seconds so that the stones can activate."; next; if (select("Start", "Cancel") == 2) { close; } mes "Let's start."; close2; progressbar "3131FF",60; getitem 720, 1; specialeffect EF_FLOWERCAST; end; }
  11. Hi yuno,165,80,3 script Entrance Guard#guild 4_M_UNCLEKNIGHT,{ mes "[" + strnpcinfo(1) + "]"; mes "What do you want?"; next; switch(select("Register guild", "Enter area", "Finish conversation")) { case 1: if (!getcharid(2)) { mes "[" + strnpcinfo(1) + "]"; mes "You are not in a guild."; close; } if (inarray($registered_guilds, getcharid(2)) >= 0) { mes "[" + strnpcinfo(1) + "]"; mes "Your guild registered already."; close; } .@i = getarraysize($registered_guilds); setarray $registered_guilds[.@i], getcharid(2); mes "[" + strnpcinfo(1) + "]"; mes "Guild " + strcharinfo(2) + " registered!"; mes "Guild members can now enter."; close; case 2: if (inarray($registered_guilds, getcharid(2)) < 0) { mes "[" + strnpcinfo(1) + "]"; mes "Your guild did not register."; close; } mes "[" + strnpcinfo(1) + "]"; mes "You're with the guild " + strcharinfo(2) + ", correct?"; mes "I will send you there."; close2; warp "que_qsch05",346,32; end; case 3: mes "[" + strnpcinfo(1) + "]"; mes F_Bye; close; } }
  12. Hello. Use getareaunits to get everyone who is in the "safe zone". Then use getmapunits to get everyone on the map. Compare the two lists and attach the players who aren't on both arrays since this means they are out the area. //REDUCE HP PLAYER OUT OF ZONE prontera,1,1,1 script AutoReduceHP HIDDEN_NPC,{ end; OnTimer2000: .@percent = -30; .@SafeArea = getareaunits(BL_PC,"prontera",145,83,164,69,.@safe_aid); .@size = getmapunits(BL_PC,"prontera",.@aid); if (.@size > 0) { for (.@i = 0; .@i < .@size; .@i++) { if (inarray(.@safe_aid, .@aid[.@i]) < 0) { if (attachrid(.@aid[.@i])) { if (Hp <= MaxHp) { specialeffect2 107; percentheal .@percent, .@percent; if (Hp < 5) { warp "SavePoint",0,0; } } detachrid; } } } } initnpctimer; end; OnInit: initnpctimer; end; }
  13. Hello. Your script is looking good, great start. You can test this one, maybe you learn something, I tried doing what you requested. //Converts ratio to return actual number with decimals. //10000=100% 1000=10% 100=1% 10=0,1% 1=0,01% function script F_ConvertRatio { .@n = getarg(0); if (.@n%100 && .@n > 100 && .@n < 1000 && atoi(charat(""+.@n, 1)) == 0 || .@n < 10) .@n2$ = .@n/100 + (.@n%100?",0"+.@n%100:""); else if (.@n%100 && .@n > 9 && .@n < 1000 && atoi(charat(""+.@n, getstrlen(""+.@n)-1)) == 0) .@n2$ = .@n/100 + "," + (.@n%100)/10; else .@n2$ = .@n/100 + (.@n%100?","+.@n%100:""); return .@n2$; } prontera,113,246,5 script Rafa da Rifa 1_F_PUBGIRL,{ cutin "job_dancer_eir01", 0; mes "[" + strnpcinfo(1) + "]"; mes "Você quer participar da minha rifa?"; mes "Ai, que pergunta, né? É claro que quer!"; mes "Pelo generosíssimo valor de ^0000FF" + F_InsertComma($@raffle_cost) + "z^000000, você concorre a"; mes "" + $@raffle_prize_qty + " [<ITEM>" + getitemname($@raffle_prize_id) + "<INFO>" + $@raffle_prize_id + "</INFO></ITEM>]."; next; if (isnpccloaked()) goto S_Restarting; .@i = rand(20,40); mes "[" + strnpcinfo(1) + "]"; mes "Você precisa tirar o número ^FF0000" + .@i + "^000000 pra ganhar ^00FF00" + getitemname($@raffle_prize_id) + "^000000."; mes "Mas primeiro, preciso dos ^0000FF" + F_InsertComma($@raffle_cost) + "z^000000."; mes "O que me diz?"; next; if(select("Tá OK! Lá vamos nós...", "Não, obrigad" + (Sex?"o":"a") + ".") == 2) { mes "[" + strnpcinfo(1) + "]"; mes "Não tá confiante?"; close3; } if (Zeny < $@raffle_cost) { mes "[" + strnpcinfo(1) + "]"; mes "Você não tem o zeny para participar?"; close3; } if (checkweight(1301,1) == 0) { mes "[" + strnpcinfo(1) + "]"; mes "Você tá com uma mochila bem pesada em..."; mes "Como você vai receber o prêmio desse jeito?"; close3; } if (isnpccloaked()) goto S_Restarting; Zeny -= $@raffle_cost; mes "[" + strnpcinfo(1) + "]"; mes "O número do prêmio é ^FF0000" + .@i + "^000000."; if (rand(10000) > $@raffle_chance) { .@l = rand(.@i-19,.@i+19); showdigit .@l; mes "Você tirou o número ^0000FF" + .@l + "^000000."; mes "Não foi dessa vez. Mas e se você tentar de novo?"; mes "Aliás, aqui está o seu prêmio de consolação!"; getitem $@raffle_consol_id, rand($@raffle_consol_min,$@raffle_consol_max); close3; } showdigit .@i; mes "Você tirou o número ^0000FF" + .@i + "^000000."; mes "... Peraí, você ganhou? É isso mesmo, produção?"; mes "Hoje é o seu dia!"; getitem $@raffle_prize_id, $@raffle_prize_qty; announce "" + strnpcinfo(1) + " : Parabéns! " + strcharinfo(0) + " recebeu " + $@raffle_prize_qty + " " + itemlink($@raffle_prize_id) + " na Rifa!", bc_all; specialeffect2 EF_PROVIDENCE; donpcevent strnpcinfo(3)+"::OnStart"; close3; S_Restarting: mes "[" + strnpcinfo(1) + "]"; mes "Nossa, essa rifa acabou bem quando estávamos conversando."; mes "Você vai ter que tentar a sorte na nova rifa."; close3; OnInit: bindatcmd "rifa",strnpcinfo(3)+"::OnGM", 99, 99; setarray .rifas, //Cada linha é uma rifa diferente //<grand prize>,<grand prize amount>,<consolation prize>,<consolation min amount>,<consolation max amount>,<cost>,<win chance 1~10000>, 970 , 30 , 7136 , 1, 20, 40000 , 100, 12264, 5 , 7135 , 1, 20, 100000, 100, 12928, 5 , 678 , 1, 10, 100000, 200, 7938 , 100, 7939 , 1, 50, 100000, 100, 6962 , 1 , 7139 , 1, 20, 150000, 125, 7620 , 10 , 984 , 1, 15, 150000, 125, 7619 , 10 , 985 , 1, 15, 200000, 200, 12412, 1 , 6259 , 1, 40, 300000, 40, 23546, 1 , 1061 , 1, 400, 500000, 200, 6635 , 1 , 23044, 1, 10, 600000, 50; // 1200000 = 20 minutos OnTimer1200000: OnStart: stopnpctimer; cloakonnpc strnpcinfo(0); sleep 10000; .@r = rand(getarraysize(.rifas)/7) *7; $@raffle_prize_id = .rifas[.@r]; $@raffle_prize_qty = .rifas[.@r+1]; $@raffle_consol_id = .rifas[.@r+2]; $@raffle_consol_min = .rifas[.@r+3]; $@raffle_consol_max = .rifas[.@r+4]; $@raffle_cost = .rifas[.@r+5]; $@raffle_chance = .rifas[.@r+6]; announce "A Rafa gostaria de convidar a todos a participarem de sua Rifa, na biblioteca ao oeste de Prontera!", bc_all; cloakoffnpc strnpcinfo(0); initnpctimer; sleep 5000; announce "" + strnpcinfo(1) + " : O grande prêmio é " + ($@raffle_prize_qty>1?$@raffle_prize_qty+"x ":"") + itemlink($@raffle_prize_id) + "! E o prêmio de consolação é " + itemlink($@raffle_consol_id) + " " + $@raffle_consol_min + "~" + $@raffle_consol_max + "x!", bc_all; npctalk "Este aqui é um prêmio especial que aparece só de vez em quando, então se eu fosse você, eu participaria!"; end; OnGM: message strcharinfo(0), "Esses são comandos especiais que apenas você ADMs e GMs podem usar."; switch(select("Cancelar", "^0000FFVer rifa atual^000000", "^0000FFVer rifas^000000", "^0000FFIniciar nova rifa^000000")) { case 1: end; case 2: if (isnpccloaked()) { message strcharinfo(0), "RIFA EM PROCESSO DE REINICIAR"; end; } mes "^0000FFPrêmio:^000000"; mes "^0000FF[<ITEM>" + getitemname($@raffle_prize_id) + "<INFO>" + $@raffle_prize_id + "</INFO></ITEM>] " + $@raffle_prize_qty + "x^000000"; mes "^FF0000Consolação:^000000"; mes "^FF0000[<ITEM>" + getitemname($@raffle_consol_id) + "<INFO>" + $@raffle_consol_id + "</INFO></ITEM>] " + $@raffle_consol_min + "~" + $@raffle_consol_max +"x^000000"; mes "Preço: " + F_InsertComma($@raffle_cost) + "z"; mes "Chance do prêmio: " + F_ConvertRatio($@raffle_chance) + "%"; mes "Iniciada faz " + (getnpctimer(0)/1000) + " segundos."; close; case 3: .@size = getarraysize(.rifas)/7; for( .@i = 0; .@i < .@size; .@i++ ) { .@r = .@i * 7; mes "^0000FFRifa " + (.@i+1) + " - Prêmio:^000000"; mes "^0000FF[<ITEM>" + getitemname(.rifas[.@r]) + "<INFO>" + .rifas[.@r] + "</INFO></ITEM>] " + .rifas[.@r+1] + "x^000000"; mes "^FF0000Consolação:^000000"; mes "^FF0000[<ITEM>" + getitemname(.rifas[.@r+2]) + "<INFO>" + .rifas[.@r+2] + "</INFO></ITEM>] " + .rifas[.@r+3] + "~" + .rifas[.@r+4] +"x^000000"; mes "Preço: " + F_InsertComma(.rifas[.@r+5]) + "z"; mes "Chance do prêmio: " + F_ConvertRatio(.rifas[.@r+6]) + "%"; if (.@i < .@size-1) { if(select("Ver outra rifa","Fechar") == 1) clear; else break; } } close; case 4: donpcevent strnpcinfo(3)+"::OnStart"; end; } } prontera,115,246,3 script Rifa#raffle_board 2_BULLETIN_BOARD,{ mes "^0000FFGrande prêmio da Rifa:^000000"; mes "^0000FF[<ITEM>" + getitemname($@raffle_prize_id) + "<INFO>" + $@raffle_prize_id + "</INFO></ITEM>] " + $@raffle_prize_qty + "x^000000"; mes " "; mes "^FF0000Prêmio de Consolação:^000000"; mes "^FF0000[<ITEM>" + getitemname($@raffle_consol_id) + "<INFO>" + $@raffle_consol_id + "</INFO></ITEM>] " + $@raffle_consol_min + "~" + $@raffle_consol_max +"x^000000"; mes " "; mes "Preço: " + F_InsertComma($@raffle_cost) + "z"; close; } Using initnpctimer and stopnpctimer you can automate the raffle change. Example: OnInit: // set the first raffle when the server starts. initnpctimer; //start the timer end; OnTimer60000: //after 60 seconds this part will trigger //change the raffle array to new values. stopnpctimer; //erase the old timer initnpctimer; //start the timer again from 0 end;
  14. Hi. Change 100 to 10000, and 0.01 to 1. You can't use decimal numbers in scripting. - script Poring_Coin -1,{ OnNPCKillEvent: if ( rand( 10000 ) <= 1 ) { .@item_id = F_Rand( 7539 ); getitem .@item_id,1; } end; } 10000 = 100 % 1000 = 10 % 100 = 1 % 10 = 0.1 % 1 = 0.01 %
  15. The player chooses one of the items? Or the NPC chooses one? The player receives multiple items? geffen,151,48,5 script First Person 1_M_LIBRARYMASTER,{ //Put the IDs of the item below. setarray .@items, 909, 910, 911, 912, 913, 914, 915; if (isnpccloaked("Second Person") == 0) { npctalk "You can talk to him.", strnpcinfo(0), bc_self; end; } mes "[First Person]"; mes "Hi, do you have all the items with you?"; next; for (.@i=0;.@i< getarraysize(.@items);.@i++) { if (countitem(.@items[.@i]) < 1) { mes "[First Person]"; mes "You don't have <ITEM>" + getitemname(.@items[.@i]) + "<INFO>" + .@items[.@i] + "</INFO></ITEM>."; close; } } mes "[First Person]"; mes "You have everything. I will call him."; close2; cutin "war_y1", 2; cloakoffnpcself( "Second Person" ); npctalk "Hello.", "Second Person", bc_self; end; } geffen,155,49,3 script Second Person 4_M_FAIRYKID5,{ //Put the IDs of the item below. setarray .@items, 909, 910, 911, 912, 913, 914, 915; //Put here the item IDs of the selection the player can choose from setarray .@reward, 714, 607, 12103; disable_items; mes "[Second Person]"; mes "Hi, the first person told me you have the items."; if (getarraysize(.@reward) > 1) { mes "You can exchange them for one of these:"; for (.@i=0;.@i< getarraysize(.@reward);.@i++) mes "- <ITEM>" + getitemname(.@reward[.@i]) + "<INFO>" + .@reward[.@i] + "</INFO></ITEM>"; next; .@menu$ = ""; for (.@i=0;.@i< getarraysize(.@reward);.@i++) .@menu$ += "- " + getitemname(.@reward[.@i]) + ":"; .@s = select(.@menu$) - 1; mes "[Second Person]"; } mes "Are you sure you want"; mes "<ITEM>" + getitemname(.@reward[.@s]) + "<INFO>" + .@reward[.@s] + "</INFO></ITEM>?"; next; if (select("No", "Yes, let's do this") == 1) { mes "[Second Person]"; mes "I see."; close2; cutin "", 255; cloakonnpcself; end; } for (.@i=0;.@i< getarraysize(.@items);.@i++) { if (countitem(.@items[.@i]) < 1) { mes "[Second Person]"; mes "You don't have <ITEM>" + getitemname(.@items[.@i]) + "<INFO>" + .@items[.@i] + "</INFO></ITEM>."; close2; cutin "", 255; cloakonnpcself; end; } } if ((MaxWeight - Weight) < 1000 || checkweight("Knife",1) == 0) { mes "^0000FF- You cannot continue due to your heavy weight. -^000000"; close2; cutin "", 255; cloakonnpcself; end; } for (.@i=0;.@i < getarraysize(.@items);.@i++) delitem .@items[.@i], 1; getitem .@reward[.@s], 1; mes "[Second Person]"; mes "Done."; close2; cutin "", 255; cloakonnpcself; end; OnInit: cloakonnpc; end; }
  16. Hi Find all lines with getmapxy in the botkiller files and replace the "0"s to BL_PC. Examples: getmapxy .@map$,.@x, .@y, 0; getmapxy .@BKMap$,.@BKX,.@BKY, 0; getmapxy .@map$,.@x,.@y, 0,@playername$; To: getmapxy .@map$,.@x, .@y, BL_PC; getmapxy .@BKMap$,.@BKX,.@BKY, BL_PC; getmapxy .@map$,.@x,.@y, BL_PC,@playername$;
  17. Hello \doc\script_commands.txt This document explain most commands used in scripting. It can be your best friend for learning. I tried adding some stuff in the script you started. The roulette is working The shop is working The entrance npc is working You will have to change the Item/Quest IDs and some other numbers to match you database since I don't know the ones you're using. Example, find and change those lines: .@ticket_id = 7350; //placeholder .@quest_id = 3040; //placeholder .map$ = "pay_fild04"; // Event Map .@token_id = 909; // placeholder .@max_bet = 20; // How many tokens can the player bet maximum In your server folder there's a file named \db\(pre-)re\mob_db.yml. It contains most data on monsters. Example: - Id: 1242 AegisName: MARIN Name: Marin Level: 37 Hp: 987 BaseExp: 279 JobExp: 230 Attack: 69 Attack2: 14 Defense: 32 MagicDefense: 8 Str: 24 Agi: 5 Vit: 10 Int: 5 Dex: 30 Luk: 15 AttackRange: 1 SkillRange: 10 ChaseRange: 12 Size: Medium Race: Plant Element: Water ElementLevel: 2 WalkSpeed: 400 AttackDelay: 1872 AttackMotion: 672 DamageMotion: 480 Ai: 01 Drops: - Item: Sticky_Mucus Rate: 750 - Item: Blue_Herb Rate: 38 - Item: Candy Rate: 175 Elemental resistance is defined by the Element Level of the monster. A Marin with Element Waler 3 has more resistance against fire than a Marin with Element Water 2. So find the line ElementLevel: 2 and increase the number (1~4) to increase the monster resistances.
  18. Hi. If you don't want to use the items, change the function to a regular NPC. Example: function script SL_Scroll { To: prontera,164,200,4 script Soul Scroll 112,{ For the zeny change: mes "[Soul Scroll]"; mes "You need 3.000z to continue."; next; if (Zeny < 3000) { mes "[Soul Scroll]"; mes "You don't have enough zeny."; close; } Zeny -= 3000;
  19. Hi, In the following line there's a missing .(dot) in the variable name: .@menulist[@j] = .@idd; To: .@menulist[.@j] = .@idd; In this part you wrote the same select command line twice: for (.@i = 0; .@i < getarraysize(.@menulist); ++.@i) { .@menu$ = .@menu$ + getitemname(.@menulist[.@i]); .@menu$ = .@menu$ + ":"; .@part = .@menulist[select(.@menu$)]; } .@part = .@menulist[select(.@menu$)]; Remove the first one, and add -1 in the second. Like this: for (.@i = 0; .@i < getarraysize(.@menulist); ++.@i) { .@menu$ = .@menu$ + getitemname(.@menulist[.@i]); .@menu$ = .@menu$ + ":"; } .@part = .@menulist[select(.@menu$) - 1];
  20. Hi. Find this: for(set .@i,0; .@i<getarraysize(.@Items); set .@i,.@i+1) set .@menu$, .@menu$+getitemname(.@Items[.@i])+((.@k)?" [1]":"")+":"; callsub S_EnchantArmor, .@Items[select(.@menu$)-1], .@j; Replace to: for (.@i = 0; .@i < getarraysize(.@Items); .@i++) { if (countitem(.@Items[.@i]) > 0) { .@menu$ += getitemname(.@Items[.@i]) + ":"; .@Indices[.@count++] = .@i; } } if (.@count == 0) { mes "[Apprentice Craftsman]"; mes "I only enchant these items:"; for ( .@i = 0; .@i < getarraysize(.@Items); ++.@i ) mes "<ITEM>"+getitemname(.@Items[.@i])+(getiteminfo(.@Items[.@i], 10)?" ["+getiteminfo(.@Items[.@i], 10)+"]":"")+"<INFO>"+.@Items[.@i]+"</INFO></ITEM>"; close; } .@index = .@Indices[select(.@menu$) - 1]; callsub S_EnchantArmor, .@Items[.@index], .@j;
  21. Hi. It's not working because the NPC doesn't know which map to use the @killmonster2. You can put the NPC inside the map: pay_dun04,0,0,0 script sum_mvp -1,{ or change the @killmonster2 line to: setmapflag "pay_dun04",mf_noloot; setmapflag "pay_dun04",mf_noexp; killmonsterall "pay_dun04"; removemapflag "pay_dun04",mf_noloot; removemapflag "pay_dun04",mf_noexp;
  22. Hi! CLEAR_NPC works, but it will put a "npc click bubble" inside the portal which can be annoying. I recommend using signboardlist:
  23. Hi, find this line: setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40036,1, 40011, 1); and replace to: if (countitem(40101) && rand(100) < 10) { // if have Butchering T2 has 10% chance to get the following items setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40036,1, 948,1, 929,1); } else { // Butchering 1 list / commom items setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40036,1, 40011, 1); }
  24. - script StatusMessage#command HIDDEN_WARP_NPC,{ OnMenu: mes "=== " + strcharinfo(0) + " status ==="; switch(select("- Weapon Skill", "- Bow Skill", "- Cancel")) { case 1: if (countitem(40040)) { mes "Your ^0000FFWeapon Skill^000000 is Lvl 1."; } else { mes "^FF0000You don't have this Skill.^000000"; } break; case 2: if (countitem(40041)) { mes "Your ^0000FFBow Skill^000000 is Lvl 1."; } else { mes "^FF0000You don't have this Skill.^000000"; } break; case 3: close; } switch(select("- Check other skill:- Cancel")) { case 1: clear; goto OnMenu; case 2: close; } OnInit: .@command$ = "status"; //CHANGE HERE @COMMAND TO SEE MESSAGE bindatcmd .@command$,strnpcinfo(3)+"::OnMenu"; end; }
×
×
  • Create New...