diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 64468ed4934..d2650f7ad23 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -9109,12 +9109,15 @@ Example: *setwall("", , , , , , "") *delwall("") +*checkwall("") Creates an invisible wall, an array of setcell() starting from x,y and doing a line of the given size in the given direction. The difference with setcell is this one update client part too to avoid the glitch problem. Directions are the same as NPC sprite facing directions: (DIR_ constants). +The checkwall() function will return 1 if the wall exists, 0 if not. + --------------------------------------- *readbook(, ) diff --git a/npc/woe-se/agit_main_se.txt b/npc/woe-se/agit_main_se.txt index 6fc3193774e..e372adab229 100644 --- a/npc/woe-se/agit_main_se.txt +++ b/npc/woe-se/agit_main_se.txt @@ -1699,7 +1699,8 @@ OnBarrierDestroyed: setd "$agit_"+.@var$+"["+(.@num+1)+"]",1; setarray .@count$[0],"1st","2nd","3rd"; mapannounce strnpcinfo(NPC_NAME_HIDDEN),"The "+.@count$[.@num-1]+" Fortress Gate is destroyed.",bc_map,"0x00ff00"; - delwall .@var$+"_"+strnpcinfo(NPC_NAME_VISIBLE); + if (checkwall(sprintf("%s_%s", .@var$, strnpcinfo(NPC_NAME_VISIBLE)))) + delwall(sprintf("%s_%s", .@var$, strnpcinfo(NPC_NAME_VISIBLE))); } end; @@ -1729,7 +1730,8 @@ OnDisable: } } setcell(strnpcinfo(NPC_NAME_HIDDEN), .@x[0], .@y[0], .@x[1], .@y[1], cell_basilica, false); - delwall substr(strnpcinfo(NPC_NAME_HIDDEN),0,1)+substr(strnpcinfo(NPC_NAME_HIDDEN),8,9)+"_"+strnpcinfo(NPC_NAME_VISIBLE); + if (checkwall(sprintf("%s%s_%s", substr(strnpcinfo(NPC_NAME_HIDDEN), 0, 1), substr(strnpcinfo(NPC_NAME_HIDDEN), 8, 9), strnpcinfo(NPC_NAME_VISIBLE)))) + delwall(sprintf("%s%s_%s", substr(strnpcinfo(NPC_NAME_HIDDEN), 0, 1), substr(strnpcinfo(NPC_NAME_HIDDEN), 8, 9), strnpcinfo(NPC_NAME_VISIBLE))); killmonster strnpcinfo(NPC_NAME_HIDDEN),strnpcinfo(NPC_NAME)+"::OnBarrierDestroyed"; end; } diff --git a/src/map/script.c b/src/map/script.c index 5eed5897795..a3a40966cae 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -14261,6 +14261,16 @@ static BUILDIN(delwall) return true; } +static BUILDIN(checkwall) +{ + const char *name = script_getstr(st, 2); + + script_pushint(st, strdb_exists(map->iwall_db, name) ? 1 : 0); + + return true; +} + + /// Retrieves various information about the specified guardian. /// /// guardianinfo("", , ) -> @@ -25370,6 +25380,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(setcell,"siiiiii"), BUILDIN_DEF(setwall,"siiiiis"), BUILDIN_DEF(delwall,"s"), + BUILDIN_DEF(checkwall, "s"), BUILDIN_DEF(searchitem,"rs"), BUILDIN_DEF(mercenary_create,"ii"), BUILDIN_DEF(mercenary_heal,"ii"),