MOb Spawner Early Version


So in the game that I am working on in Furcadia I needed a method to get monsters onto the game area without having to place a whole bunch of items on the screen and then try to remember which ones were still active and which ones were not.  So I decided to make a single item place other items on the map.   So what this code does is locate where one of these spawn point items is on the map.  From there it defines an area around it for an item to be place.  Then it checks to see what zone the player is in to figure out what three monster types could be spawned in.  The number can be increased so that more monster types can spawn in at any given location.  but with the way I plan to use this in the future is to have spawn points in different zones so that the same code can be used to summon many types of monsters without having to reiterate the code a whole bunch.

I am aware that the description above doesn't paint the clearest image about what is happening as this
code is accessing other areas of the code and therefore won't work cut and paste. 

I will update this in the future to include a working map with the spawner in it so that it can be
reverse engineered easier, as well as implemented in any dream that you may have.







(0:100) When 10 seconds have passed, offset by 0,
 (1:202) and variable %monCount is less than 35,
*find a spawners location on the map create a zone and randomly spawn a monster into that zone
  (3:1) everywhere on the whole map,
   (4:3) only where an item 1337 is,
    (5:532) set variable %spawnPosRough to the X,Y position of a random spot where the item is 1337 somewhere in the Dream.

    (5:301) copy the value of variable %spawnPosRough into variable %spawnZoneTL.
    (5:301) copy the value of variable %spawnPosRough into variable %spawnZoneBR.

    (5:302) take variable %spawnZoneTL.x and add 2 to it.
    (5:302) take variable %spawnZoneTL.y and add 2 to it.

    (5:304) take variable %spawnZoneBR.x and subtract 2 from it.
    (5:304) take variable %spawnZoneBR.y and subtract 2 from it.

     (5:500) set variable %spawnPos to the X,Y position of a random spot within the rectangle (%spawnZoneTL) - (%spawnZoneBR).


      (5:312) set variable %whichMon to the total of rolling 1 dice with 6 sides plus 0.




*--------------------------------------------------------Copy Between for each monster you wish to be spawinging
*Create effect and spawn a monster
(0:100) When 10 seconds have passed, offset by 1,
 (1:1013) and position (%spawnPos) is item 0,
 (1:1101) and there's no furre at (%spawnPos),
 (1:201) and variable %whichMon is more than 0,
 (1:202) and variable %whichMon is less than 4,
    (5:302) take variable %monCount and add 1 to it.
    (5:151) set location (%spawnPos) to overlay effect 106.
    (5:41) place item %monOne at (%spawnPos).

(0:100) When 10 seconds have passed, offset by 1,
 (1:1013) and position (%spawnPos) is item 0,
 (1:1101) and there's no furre at (%spawnPos),
(1:201) and variable %whichMon is more than 3,
 (1:202) and variable %whichMon is less than 6,
    (5:302) take variable %monCount and add 1 to it.
    (5:151) set location (%spawnPos) to overlay effect 106.
    (5:41) place item %monTwo at (%spawnPos).

(0:100) When 10 seconds have passed, offset by 1,
 (1:1013) and position (%spawnPos) is item 0,
 (1:1101) and there's no furre at (%spawnPos),
 (1:200) and variable %whichMon is equal to 6,
    (5:302) take variable %monCount and add 1 to it.
    (5:151) set location (%spawnPos) to overlay effect 106.
    (5:41) place item %monThree at (%spawnPos).
*--------------------------------------------------------
*Cleanup effect
(0:100) When 10 seconds have passed, offset by 3,
    (5:151) set location (%spawnPos) to overlay effect 0.

Comments