12-27-2020, 03:30 PM
These commands will help you create shops and spawn some npc's easier ( i mostly use them for intown spawning)
Credits to : Rrbkmz
Go under Sharelib/gm_command.h (around line 332)
add this
#define GM_CMD_SPAWN_NPC "spawn_npc"
#define GM_CMD_SPAWN_SHOP "spawn_shop"
under GameServer/GMCmdList.cpp around line 287 add this
add(new CGMCmd(GM_CMD_SPAWN_NPC, 10, do_spawnNPC)); // rrbkmz
add(new CGMCmd(GM_CMD_SPAWN_SHOP, 10, do_spawnSHOP));
Next Gameserver/dofuncAdmin.h around line 241 add this
void do_spawnNPC(CPC* ch, const char* arg, std::vector<std:
tring>& vec);void do_spawnSHOP(CPC* ch, const char* arg, std::vector<std:
tring>& vec); Next doFuncAdmin.cpp arround line 11005 (at the end of the file) add this
void do_spawnNPC(CPC* ch, const char* arg, std::vector<std:
tring>& vec){
char tmpBuf[MAX_MESSAGE_SIZE] = { 0, };
*tmpBuf = '\0';
if (!arg || !(*arg))
return;
arg = AnyOneArg(arg, tmpBuf);
int IdNPC = atoi(tmpBuf);
arg = AnyOneArg(arg, tmpBuf);
int RegenNPC = atoi(tmpBuf);
arg = AnyOneArg(arg, tmpBuf);
int iLayer = atoi(tmpBuf);
sprintf(tmpBuf, "INSERT INTO t_npc_regen (a_zone_num, a_npc_idx, a_pos_x, a_pos_z, a_pos_h, a_pos_r, a_y_layer, a_regen_sec, a_total_num) VALUES ( %d, %d, %f , %f, %f, %f, %d, 300, -1)",
ch->m_pZone->m_index, IdNPC, ch->m_pos.m_x = GET_X(ch), ch->m_pos.m_z = GET_Z(ch), ch->m_pos.m_h = GET_H(ch), ch->m_pos.m_r, ch->m_pos.m_yLayer = GET_YLAYER(ch), RegenNPC);
GAMELOG << init("NewServer") << "USE npc_regen_o COMMAND : CHAR_ID : "
<< ch->m_index << " CHAR_NAME : "
<< ch->m_name << " : "
<< ch->m_nick << "POS : "
<< ch->m_pos.m_x << " : "
<< ch->m_pos.m_z << " : "
<< ch->m_pos.m_h << "NPC_ID : "
<< IdNPC << "ZONE_NUM : "
<< ch->m_pZone->m_index << end;
CDBCmd cmd;
cmd.Init(&gserver->m_dbdata);
cmd.SetQuery(tmpBuf);
if (!cmd.Update())
{
}
}
Add this under neither that function
void do_spawnSHOP(CPC* ch, const char* arg, std::vector<std:
tring>& vec) //dethunter12 spawn shop {
char tmpBuf[MAX_MESSAGE_SIZE] = { 0, };
*tmpBuf = '\0';
if (!arg || !(*arg))
return;
arg = AnyOneArg(arg, tmpBuf);
int IdNPC = atoi(tmpBuf);
arg = AnyOneArg(arg, tmpBuf);
int RegenNPC = atoi(tmpBuf);
arg = AnyOneArg(arg, tmpBuf);
int iLayer = atoi(tmpBuf);
sprintf(tmpBuf, "INSERT INTO t_shop (a_zone_num, a_keeper_idx, a_pos_x, a_pos_z, a_pos_h, a_pos_r, a_y_layer, a_sell_rate, a_buy_rate) VALUES ( %d, %d, %f , %f, %f, %f, %d, 40, 100)",
ch->m_pZone->m_index, IdNPC, ch->m_pos.m_x = GET_X(ch), ch->m_pos.m_z = GET_Z(ch), ch->m_pos.m_h = GET_H(ch), ch->m_pos.m_r, ch->m_pos.m_yLayer = GET_YLAYER(ch));
GAMELOG << init("NewServer") << "USE t_shop COMMAND : CHAR_ID : "
<< ch->m_index << " CHAR_NAME : "
<< ch->m_name << " : "
<< ch->m_nick << "POS : "
<< ch->m_pos.m_x << " : "
<< ch->m_pos.m_z << " : "
<< ch->m_pos.m_h << "NPC_ID : "
<< IdNPC << "ZONE_NUM : "
<< ch->m_pZone->m_index << end;
CDBCmd cmd;
cmd.Init(&gserver->m_dbdata);
cmd.SetQuery(tmpBuf);
if (!cmd.Update())
{
}
}
Next you'll want to use the commands in game You will type the following
face where you want to the npc facing
/monthly_2020_12/image.png.f56209f9500fe8c08f2456808e94fbe5.png" />/monthly_2020_12/image.png.d700e3692b26708c205a126e071884d3.png" />
then you can go check t_npc_regen for the npc spawn and t_shop for the shop spawn
thats all i have for this guide hope you enjoyed it.

