mybitch 9 Posted May 15, 2013 Mmm, can I request a script that will choose every weekend map of the week or mob of the week? wherein the map/mob that will be chosen will give double exp from friday evening till sunday.. Ty! Quote Share this post Link to post Share on other sites
0 mybitch 9 Posted May 17, 2013 (edited) Bump. Thanks! Edited May 17, 2013 by mybitch Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted May 17, 2013 Could you give us a bit of more information? Like if you want a random monster or map among all the entire database, or some special mobs or maps you want to use? I'd suggest a whitelist of selected mobs or maps because the random map/monster picking may be impossible to use that week. Quote Share this post Link to post Share on other sites
0 mybitch 9 Posted May 18, 2013 Could you give us a bit of more information? Like if you want a random monster or map among all the entire database, or some special mobs or maps you want to use? I'd suggest a whitelist of selected mobs or maps because the random map/monster picking may be impossible to use that week. Sorry if the information was incomplete. So the Map|Mob of the week goes like this.. Choose any field/dungeon maps every weekend or weekdays or any day. If it has already chosen a map, the exp gain for that map will be doubled. And for the Mob: Same as the map. By chance a random one. Hehehe! Except for the maps|mobs having boss or mini boss. Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted May 19, 2013 (edited) After some hours of work I finally have it, but it's still untested. This should work provided you correctly set the maps and mobs on it. Since the concept of evening is relar¡tive to the country you're in, I've made this to work from Friday at 00:00 to Monday at 00:00. Here's the script:Code removed. See edit reasons for explanations. I'd be glad if you made the list of suitable maps and mobs: I didn't do it because it was too much work after making the script. If it doesn't work please tell me!Edit: This code had a serious issue. I've posted a revised script later on this topic. Edited May 24, 2013 by jaBote Quote Share this post Link to post Share on other sites
0 mybitch 9 Posted May 19, 2013 @jabote: How about if the script will automatically choose the maps set on maps_athena.conf so that there will be no array thing? Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted May 20, 2013 It's not possible as far as I know. And if it was possible it wouldn't tell apart the interesting maps to the ones that don't have absolutely nothing. Quote Share this post Link to post Share on other sites
0 mybitch 9 Posted May 20, 2013 It's not possible as far as I know. And if it was possible it wouldn't tell apart the interesting maps to the ones that don't have absolutely nothing. Thanks for this I'll try this on my machine. Currently using a laptop. Quote Share this post Link to post Share on other sites
0 Capuche 9 Posted May 23, 2013 setarray .maps_1$[0],"mymap1","mymap2","mymap3";setarray .maps_2$[0],"mymap129","mymap130";// Other settings for mapsset .num_map_arrays, 2; // Set this to the number of arrays you have for maps. set .@randarray, rand(1, .num_map_arrays); this method break the equiprobability i.e. user put 100 maps in array 1 and only 1 in array 2 but 50% to select map on array 2 // Maths for avoiding using quest_exp_rate but base_exp_rate. We substract 100 because the first 100% is given by the mob. set .@bonusbexprate, (.mob_base_exp_multiplier - 100) * getbattleflag("base_exp_rate") / getbattleflag("quest_exp_rate"); set .@bonusjexprate, (.mob_job_exp_multiplier - 100) * getbattleflag("base_exp_rate") / getbattleflag("quest_exp_rate"); I don't get why you use quest_exp_rate, do you mind to explain me ? 2 jaBote and REKT reacted to this Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted May 24, 2013 Tried to quite you Capuche, but quitted because IP.Board doesn't want to quote you today. Sorry. Didn't think about that equiprobability issue (thanks!), but that part OK as it's now because you can give the maps a some preference among others. Equiprobability will be assured as long as the arrays are evenly filled, and when you have an amount of maps the change of probability from one array to another is almost negligible. The reason I use base_exp_rate and quest_exp_rate (and should have used job_exp_rate for job exp calculation, I forgot to do that, sorry) is simple: Whenever you get exp from an NPC via getexp it'll get multiplied by quest_exp_rate and the result of that operation will be the exp the client will get. Since this behavior isn't desirable in this case (we want to give the user the exp of the mob multiplied by a factor, without quest_exp_rate messing around there) that's why I divide by it. This way, at getexp, user would get: exp*quest_exp_rate*base_exp_rate/quest_exp_rate Which cancels quest_exp_rates and so it leaves the exp*base_exp_rate. What I don't know is if getmonsterinfo($@specialmob,3) returns an exp value already modified by the rates of server. In that case my exp calculation is wrong as it'd be multiplied twice by base_exp_rate. Right now it's seeming wrong for me, even though I considered it right, before posting the script. I'll just have to test this calculation whenever I have time (or would be very grateful if someone checks this for me). Quote Share this post Link to post Share on other sites
0 mybitch 9 Posted May 24, 2013 OMG. Capuche is here. Hi.Just a question... Will this make the rates twice or not? Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted May 24, 2013 (edited) Yeah, the rates were multiplied: if you were in a 10x server the extra exp would be as in a 100x server. This is why I always ask you to test in your side. I've already fixed this: you get your bonus exp with a 1% relative error at most now, given by not having more than two decimals provided by the server.More info: [*]This script will NOT work properly in Renewal. It works indeed, but extra exp will be calculated on the 100% exp given by the mob. [*]I'll re-release this when I fix the equiprobability issue. [*]What I've tested is only the extra experience given by a mob, not anything else. So testing on your home server is still a must do on your behalf. ___________________________________________________ I've finished my script again. As always this hasn't been tested but I've fully reviewed the code and don't find any flaws on it, so I highly reccomend to test it before using in production server.This time I won't provide the source in a code box since it destroys my indentation and that makes me angry, so here you go: Sadly, it has some mistakes, download next version in my next post please.mapmobtest.txtAnd please, share it back when you're done if you plan to add mobs and maps. This way I can release it.Thanks! Edited May 24, 2013 by jaBote Quote Share this post Link to post Share on other sites
0 Capuche 9 Posted May 24, 2013 Whenever you get exp from an NPC via getexp it'll get multiplied by quest_exp_rate Yeah it makes sense, feel so noob now xD set .@draw, .@draw - .@size; // This way we approach our goal I believe it should be .@size[.@i] Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted May 24, 2013 Dammit! I had to make a mistake in some place Re-corrected version /sob: mapmobtest.txt Hope I'm not mistaken again or I'll cry TT_TT . Quote Share this post Link to post Share on other sites
0 mybitch 9 Posted May 25, 2013 Dammit! I had to make a mistake in some place Re-corrected version /sob: mapmobtest.txt Hope I'm not mistaken again or I'll cry TT_TT . How to remove the dispbottom? Cause it'll be spamming everything it kill isn't it? Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted May 25, 2013 Just comment them (place a // before them) so they won't have any effect. Sent from smartphone. Quote Share this post Link to post Share on other sites
0 mybitch 9 Posted May 25, 2013 Just comment them (place a // before them) so they won't have any effect. Sent from smartphone. I'll be testing this yet.. I'll wait next friday hehehe! Quote Share this post Link to post Share on other sites
0 Capuche 9 Posted May 26, 2013 (edited) Just a fast test and : // forgot ;set .equiprobability, 1set .map_job_exp_multiplier, 200 // forgot bracketset $@specialmap$, getd(".maps_" + .@randarray + "$["+ .@randpos +"]"; // .mobs_X type integer not stringset .@randpos, rand(0, getarraysize(getd(".mobs_" + .@randarray + "$")) - 1);set $@specialmob, getd(".mobs_" + .@randarray + "$["+ .@randpos +"]"); // This black magic is supposed to draw a random mob from the poolset $@specialmob, getd(".mobs_" + .@i + "$["+ .@draw +"]"); // display the mob IDif ($@specialmob) announce $@specialmob + " has a x" + .mob_base_exp_multiplier/100 + "." + .mob_base_exp_multiplier0 + " base exp and a x" + .mob_job_exp_multiplier/100 + "." + .mob_job_exp_multiplier0 + " job exp multiplier for the weekend!",bc_self; // must be under OnMon0000: or the config is deleted right after be loaddonpcevent strnpcinfo(3)+"::OnDelConfig"; //This way we save memory for the week at the cost of a bit of process // @set .@jobexp, getmonsterinfo($@specialmob,4)*(.@mob_job_exp_multiplier - 100)/getbattleflag("quest_exp_rate"); Also when both map + mob of the week enabled that give a strange multiplicator... dunno why Edited May 26, 2013 by Capuche 3 jaBote, mybitch and REKT reacted to this Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted May 26, 2013 And this, ladies and gentlemen, is what happens when I haven't a console near me for testing or detecting basic errors in npcs. This also justifies what I say about testing them before using and feeding me back with errors. Sorry for these errors, I'll try to fix them as soon as I get back to my pc (I'm on my smartphone right now). 1 mybitch reacted to this Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted May 26, 2013 I'm a bit rusty on scripting as you can see. This script has passed in Hercules Console checking of errors. Try this one: http://upaste.me/9fca5983bac12e78 @Capuche: loading config OnMon0000, using it and then unloading that from memory is intentional and works; also strange rate from mobs and map at once is intended: if a mob of the week is in a map of the week, you get a total base_mobexp * server_rate * (map_bonus + mob_bonus). @general public: Still not thoroughly tested so errors/bugs may still be there, it just passed console parsing. 1 mybitch reacted to this Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted May 27, 2013 SQL Based: WeeklyEvent.txt (Haven't tested but hope to work) To Add a Map: PM "NPC:mobmapoftheweek" with "ADDMAP#mapname" To Add a Mob: PM "NPC:mobmapoftheweek" with "ADDMOB#mobid" To remove a Map: PM "NPC:mobmapoftheweek" with "DELMAP#mapname" To remove a Mob: PM "NPC:mobmapoftheweek" with "DELMOB#mobid" Or use directly sql. 1 jaBote reacted to this Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted May 27, 2013 Also don't know if it works, but I'll suggest small improvements for your script here and there: Line 25: add a map check before: if (@whispervar0$ == "ADDMAP") { if (getmapusers(@whispervar2$) < 0) dispbottom "Not adding. Invalid map."; else query_sql "INSERT INTO `map_mob_week` (`mapname`) VALUES ('"+@whispervar1$+"')"; // If map proven to exist no need to escape} Line 28: better check if monster exists with getmonsterinfo() or strmobinfo(). I'll use getmonsterinfo since it returns -1 on invalid mob_id: else if (@whispervar0$ == "ADDMOB") { if (getmonsterinfo(atoi(@whispervar1$),1) != -1){query_sql "INSERT INTO `map_mob_week` (`mobid`) VALUES ("+atoi(@whispervar1$)+")";} else{dispbottom "Cannot Add, Invalid ID";}} Same checks for deleting mob and/or maps. In line 85 there's a debug line I forgot to remove and not much more. And thanks for the idea of ordering query results by rand(), didn't think about it! Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted May 28, 2013 @jaBote I was little sleepy and forgot to put checks Here's the Fixed version: WeeklyEvent.txt To Add a Map: PM "NPC:mobmapoftheweek" with "ADDMAP#mapname" To Add a Mob: PM "NPC:mobmapoftheweek" with "ADDMOB#mobid" To remove a Map: PM "NPC:mobmapoftheweek" with "DELMAP#mapname" To remove a Mob: PM "NPC:mobmapoftheweek" with "DELMOB#mobid" 1 mybitch reacted to this Quote Share this post Link to post Share on other sites
Mmm, can I request a script that will choose every weekend map of the week or mob of the week? wherein the map/mob that will be chosen will give double exp from friday evening till sunday..
Ty!
Share this post
Link to post
Share on other sites