Hi I'm requesting 2 script_commands that are pretty self explanatory: duplicatenpc & duplicateremove.
I know this is possible since we are able to duplicate npcs for instances. But I want to do that outside of instances. I made an attempt myself, but sadly fell short (who am I kidding, far, very far) of what I believe is needed.
So, seeing as how I failed miserably, I've come to ask you expert's to do this for me. I don't know if my attempt will prove useful but there it is in all it's pile of mess lol.
If payment is required, then send me a PM and we can discuss terms there. Otherwise, I'd hope to get this done for free D:
Hi I'm requesting 2 script_commands that are pretty self explanatory: duplicatenpc & duplicateremove.
I know this is possible since we are able to duplicate npcs for instances. But I want to do that outside of instances. I made an attempt myself, but sadly fell short (who am I kidding, far, very far) of what I believe is needed.
*duplicateremove({"<npc_name>"});BUILDIN(duplicateremove){ struct npc_data *nd; const char* source_name; if( script_hasdata(st,2) ){ source_name = script_getstr(st,2); nd = npc->name2id(source_name); if( nd == NULL ){ ShowError("script_duplicateremove: NPC not found: %sn", source_name); script_pushint(st,0); return true; } } else nd = (struct npc_data *)map->id2bl(st->oid); if( nd->src_id == NULL ) // Remove all duplicates for this source npc map->foreachnpc(npc->unload_dup_sub, nd->bl.id); else // Remove just this duplicate npc->unload(nd,1); script_pushint(st,1); return true;}*duplicatenpc("<source_npc_name>","<target_npc_name>","<hidden_name>","<map_name>",<x>,<y>,<dir>);BUILDIN(duplicatenpc){ struct npc_data *snd, *tnd; const char *source_name, *target_name, *hidden_name; const char *map_name; int x, y, dir; int mapid; int i; char targetname[NAME_LENGTH]; x = script_getnum(st,5); y = script_getnum(st,6); dir = script_getnum(st,7); source_name = script_getstr(st,2); snd = npc->name2id(source_name); if( snd == NULL ){ ShowError("script_duplicatenpc: NPC not found: %sn", source_name); script_pushint(st,0); // Source NPC not found. return true; } if( strlen( (target_name = script_getstr(st,3)) ) + strlen( (hidden_name = script_getstr(st,4)) ) > 23 ){ ShowError("script_duplicatenpc: Target_Name + Hidden_Name is too long. (max = 23chars)n"); script_pushint(st,-1); // Target Name = Hidden Name too long. return false; } mapid = map->mapname2mapid(map_name); if( mapid == NULL ){ ShowError("script_duplicatenpc: %s map does not exist.n", map_name); script_pushint(st,-2); return false; } CREATE(tnd, struct npc_data, 1); strcat(targetname, target_name); strncat(targetname, "#", 1); strncat(targetname, hidden_name, strlen(hidden_name)); safestrncpy(tnd->name, target_name, sizeof(tnd->name)); safestrncpy(tnd->exname, hidden_name, sizeof(tnd->exname)); tnd->bl.prev = tnd->bl.next = NULL; tnd->bl.m = mapid; tnd->bl.x = x; tnd->bl.y = y; tnd->bl.id = npc->get_new_npc_id(); tnd->class_ = snd->class_; tnd->speed = snd->speed; tnd->src_id = snd->src_id; tnd->bl.type = BL_NPC; tnd->subtype = snd->subtype; switch( tnd->subtype ){ case SCRIPT: tnd->u.scr.xs = snd->u.scr.xs; tnd->u.scr.ys = snd->u.scr.ys; tnd->u.scr.script = snd->u.scr.script; tnd->u.scr.label_list = snd->u.scr.label_list; tnd->u.scr.label_list_num = snd->u.scr.label_list_num; break; case SHOP: case CASHSHOP: tnd->u.shop.shop_item = snd->u.shop.shop_item; tnd->u.shop.count = snd->u.shop.count; break; case WARP: if( !battle_config.warp_point_debug ) tnd->class_ = WARP_CLASS; else tnd->class_ = WARP_DEBUG_CLASS; tnd->u.warp.xs = snd->u.warp.xs; tnd->u.warp.ys = snd->u.warp.ys; tnd->u.warp.mapindex = snd->u.warp.mapindex; tnd->u.warp.x = snd->u.warp.x; tnd->u.warp.y = snd->u.warp.y; break; } if( mapid >= 0 ){ map->addnpc(mapid, tnd); tnd->ud = &npc->base_ud; tnd->dir = dir; npc->setcells(tnd); map->addblock(&tnd->bl); if( tnd->class_ >= 0 ){ status->set_viewdata(&tnd->bl, tnd->class_); if( map->list[tnd->bl.m].users ) clif->spawn(&tnd->bl); } } else { map->addiddb(&tnd->bl); } strdb_put(npc->name_db, tnd->exname, tnd); if( tnd->subtype != SCRIPT ) return true; for( i = 0; i < tnd->u.scr.label_list_num; i++ ){ if( npc->event_export(tnd, i)){ script_pushint(st,0); return false; } npc->timerevent_export(tnd, i); } tnd->u.scr.timerid = snd->u.scr.timerid; script_pushint(st,1); return true;}So, seeing as how I failed miserably, I've come to ask you expert's to do this for me. I don't know if my attempt will prove useful but there it is in all it's pile of mess lol.
If payment is required, then send me a PM and we can discuss terms there. Otherwise, I'd hope to get this done for free D:
Please & Thank You!
Edited by GmOceanShare this post
Link to post
Share on other sites