From ef6c4a0bfd78b35fdcaafd8258a770769b0f93d5 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 10 Feb 2019 02:12:30 -0200 Subject: Prevent Cycles from dying because maggot wandered outside crop field --- npc/005-1-1/main.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'npc/005-1-1') diff --git a/npc/005-1-1/main.txt b/npc/005-1-1/main.txt index 8b7ed2642..b52b21f90 100644 --- a/npc/005-1-1/main.txt +++ b/npc/005-1-1/main.txt @@ -28,7 +28,8 @@ .@i+=(.@y-.@offy)*.@w; // Now we add any X beyond .@offx .@i+=(.@x-.@offx); - return(sprintf("%03d", .@i)); + // Do not go out of scope if maggot wander outside the area + return(sprintf("%03d", max(0, min(.@i, 168)))); } npctalk l("Go kill the maggots!"); @@ -132,7 +133,7 @@ OnInteract: */ .@mobId=atoi(.@key$); getmapxy(.@m$, .@x, .@y, UNITTYPE_MOB, .@mobId); - debugmes("[LOGIC] -------------------------- proccess %d", .@mobId); + //debugmes("[LOGIC] -------------------------- proccess %d", .@mobId); // Destroy the crop if needed .@cropId$=getcropid(.@x, .@y); @@ -143,6 +144,7 @@ OnInteract: disablenpc instance_npcname("#Marggo"+.@cropId$, MARGGO_ID); } + /* // Tell the Maggot to walk to a random coordinate // (it may walk backwards due not preserving old data) // This will cause maggot to abort a counter attack and to never stop @@ -152,7 +154,8 @@ OnInteract: unitwalk(.@mobId, 30, 30); else unitwalk(.@mobId, .@x+any(1, -1), .@y+any(1, -1)); - debugmes("[LOGIC] ------------------------------------- ai advanced"); + */ + //debugmes("[LOGIC] ------------------------------------- ai advanced"); } htidelete(.@hti); -- cgit v1.2.3-60-g2f50