-
Posts
667 -
Joined
-
Last visited
-
Days Won
91
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Crowdfunding
Posts posted by Tokei
-
-
You can check roBrowser's sprite loading; it's very clear and on point: https://github.com/vthibault/roBrowser/blob/master/src/Loaders/Sprite.js
-
1
-
-
Did you update your sources to the latest revision? This commit should have fixed your issue : https://github.com/rathena/rathena/commit/afa880ebd6bd55c2ecaa479cf00697db568ab353
(I'm unable to reproduce your problem.)
If that didn't work or if you're already fully up to date, could you provide a bigger script sample?
-
1
-
-
Heya,
I would like to suggest adding @reloadnpc as an official atcommand to reload scripts. Currently we have to use @unloadnpcfile followed by @loadnpc which is a bit awkward when you want to create a new script. With @reloadnpc, you'd be able to load and reload NPCs with the same command.
ACMD_FUNC(reloadnpc) { if (!message || !*message) { clif_displaymessage(fd, "Usage: @reloadnpc <file name>"); return -1; } if (npc_unloadfile(message)) clif_displaymessage(fd, msg_txt(sd,1386)); // File unloaded. Be aware that mapflags and monsters spawned directly are not removed. if (!npc_addsrcfile(message) || !npc_parsesrcfile(message,true)) { clif_displaymessage(fd, msg_txt(sd,261)); return -1; } npc_read_event_script(); clif_displaymessage(fd, msg_txt(sd,262)); return 0; }
-
6
-
-
'party_id = getcharid(1); 'ins_rid = getattachedrid(); donpcevent instance_npcname("#ins_die_event_sub") + "::OnPartyCheck";
This works because the player is being attached to the script (it stops working if you detach the player, though). I really like your alternative solution actually! You wouldn't have to deal with the attach/detachrid uglyness. But how would you identify players leaving the party or being added to the party? (I don't think you can prevent a player from leaving a party.)
-
There are no easy ways of doing this, OnPCDieEvent is annoying to use. I would try the following instead:
1@tower,0,0,0 script #ins_die_event_sub -1,{ end; OnPartyCheck: 'player_alive = 0; getpartymember 'party_id, 2; for (.@i = 0; .@i < $@partymembercount && !'player_alive; .@i++) { if (isloggedin($@partymemberaid[.@i]) && $@partymemberaid[.@i] != 'ins_rid) { // Logged out players are still active if (attachrid($@partymemberaid[.@i])) { if (HP > 0 && strcharinfo(3) == instance_mapname("1@tower")) { 'player_alive++; } detachrid(); } } } // Run code back on the instance if ('player_alive == 0) { announce "All players have died.", 0; } end; } - script #ins_die_event -1,{ end; OnPCDieEvent: OnPCLogoutEvent: if (strcharinfo(3) == instance_mapname("1@tower")) { // Do not perform the party checks here directly, this script // is never attached to the instance. 'party_id = getcharid(1); 'ins_rid = getattachedrid(); donpcevent instance_npcname("#ins_die_event_sub") + "::OnPartyCheck"; } end; }
There are few things you have to be very careful with such scripts. OnPCDieEvent is a global event label which is not attached to your instance nor is it duplicated. All players who die on your server will trigger this event label, hence why you have to check if the player has the instance (and why you should not put the NPC in the instance map). The usage of a donpcevent is to force the script to run back on the instance after it's detached from the players' checks. You also cannot rely on $@partymembercount alone since some members could be offline in the party. Players can also leave the party or logout, which you have to take into account.
-
Heya, you have to set the properties for each mob:
deletearray $@mobid[0],getarraysize($@mobid); monster "prontera",156,176,"Omega poring",1002,2; for (.@i = 0; .@i < getarraysize($@mobid); .@i++) { setunitdata $@mobid[.@i],UMOB_MAXHP,(50*.@mp); setunitdata $@mobid[.@i],UMOB_HP,(50*.@mp); setunitdata $@mobid[.@i],UMOB_ATKMIN,300; setunitdata $@mobid[.@i],UMOB_ATKMAX,300; } deletearray $@mobid[0],getarraysize($@mobid); monster "prontera",156,176,"Fracus",1758,3; for (.@i = 0; .@i < getarraysize($@mobid); .@i++) { setunitdata $@mobid[.@i],UMOB_MAXHP,(100*.@mp); setunitdata $@mobid[.@i],UMOB_HP,(100*.@mp); setunitdata $@mobid[.@i],UMOB_MODE,12433; }
-
2
-
-
You can try the following:
- script fishvendor -1,{ .@n$ = "[Fish Vendor]"; if (checkweight(1201, 1) == 0) { mes .@n$, "You have too many items in your inventory!"; close; } mes .@n$, "Hi there, if you went fishing, I can buy your rare catch!"; next; mes .@n$, "If you caught a Shark, Whale, or Octopus, I can give you 10 Fish Market Receipt for each of them"; next; mes .@n$, "Here's the list of the fishes I want to buy"; next; setarray .@items, 32189, 32195, 32191, 32190, 32180, 32181, 32182, 32183, 32186, 32187, 32188, 32192, 32193, 32184, 32185, 32194; setarray .@amounts, 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1; setarray .@rewards, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 10; for (.@i = 0; .@i < getarraysize(.@items); .@i++) { // Optional, but I usually make such items with blue links so that players click the right ones more easily if (countitem(.@items[.@i]) >= .@amounts[.@i]) .@menu$ = .@menu$ + "^0000ff" + .@amounts[.@i] + "x " + getitemname(.@items[.@i]) + "^000000:"; else .@menu$ = .@menu$ + .@amounts[.@i] + "x " + getitemname(.@items[.@i]) + ":"; } .@opt = select(.@menu$) - 1; if (.@opt < 0 || .@opt >= getarraysize(.@items)) end; .@item = .@items[.@opt]; .@amount = .@amounts[.@opt]; if (countitem(.@item) < .@amount) { mes .@n$, "Sorry but you don't have enough " + getitemname(.@item) + " with you"; close; } delitem .@item, .@amount; getitem 32196, .@rewards[.@opt]; mes .@n$, "Thanks! Here's your Fish Market Receipt!"; close; }
You may want to double check the receipts to make sure all the values are right.
-
1
-
-
You're attaching a timer to a player, that's where the issue is. A player cannot run two scripts at the same time, so it stops the first script (the one where the player talks to an NPC with a dialogue, for instance) by adding a close button. Then it attaches the player on your OnTimer60000 script event. You'll have to change your approach.
-
1
-
-
@xtian711 The link you're looking for is http://www.mediafire.com/?aflylbhblrzpz0h , it is public.
-
This is usually because you're using outdated lua files. The files you want to update are:
data\luafiles514\lua files\datainfo\shadowtable.lub
data\luafiles514\lua files\datainfo\shadowtable_f.lub -
You can use the mediafire link :
-
1
-
-
There's a changelog in the page:
Quote- [Added] GrfEditor : Added more default Thor paths when you create a patch file.
- [Fixed] GrfEditor : Fixed a bunch of annoying UI issues from WPF.
- [Fixed] GRF : Windows 10 no longer comes with the required VC++ redistributables, so they're now going to be extracted on startup. This should fix the "Failed to load library" errors.
- Fixed a... file not found issue o.o.
- Changed logo!
Then again, there are way more changes than that, 1.7.5 was quite a while ago. I only put those I remembered and uploaded it to fix the broken link. Nothing major was changed though.
-
Hmmm weird! Reuploaded.
-
1
-
-
@Emistry I wrote this script as a generic example. When you convert the NPCs to instance NPCs, you just change the global variables to instance variables. I usually put mine as "$et_<name_here>" for endless tower, then replace all to " 'et_". It's faster for me when I want to test a specific part of an instance @@. But... we don't know what Hijirikawa is going to use that for.
I do want the variable to be accessible from all the NPCs though; if you aren't using duplicates (the OP could be using 4 completely different NPCs with no code being shared at all), then NPC variables won't do. Well, I made a "setvariableofnpc" command which would solve that particular issue. With that said though, my solution works in all scenarios, even if you change your code midway for another approach.
Skrom's algorithm is also in n²; it works fine with 4 NPCs, but it can get very slow if you plan on duplicating more of them. There's a lot of repeated code being ran here too (sorry >.<'). Though, if you really want to use NPC variables, I don't think you can do it another way (so I still wouldn't go for it on my end xD).
-
1
-
-
@Skorm It really depends on what your goal is; I stay away from npc variables as much as possible for a few reasons. I'm usually scripting for instances and NPC variables won't work as expected in such a case (the variables will be shared across instances if you use duplicates). I personally don't like having the OnInit label on duplicate NPCs either since the event gets called multiple times; that's what you're relying on here though xD. I usually end up adding code in the init part and I don't want it to be repeated everytime a duplicate NPC gets loaded.
And... you have to be careful while using strnpcinfo if you're having a floating base NPC, such as:
- script NPC_base -1,{ .@id = atoi(strnpcinfo(2)); dispbottom "Variable " + (.@id + 1) + ": " + .npc_variables[.@id]; end; OnInit: .@len = getarraysize(.npc_variables); .npc_variables[.@len] = atoi(strnpcinfo(2)) + 1; //... } prontera,151,183,0 duplicate(NPC_base) NPC#0 77 prontera,153,183,0 duplicate(NPC_base) NPC#1 77 prontera,155,183,0 duplicate(NPC_base) NPC#2 77 prontera,157,183,0 duplicate(NPC_base) NPC#3 77
Also, in that script, you'll end up with OnInit being called 5 times (that's not the case in your sample, but that's just a mistake I don't want to have to deal with if I use floating NPCs). Anyway! It's just a preference for me. I make less mistakes that way and it's pretty much an habit now ;P.
-
There are multiple ways to approach this. I personally find it easier to make a global variable containing all your values, and then having the NPCs access the array. For example:
prontera,151,183,0 script NPC1 77,{ dispbottom "Variable 1: " + $npc_values[0]; end; } prontera,153,183,0 script NPC2 77,{ dispbottom "Variable 2: " + $npc_values[1]; end; } prontera,155,183,0 script NPC3 77,{ dispbottom "Variable 3: " + $npc_values[2]; end; } prontera,157,183,0 script NPC4 77,{ dispbottom "Variable 4: " + $npc_values[3]; end; } - script yourscript_main -1,{ end; OnInit: cleararray $npc_values, 0, 50; setarray $npc_values, 1, 2, 3, 4; // Shuffle the array for (.@i = getarraysize($npc_values) - 1; .@i > 0; .@i--) { .@j = rand(.@i + 1); .@temp = $npc_values[.@i]; $npc_values[.@i] = $npc_values[.@j]; $npc_values[.@j] = .@temp; } end; }
This is handy if you plan on duplicating your NPCs, such as:
prontera,151,183,0 script NPC#0 77,{ .@id = atoi(strnpcinfo(2)); dispbottom "Variable " + (.@id + 1) + ": " + $npc_values[.@id]; end; } prontera,153,183,0 duplicate(NPC#0) NPC#1 77 prontera,155,183,0 duplicate(NPC#0) NPC#2 77 prontera,157,183,0 duplicate(NPC#0) NPC#3 77 - script yourscript_main -1,{ end; OnInit: cleararray $npc_values, 0, 50; setarray $npc_values, 1, 2, 3, 4; // Shuffle the array for (.@i = getarraysize($npc_values) - 1; .@i > 0; .@i--) { .@j = rand(.@i + 1); .@temp = $npc_values[.@i]; $npc_values[.@i] = $npc_values[.@j]; $npc_values[.@j] = .@temp; } end; }
If you plan on shuffling the arrays often, you can use the following custom script command:
// script.c BUILDIN_FUNC(shufflearray) { struct script_data* data; const char* name; struct map_session_data* sd = NULL; int array_size, i, j; int32 id; void * temp_val; // Copy-paste from getarraysize data = script_getdata(st, 2); if (!data_isreference(data)) { ShowError("buildin_shufflearray: not a variable\n"); script_reportdata(data); script_pushnil(st); st->state = END; return SCRIPT_CMD_FAILURE;// not a variable } name = reference_getname(data); id = reference_getid(data); if (not_server_variable(*name)) { sd = script_rid2sd(st); if (sd == NULL) return SCRIPT_CMD_SUCCESS;// no player attached } array_size = script_array_highest_key(st, sd, reference_getname(data), reference_getref(data)); // Start shuffling the array for (i = array_size - 1; i > 0; i--) { j = rand() % (i + 1); temp_val = get_val2(st, reference_uid(id, i), reference_getref(data)); script_removetop(st, -1, 0); set_reg(st, sd, reference_uid(id, i), name, get_val2(st, reference_uid(id, j), reference_getref(data)), reference_getref(data)); script_removetop(st, -1, 0); set_reg(st, sd, reference_uid(id, j), name, temp_val, reference_getref(data)); } return SCRIPT_CMD_SUCCESS; } // def BUILDIN_DEF(shufflearray,"r"),
and use it as follow:
- script yourscript_main -1,{ end; OnInit: cleararray $npc_values, 0, 50; setarray $npc_values, 1, 2, 3, 4; shufflearray $npc_values; end; }
If you need something more specific, you'll have to give us more details xD
-
2
-
-
Welp, the issue is somewhere else then. Check the level requirement, the upper field, the item type or the location.
-
And what does not work exactly?
-
Use
setarray .@maps$, "prontera", "geffen", "izlude"; // An array of maps. .@map$ = .@maps$[rand(getarraysize(.@maps$))]; monster .@map$,0,0,"--ja--",1115,1,"Event_Spawn::OnEvent"; // The monster.
for a random map.
-
1
-
-
Packet length 19 is the wanttoconnection packet. The issue is (almost always) caused by issues with packet obfuscation. Make sure you've recompiled your server and that you've disabled the feature on your client when you diffed it.
Edit: That's the easy solution, the ideal one would be to turn on the packet obfuscation, set custom keys and change them in your executable.
-
Those are in hexadecimal numbers, you can't just add them together like that. Open your windows calculator and use view > programmer. Select hex and then add those values together. You'll end up with 0x03A00000.
-
Well it's pretty straightforward:
//script.c static int buildin_areakill_sub(struct block_list *bl,va_list ap) { status_kill(bl); return 0; } BUILDIN_FUNC(areakill) { const char *mapname; int16 m; int x0, y0, x1, y1; mapname = script_getstr(st,2); if ((m = map_mapname2mapid(mapname)) < 0) return SCRIPT_CMD_FAILURE; x0 = script_getnum(st,3); y0 = script_getnum(st,4); x1 = script_getnum(st,5); y1 = script_getnum(st,6); map_foreachinarea(buildin_areakill_sub,m,x0,y0,x1,y1,BL_MOB); // If you want to kill players as well, add BL_PC: //map_foreachinarea(buildin_areakill_sub,m,x0,y0,x1,y1,BL_MOB|BL_PC); return SCRIPT_CMD_SUCCESS; } // def BUILDIN_DEF(areakill,"siiii"),
I'm not sure if you wanted to kill mobs or players, or both.
-
1
-
-
It's easier to create custom script commands (it is more reliable than using SQL and it is faster). Plus, you'll be able to have more freedom if you want to add more guild options:
script.c /*========================================== *------------------------------------------*/ BUILDIN_FUNC(getguildinfo) { struct guild *g = NULL; int result = 0; if ((g = guild_search(script_getnum(st,2))) != NULL) { int type = script_getnum(st,3); switch(type) { case 0: result = g->guild_lv; break; case 1: result = g->connect_member; break; case 2: script_pushstrcopy(st, g->name); return SCRIPT_CMD_SUCCESS; //case 3: // etc... // break; default: ShowError("buildin_getguildinfo: unknown type '%d'.\n", type); script_pushint(st, 0); return SCRIPT_CMD_FAILURE; } } script_pushint(st, result); return SCRIPT_CMD_SUCCESS; } def method: BUILDIN_DEF(getguildinfo,"ii"),
Recompile your server, then your event would be:
OnPCLoadMapEvent: if (getmapflag(strcharinfo(3), mf_gvg_castle)) { .@guild_id = getcharid(2); if (BaseLevel < 175 || .@guild_id == 0 || getguildinfo(.@guild_id, 0) < 43 || getguildinfo(.@guild_id, 1) < 7) { dispbottom "[ Server ]: You don't have a guild or your Base Level isn't high enough.", 0x00ff00; warp "prontera", 155, 182; } } end;
-
1
-
-
Well, why do you need to change the file names to Korean? If you want to test locally in your client (using a data folder), it won't read Korean filenames. If you want to merge them in your GRF, GRF Editor will convert the names for you. So it's easier to not work in Korean.
Live map cloning feature
in Source Releases
Posted · Edited by Tokei
This feature allows you to clone maps ingame without having to reboot your server or do any changes client-side. The cloned maps will behave just like any other regular map, except players will not be able to save in them. If they log out, they will return to their spawn point. The commands:
@clonemap source_map new_map @delmap new_map @clonemaplist
This is useful if want to make an event on a map but there's an annoying NPC in the way (and you don't want to reboot your server just for that!). Another big upside being you don't need to send a patch for that either, the new map will be added 'live'. You can load scripts on these maps as well (they will be removed upon deleting the map).
Usage example:
@clonemap prontera newmap
@addwarp newmap 150 150 test_portal
(@unloadnpc test_portal)
Have fun!
These maps will be lost when rebooting the server.
clonemap.diff