Suggestion: NPC name as parameter in enablenpc (#6233)
* The required NPC name parameter is now optional for the following script commands:
enablenpc
disablenpc
hideonnpc
hideoffnpc
cloakonnpc
cloakoffnpc
isnpccloaked
* Updated docs
Co-authored-by: Aleos <aleos89@users.noreply.github.com>
This commit is contained in:
@@ -254,20 +254,15 @@ static int npc_cloaked_sub(struct block_list *bl, va_list ap)
|
||||
/*==========================================
|
||||
* Disable / Enable NPC
|
||||
*------------------------------------------*/
|
||||
bool npc_enable_target(const char* name, uint32 char_id, int flag)
|
||||
bool npc_enable_target(npc_data* nd, uint32 char_id, int flag)
|
||||
{
|
||||
struct npc_data* nd = npc_name2id(name);
|
||||
|
||||
if (!nd) {
|
||||
ShowError("npc_enable: Attempted to %s a non-existing NPC '%s' (flag=%d).\n", (flag&11) ? "show" : "hide", name, flag);
|
||||
return false;
|
||||
}
|
||||
nullpo_ret(nd);
|
||||
|
||||
if (char_id > 0 && (flag & 24)) {
|
||||
map_session_data *sd = map_charid2sd(char_id);
|
||||
|
||||
if (!sd) {
|
||||
ShowError("npc_enable: Attempted to %s a NPC '%s' on an invalid target %d.\n", (flag & 8) ? "show" : "hide", name, char_id);
|
||||
ShowError("npc_enable: Attempted to %s a NPC '%s' on an invalid target %d.\n", (flag & 8) ? "show" : "hide", nd->name, char_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user