How To Keep Fish In Rivers Or Keeping Land Based Mobs On Land
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.
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.
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.
--- 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