I have copied this code to the plugin, but the game told me the function is not defined, let me give you some screenshots, wait
I spent six good hours on trying to spawning one monster on a nearby FREE tile RANDOMLY!
RPG Maker MV SupportI have copied this code to the plugin, but the game told me the function is not defined, let me give you some screenshots, wait
SOS!!
Hi!
It is because of that:
Your function is inside another function (IIFE) because of that it is not on the global scope.
You can either add it without the IIFE (red circled)
Or put the function in the game map class for example
Game_Map.prototype.getFreeTileToSpawnEvent = function (px, py, range, eventId){
.....
}
Sou you call it with $gameMap.getFreeTileToSpawnEvent(...args)
It is because of that:
Your function is inside another function (IIFE) because of that it is not on the global scope.
You can either add it without the IIFE (red circled)
Or put the function in the game map class for example
Game_Map.prototype.getFreeTileToSpawnEvent = function (px, py, range, eventId){
.....
}
Sou you call it with $gameMap.getFreeTileToSpawnEvent(...args)
I have tried both way but not work(not defined again), maybe there is some grammar error so the game ignore the whole js file then this function is never defined?
have you tried it for yourself? if so, can you send me your js file here or dropbox, many thanks!
With your help, my problem is now fixed!
thanks!
now this topic can be closed
thanks!
now this topic can be closed
Original thread: https://forums.rpgmakerweb.com/threads/i-spent-six-good-hours-on-trying-to-spawning-one-monster-on-a-nearby-free-tile-randomly.133781/