I spent six good hours on trying to spawning one monster on a nearby FREE tile RANDOMLY!

RyanYe

RPG Game Lover
Veteran
Joined
Dec 31, 2020
Messages
75
Reaction score
10
First Language
English
Primarily Uses
RMMV
Hi there!
First, you have to replace this "chestId" with the ID of the event. I write "chestId" as an example for you. But this arg must be a valid event id.

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
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,880
Reaction score
1,354
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi!
It is because of that:
1614344107796.png

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)
 

Attachments

  • 1614343933520.png
    1614343933520.png
    38.2 KB · Views: 1

RyanYe

RPG Game Lover
Veteran
Joined
Dec 31, 2020
Messages
75
Reaction score
10
First Language
English
Primarily Uses
RMMV
1614345295383.png

1614345598831.png

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!
 

RyanYe

RPG Game Lover
Veteran
Joined
Dec 31, 2020
Messages
75
Reaction score
10
First Language
English
Primarily Uses
RMMV
With your help, my problem is now fixed!
thanks!
now this topic can be closed
 

Latest Threads

Latest Posts

Latest Profile Posts

Time to wear a new face again...

Should keep things interesting huh? @EpicFILE :p
unknown.png

Been feeling that my characters spent too much time exploring caves, so I figured it was time to explore abandoned keeps instead.
Did you had some minor hitches with RMMZ? Come report to my topic where I did the same! [Just another rant from a RM veteran + Suggestions and Solutions] All opinions are welcome!
Squashing some bugs before releasing plugin :LZScool:The testing phase is taking more time than what I expected...

Forum statistics

Threads
110,329
Messages
1,052,383
Members
143,368
Latest member
indecisivesidekick
Top