diff --git a/scripts/ai/tpl/generic.lua b/scripts/ai/tpl/generic.lua
index 0bfdda2..d003263 100644
--- a/scripts/ai/tpl/generic.lua
+++ b/scripts/ai/tpl/generic.lua
@@ -91,7 +91,8 @@ function idle()
   planet = ai.landplanet()
   -- Planet must exist.
   if planet == nil or land_planet == false then
-    ai.pushtask(0, "hyperspace")
+    ai.settimer(0, rnd.int(1000, 3000))
+    ai.pushtask(0, "enterdelay")
   else
     mem.land = planet
     ai.pushtask(0, "hyperspace")
@@ -99,6 +100,13 @@ function idle()
   end
 end
 
+-- Delays the ship when entering systems so that it doesn't leave right away.
+function enterdelay()
+  if ai.timeup(0) then 
+    ai.pushtask(0, "hyperspace")
+  end
+end
+
 function create()
   attack_choose()
 end
diff --git a/scripts/ai/tpl/merchant.lua b/scripts/ai/tpl/merchant.lua
index 14f845c..b4a4beb 100644
--- a/scripts/ai/tpl/merchant.lua
+++ b/scripts/ai/tpl/merchant.lua
@@ -30,7 +30,8 @@ function control()
     planet = ai.landplanet()
     -- Planet must exist.
     if planet == nil then
-      ai.pushtask(0, "hyperspace")
+      ai.settimer(0, rnd.int(1000, 3000))
+      ai.pushtask(0, "enterdelay")
     else
       mem.land = planet
       ai.pushtask(0, "hyperspace")
@@ -39,6 +40,13 @@ function control()
   end
 end
 
+-- Delay the ship when entering systems so that it doesn't leave right away.
+function entedelay()
+  if ai.timeup(0) then
+    ai.pushtask(0, "hyperspace")
+  end
+end
+
 function sos()
 
 end