How To Keep Fish In Rivers Or Keeping Land Based Mobs On Land

Main.HowToKeepFishInRiversOrKeepingLandBasedMobsOnLand History

Hide minor edits - Show changes to markup

August 15, 2014, at 01:22 PM EST by Rhuli
Changed lines 1-2 from:

This mostly came up because of mobs wandering on the continents - being able to restrict a fish to river only sectors or a mountain lion to the mountains etc

to:

This mostly came up because of mobs wandering on the continents - being able to restrict a fish to river only sectors or a mountain lion to the mountains, etc.

     NOTE: There is now a nomob flag you can place on any exit, which can keep a mob from wandering in a certain direction. 
           However, the prog below can be used if this does not work for your situation.
March 07, 2014, at 03:47 PM EST by Guinness
Changed lines 5-6 from:

Please note: If you intend to use this mprog, then flag the mob nospecialdam, otherwise the mob will experience a bug where it doesn't work correctly for archery if the player is trying to target it from a different sector. A simple alternative to this is to instead flag the exits in the room nomob. This flag effectively builds a wall that mobs can't get past on either side.

to:

Please note: If you intend to use this mprog, then flag the mob nospecialdam, otherwise the mob will not work correctly for archery if the player is trying to target it from a different sector. A simple alternative to this mprog is to instead flag the exits in the room nomob. This flag effectively builds a wall that mobs can't get past on either side.

March 07, 2014, at 03:46 PM EST by Guinness
Changed lines 5-6 from:

'Please note: If you intend to use this mprog, then flag the mob nospecialdam, otherwise the mob will experience a bug where it doesn't work correctly for archery if the player is trying to target it from a different sector. A simple alternative to this is to instead flag the exits in the room 'nomob'. This flag effectively builds a wall that mobs can't get past on either side.

to:

Please note: If you intend to use this mprog, then flag the mob nospecialdam, otherwise the mob will experience a bug where it doesn't work correctly for archery if the player is trying to target it from a different sector. A simple alternative to this is to instead flag the exits in the room nomob. This flag effectively builds a wall that mobs can't get past on either side.

March 07, 2014, at 03:45 PM EST by Guinness
Added lines 5-6:

'Please note: If you intend to use this mprog, then flag the mob nospecialdam, otherwise the mob will experience a bug where it doesn't work correctly for archery if the player is trying to target it from a different sector. A simple alternative to this is to instead flag the exits in the room 'nomob'. This flag effectively builds a wall that mobs can't get past on either side.

December 30, 2008, at 05:21 PM EST by admin
Changed lines 1-21 from:

This was needed for a specific purpose, but might be useful to others:

1. The last room a mob was in can now be accessed with self.lastroom which returns a 'room' type variable.

2. The sector list has been pushed into Lua as globals similar to the SEX_, RACE_, etc variables.

The point was, for example, look at the mesolar bigmap. You can see a network of rivers. If you wanted to put a fish in that river and let it wander, but only around the rivers, you would use:

First 15 lines of code:

  1. local lastroom = self.lastroom
  2. if lastroom ~= nil then
  3.    if self.room.sector ~= SECT_RIVER then
  4.       say(" I'm a fish, have to stay in the river.")
  5.       rgoto(lastroom)
  6.    end
  7. end

 (Obviously the 'say' shouldnt be there, that was for testing)
to:

This mostly came up because of mobs wandering on the continents - being able to restrict a fish to river only sectors or a mountain lion to the mountains etc

The solution for this involves using the new 'lastroom' character property along with an entry trigger. If the mob tries to enter a sector type you don't want it to be in, transfer it back to its last room.

   --- Fish mob, can only wander to another river or a lake.
   --- At the point an entry trigger fires, the mob is already in the room
   --- it is attempting to move to.

   local lastroom = self.lastroom
   if lastroom ~= nil then
      if self.room.sector ~= SECT_RIVER and self.room.sector ~= SECT_LAKE then
         rgoto(lastroom)
      end
   end

The trigger for this is:

   Current Triggers
   No   Trigger Type Program       Old Vnum Phrase/Percentage
   ==   ============ ============= ======== ==================================
   1 - Entry        test-47              0 100
December 30, 2008, at 01:12 AM EST by admin
Deleted line 0:
Changed lines 4-5 from:

1. The last room a mob was in can now be accessed with self.lastroom which

   returns a 'room' type variable.
to:

1. The last room a mob was in can now be accessed with self.lastroom which returns a 'room' type variable.

Changed lines 6-7 from:

2. The sector list has been pushed into Lua as globals similar to the SEX_,

   RACE_, etc variables.
to:

2. The sector list has been pushed into Lua as globals similar to the SEX_, RACE_, etc variables.

Changed lines 9-11 from:

The point was, for example, look at the mesolar bigmap. You can see a network of rivers. If you wanted to put a fish in that river and let it wander, but only around the rivers, you would use:

to:

The point was, for example, look at the mesolar bigmap. You can see a network of rivers. If you wanted to put a fish in that river and let it wander, but only around the rivers, you would use:

Changed lines 21-22 from:

(Obviously the 'say' shouldnt be there, that was for testing)

to:
 (Obviously the 'say' shouldnt be there, that was for testing)
December 30, 2008, at 01:11 AM EST by admin
Added lines 1-27:

This was needed for a specific purpose, but might be useful to others:

1. The last room a mob was in can now be accessed with self.lastroom which

   returns a 'room' type variable.

2. The sector list has been pushed into Lua as globals similar to the SEX_,

   RACE_, etc variables.

The point was, for example, look at the mesolar bigmap. You can see a network of rivers. If you wanted to put a fish in that river and let it wander, but only around the rivers, you would use:

First 15 lines of code:

  1. local lastroom = self.lastroom
  2. if lastroom ~= nil then
  3.    if self.room.sector ~= SECT_RIVER then
  4.       say(" I'm a fish, have to stay in the river.")
  5.       rgoto(lastroom)
  6.    end
  7. end

(Obviously the 'say' shouldnt be there, that was for testing)