Jump to content
  • 0

DuplicateCreate and DuplicateRemove command compile error


Zell

Question


  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  411
  • Reputation:   260
  • Joined:  04/25/12
  • Last Seen:  

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");


 

  • Upvote 1
  • MVP 1
Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  411
  • Reputation:   260
  • Joined:  04/25/12
  • Last Seen:  

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);


 

  • Upvote 1
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   17
  • Joined:  12/31/11
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  123
  • Reputation:   37
  • Joined:  07/15/13
  • Last Seen:  

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.

unknown.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

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.

unknown.png

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 by Ninja
Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  123
  • Reputation:   37
  • Joined:  07/15/13
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3122
  • Reputation:   1614
  • Joined:  03/26/12
  • Last Seen:  

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!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  411
  • Reputation:   260
  • Joined:  04/25/12
  • Last Seen:  

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 by Zell
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3122
  • Reputation:   1614
  • Joined:  03/26/12
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  141
  • Reputation:   45
  • Joined:  08/14/12
  • Last Seen:  

Change the or to an and in the while condition.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3122
  • Reputation:   1614
  • Joined:  03/26/12
  • Last Seen:  

&& fixed it, thank you both!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

@Zell Hello is this same on this command?
 

https://board.herc.ws/topic/8216-duplicate-npc-commands/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...