Zell Posted May 16, 2018 Posted May 16, 2018 View File DuplicateCreate and DuplicateRemove command Apply the patch manually These commands allow you to create duplicates at run time. duplicatecreate("sourcename", "targetnameshown", "targetnamehidden", "targetmap", targetx, targety, targetdir{, targetspriteid{, targetxs, targetys}}); duplicateremove("npcname"); Submitter Zell Submitted 05/13/2018 Category Source Modifications Video Content Author Zell 1 1 Quote
1 Zell Posted May 28, 2018 Author Posted May 28, 2018 2 hours ago, Feilor said: I tried to use this, but it isn't working, when we try to use your diff, the compiler give error with function npc_event_export_2 was not declared in this scope, after add it in npc.hpp the compiler give the same error in function npc_timerevent_export My Mistake. Add in npc.h after void npc_event_do_oninit(void); //Zell Duplicate int npc_event_export_2(struct npc_data *nd, int i); void npc_duplicate_2(struct npc_data *nd); int npc_timerevent_export(struct npc_data *nd, int i); 1 1 Quote
0 Feilor Posted May 28, 2018 Posted May 28, 2018 I tried to use this, but it isn't working, when we try to use your diff, the compiler give error with function npc_event_export_2 was not declared in this scope, after add it in npc.hpp the compiler give the same error in function npc_timerevent_export Quote
0 SyncMaster Posted August 23, 2018 Posted August 23, 2018 I'm still new at editing the source files, but when I tried to add this command, I had the following error at visual studio. I would like to know if anyone have a better idea of what is causing this. Quote
0 Ninja Posted August 24, 2018 Posted August 24, 2018 (edited) 5 hours ago, SyncMaster said: I'm still new at editing the source files, but when I tried to add this command, I had the following error at visual studio. I would like to know if anyone have a better idea of what is causing this. As I can see above, you are still using ".c" which means a much older version as we are already into using c++. I think, the best thing to do is update your server to the latest rAthena and try to diff it again. Edited August 24, 2018 by Ninja Quote
0 Haziel Posted August 24, 2018 Posted August 24, 2018 Thread merged with the original support thread.@SyncMaster Please refrain from creating separate threads when there's a support topic already created for that specific purpose, which you included the link on your own post. Quote
0 SyncMaster Posted August 25, 2018 Posted August 25, 2018 8 hours ago, Haziel said: Thread merged with the original support thread.@SyncMaster Please refrain from creating separate threads when there's a support topic already created for that specific purpose, which you included the link on your own post. Sorry, I thought it was just a "release topic" 22 hours ago, Ninja said: As I can see above, you are still using ".c" which means a much older version as we are already into using c++. I think, the best thing to do is update your server to the latest rAthena and try to diff it again. I can't because of many other custom changes that I made in the source that i'm not yet able to convert them to C+. :x Quote
0 Ninja Posted August 25, 2018 Posted August 25, 2018 6 minutes ago, SyncMaster said: Sorry, I thought it was just a "release topic" I can't because of many other custom changes that I made in the source that i'm not yet able to convert them to C+. :x Then that would be a huge problem as the release is made specifically for c++ releases. You might wanna ask the mod creator to port it to older versions of rA. Quote
0 Akkarin Posted November 13, 2019 Posted November 13, 2019 This is a handy script to have! @Zell Would it be possible though to specify 0,0 as target coordinates to create the duplicate NPC on any random walkable cell on the map? I've tried to have a go myself using similar logic to how rAthena handles the spawning of mobs on cells but my efforts in the /src/ folder have shown me I have much room for improvement.. due to failure! Quote
0 Zell Posted November 13, 2019 Author Posted November 13, 2019 (edited) 13 hours ago, Akkarin said: This is a handy script to have! @Zell Would it be possible though to specify 0,0 as target coordinates to create the duplicate NPC on any random walkable cell on the map? I've tried to have a go myself using similar logic to how rAthena handles the spawning of mobs on cells but my efforts in the /src/ folder have shown me I have much room for improvement.. due to failure! After if (dupmapid < 0) { ShowError("duplicatecreate: Map not found. (%s)\n", mapa); script_pushint(st, 0); return 0; } Add: struct map_data *mapdata = map_getmapdata(dupmapid); int tries = 0; if(x <= 0 || y <= 0) { do { x = rnd()%(mapdata->xs-2)+1; y = rnd()%(mapdata->ys-2)+1; } while(map_getcell(dupmapid,x,y,CELL_CHKNOPASS) || (tries++) < 1000); } if (tries > 1000) { ShowError("duplicatecreate: Impossible to find a valid spot in (%s)\n", mapa); return SCRIPT_CMD_FAILURE; } Didn't test it but should work Edited November 13, 2019 by Zell 1 Quote
0 Akkarin Posted November 13, 2019 Posted November 13, 2019 I've given it a test but it's always hitting the invalid spot error. Tested on 5 regular maps with a simple npc script. Quote
0 nitrous Posted November 13, 2019 Posted November 13, 2019 Change the or to an and in the while condition. 1 Quote
0 Bringer Posted July 22, 2023 Posted July 22, 2023 @Zell Hello is this same on this command? https://board.herc.ws/topic/8216-duplicate-npc-commands/ Quote
Question
Zell
View File
DuplicateCreate and DuplicateRemove command
Apply the patch manually
These commands allow you to create duplicates at run time.
duplicatecreate("sourcename", "targetnameshown", "targetnamehidden", "targetmap", targetx, targety, targetdir{, targetspriteid{, targetxs, targetys}});
duplicateremove("npcname");
13 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.