How would I go about makeing a proc that random creates 1 or 2 mobs at runtime at random postions on the map?
ID:270897
![]() Oct 22 2006, 5:20 am
|
|
<code>locate()</code> the turf you're about to move them to and don't move them there if the turf or any <code>atom/movable</code> on it is dense.
or Create the mob first, and then try to use the <code>Move()</code> proc to move them to a random spot. If the proc returns 0, the mob cannot move there (by default since there's something dense there) and you can retry. |
Pretty straight forward, using the rand command you can get a random number between the two values you specify. So, in the code we get a random number between minX and maxX, minY and maxY, and minZ and maxZ, then we position a new mob of type path at that location. All of the variables are defined in the parameters, and it loops through until the specified number of mobs have been created.
Example of calling it;