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,872
Reaction score
1,345
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

Raptor Revolt Demo 4_10_2021 3_12_09 PM.png

Latest custom tileset work for RAPTOR REVOLT in this beach scene set in the acheroraptor capital in Ridge City, Hell Creek.
unknown.png


I figured it was about time to update the battle sprite for one of my characters. The old one was the first time I ever drew a battle sprite, and filled with lines that shouldn't be there. So far, the new one is cleaner.
EQAQeW8.png

This was supposed to become her neutral talking stance, but now i just feel like she looks a little puzzled :D
I'm also open for any name suggestions, as i seriously suck at those. In my notes everything is just THE CITY or THAT GUY and THIS PRIESTESS or whatever :D
Nearing completion of the first major city of Albert, a vacation getaway city built a long time ago by a king who really didn't want to be invaded.
It’s definitely a great day to fit in some time for me to play no mans sky on PS4

Forum statistics

Threads
110,278
Messages
1,051,925
Members
143,297
Latest member
Sircoochievert
Top