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,875
Reaction score
1,349
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 Profile Posts

MythicRuss wrote on gothicvoid's profile.
hi, i was looking thru ur awesome stuff, and was looking around the internet, how in the heckin heck do i get the hiddendoors to open? im addng them to the doors event but they just appear as solid walls, btw am total noob lol
currently working on some template sprites and tweaking the walk cycle :)
Lunee.jpg
Early try to draw our Demon Countess, who destroyed her own soul leaving just an empty shell of a body - until our heroine unwillingly takes possession of it, every time she falls asleep.
(I know it’s a premade face from the Dark Fantasy Set, but I spent so much time with her, that I can’t bring myself to change the sprite anymore xD)
I finished setting up my new desk and apparently she thinks this is where she goes now.

20210411_082331.jpg

Forum statistics

Threads
110,305
Messages
1,052,144
Members
143,335
Latest member
claanxy
Top