Jump to content

Ryokem

Members
  • Posts

    205
  • Joined

  • Last visited

Everything posted by Ryokem

  1. He wanted to make it dynamically, that's why if() statements wouldn't be enough I think.
  2. I think he want to jump in different labels depending on the input. Ex: you input "hello", and you jump to hello: label. There's a nice way to do this, just use functions instead of labels, getd() and callfunc to recall that particular label. Honestly, I did similar things long ago in eAthena and it worked fine, so I believe this can work on rAthena as well.
  3. Oh god, tons of useless if() and switch() statements that slow down everything The problem actually stands here: OnMinute00: set .KoE,0; StartLoop: if(gettime(4)==$KoEEndDay[.KoE]&&gettime(3)==$KoEEndTime[.KoE]) { goto KoEActualEnd; As you can see, he's calling the KoEActualEnd label from an OnMinute event label, so into a script that has NO rid attached. Checking that label... KoEActualEnd: disablenpc "Emperium Hill#1"; if($KoEStatus==0) { end; } set $KoEStatus,0; if($GvGPvP==0) { gvgoff "vmorocc"; } else { pvpoff "vmorocc"; } if(getmapusers("vmorocc")>0) { MapRespawnGuildID "vmorocc",$KOEGUILD,7; } killmonsterall "vmorocc",0; set .@name$,GetGuildMaster($KOEGUILD); if($KOEGUILD!=0) { Announce "The King of Emperium Hill has ended! The King Of Emperium Hill is the ["+GetGuildName($KOEGUILD)+"] guild.",bc_all|bc_WoE; } else { Announce "The King of Emperium Hill has ended! No guild has proven themselves King Of Emperium Hill!",bc_all|bc_WoE; } query_sql "UPDATE guild SET guild_points=guild_points +1 WHERE guild_id="+ getcharid(2); end; You can easily notice that there is no commands that attach a RID to the script, and a getcharid() is called, commands that NEEDS a RID attached to work. Key-kun's solution actually solve the problem, but I don't really know if it makes the script work as it should (didn't read all the other things, too lazy to read a script that would need 1/5 lines to work the same )
  4. Then you can't run any sql commands. lol.
  5. atoi is the worst command to be used unless it's really necessary. Your script is good, but just use gettime() or similar.
  6. @Annie: Try never to use continue; script function. It's odd and pretty bad. I believe it works exactly as in C or C++, and that command was used to refresh the heap scrolling it from start to end, just to say "let the script continue", and that is actually pretty useless, it just helps to slow down the compiler. @Key: Is really rA system so bad that never implemented an enumeration? ._. Well, I could expect it from something it doesn't even have floats xD
  7. This gives .item_amount of .item_id each new day they log in. If you want to manage offline players too, you need to use some sql queries, but I don't really like that way to get free items if not playing OnPCLoginEvent: if( (obbDay == gettime(5)) && (obbMonth == gettime(6)) ) end; set obbMonth, gettime(6); set obbDay, gettime(5); getitem .item_id, .item_amount; dispbottom "You have been rewarded with " + .item_amount + " " + getitemname(.item_id); end; OnInit: set .item_id, <obb id>; set .item_amount, <amount>; }
  8. Just add all possible bet-combinantion into different arrays, means the "red", "black", "close-to-0", "column 1-2-3", "even", "odd" and so on. Then, make an array that store every single bet of each player, and a parallel two other arrays which store the name of the player who did that bet and the bet amount. Then, for every bet, check if the corrispondent array contains the winning number, if so, reward the player. Delete all arrays in the end, and start back again.
  9. Try to avoid to use atcommand in scripts, unless you have to. You can easily replace this atcommand with some script commands. Try to check it on wiki: Announce
  10. Typo-e I believe (see red quote setarray .@Display$,"Room #1 ["+getmapusers("pvp_n_2-3")+"/100]","Room #2 ["+getmapusers("guild_vs2")+"/100]";
  11. Are you using an SQL emulator? xD
  12. Npc variables are not a waste of "server resources" at all. The while() loop is a waste when it does nothing, that's for sure, but i was just editing the script depending on what he needed trying to leave his script untouched if possible. I just gave a brief explanation on how to do it in a general case, not on how to optimize a full script.
  13. Of course it talks the random messages. Disable the npc means that players CANNOT interact with it in any way, but all the other script triggers (event labels) still works. As the npctalk and the npcwalkto are called through the event label OnInit, it will keep doing it. You will have to set a variable to record if the npc is disabled or not. OnSun0000: OnTue0000: enablenpc strnpcinfo(0); .is_enable = 1; end; OnMon0000: OnWed0000: disblenpc strnpcinfo(0); .is_enable = 0; end; while (1) { sleep .@interval * 1000; if( .is_enable ) { getmapxy .@map$, .@x, .@y, 1; while ( checkcell( .@map$, .@npc_x = .@x + rand( -.@step, .@step ), .@npc_y = .@y + rand( -.@step, .@step ), cell_chknopass ) ); npcwalkto .@npc_x, .@npc_y; npctalk callfunc( "F_RandMes", 2, "Heloo!!!", // 1 "Goodbye~!" // 2 ); } }
  14. prontera,97,153,5 script Clemy 703,{ mes "If you can speak with me, I'm enabled!!!"; close; //I've used On<weekdays><hour><minute>: event label. //Weekdays are Sun,Mon,Tue,Wed,Thu,Fri,Sat. //Days you want to ENABLE the NPC (NPC will last enabled until next disable) OnSun0000: OnTue0000: enablenpc strnpcinfo(0); end; //Days you want to DISABLE the NPC (NPC will last disabled until next enable) OnMon0000: OnWed0000: disblenpc strnpcinfo(0); end; OnInit: .@interval = 5; .@step = 5; while (1) { sleep .@interval * 1000; getmapxy .@map$, .@x, .@y, 1; while ( checkcell( .@map$, .@npc_x = .@x + rand( -.@step, .@step ), .@npc_y = .@y + rand( -.@step, .@step ), cell_chknopass ) ); npcwalkto .@npc_x, .@npc_y; npctalk callfunc( "F_RandMes", 2, "Heloo!!!", // 1 "Goodbye~!" // 2 ); } }
  15. Copy-Paste back GM Ocean's fixed script or put a comma on there if( select("-Yes, do it!","-I'll need to think about it.." ) == 2 )
  16. have parse line problem in line 29..... There's not even Line 29 O.o Tell me what line and which error.
  17. Those are multiple values settings, so you must use Setarray
  18. OnMinute00: OnMinute30: if( .rand ) .index = rand(getarraysize(.announce$)); else .index = (.index+1) % getarraysize(.announce$); announce .announce$[.index], 0; end; OnInit: setarray .announce$, "Sentence 1", "Sentence 2", "Sentence 3", // Add as many as you wish "Sentence N"; .rand = 1; //Set 1 if you want random sentence each time, 0 if you want to announce it consecutively. end;
  19. Disablenpc just let users not to be able to run it, but you can still call his script with Event Labels or other NPC functions. So of course you can enable itself if he's disabled
  20. Try to check the wiki page about the Guildchangegm command, there's a fully example about how to do it: Guildchangegm About he 2 conditions, just add an if statement for every of them: • 1m per Change Guild Leader if( Zeny < 1000000 ) { mes "not Enough Zeny"; close; } //Paying... set Zeny, Zeny - 1000000; • Cannot change Guild Leader during WOE if( agitcheck() ) { mes "You can't change the GM while WoE is active! Come back later."; close; }
  21. I'm up for this section as well, if necessary.
  22. 6 thousand lines I wish I can have so much time to spare to read up the script lol.
  23. Yeah, you have to put some brackets. dispbottom "Please wait for "+ .@m +" min(s) "+ ( (.@s) ? .@s +" seconds" : ""); Do not forget that all commands are monitored by a source function, and regardless from what they do, they always have some values as return, most of them are booleans (true, false), another good part is integers or float/double (not in e/rAthena case as those kind of variables are not really implemented).
  24. maybe (saying maybe cause I really don't know about that) when you invoke the getexp command, it just takes the already multiplied exp from the monsterinfo, and then multiply back again due to the quest_exp_rate, that's why it increases this much. You can try to do some tests setting (for example) 1 as poring's base exp, and checking what kind of moltiplications the server compute. EDIT: hahaha!
×
×
  • Create New...