Recently, I'm trying to make a mod for HRC. I went through RomeoPapa's Advanced Guide to Modding, it was very helpful, everything went smoothly until I realized something was wrong.
I followed the "Spawning Events using Map Scripts" tutorial to create a custom event into the game map but when I test it the game freezes when the custom event is run. I have set the trigger of that event to autorun and i'm sure i erased the event after it finished running.
perhaps there is something wrong with the erase event command not executing. I searched in Game_Interpreter class and found out not only erase event but self switch related methods are having problem.
maybe the setup(list, event_id = 0) method in the Game_Interpreter class couldn't find the event_id and returned 0 making @event_id also 0 but @event_id is used to determine the event id in Control Self Switch(command_123 ) and Erase Event(command_214). so when these commands are called, it only makes changes to the event whose id is 0, to make sure I'm correct, I changed event_name = 0 and ran test:
As I expected, problem solved but this is not all, setting custom event id to 0 is really bad idea. So I found another solution. after a day of searching I got myself 2 solutions:
solution 1: replace faulty commands with script calls, copy all lines of code inside method and change @event_id, For example:
i found that erase event is not working
I find the command location
I copy the content inside paste into the script then change @event_id
it works! but this way is really cumbersome if you have many events to add to the map and also makes it difficult to edit
so we go to solution 2:
I found this solution here: https://www.rpgmakercentral.com/topi...events/?page=2
based on that i wrote a script that creates a simple method that copies an event without giving the above error, unfortunately this mod does not allow you to set a custom id because otherwise it will throw an error, event id should only be a positive integer that does not coincide with other event ids contained in the map, this id is automatically chosen by the script so you don't need to set it up.
how to use it:
if you are player:
1. Download the mod from the link below
2. Unzip this file into your /HaremCollector_vxxx folder
if you are modder:
Normally when you want to copy an event you have to:
map_name=load_data("EventMapFilePath")
$game_map.events[event_name]=Game_Event.new(@map_id, map_name.events[event_id])
$game_map.events[event_name].moveto(x, y)
you can now:
copy_event_fix(pathToMap,eventId,x,y)
Explanation:
pathToMap: the path to the map where you want to copy the event
eventId: event id you want to copy
x,y: the location you want the event to be on the map
For example:
or if you don't want to use it this way, you can refer to its code to fix the problem without putting it in your mods folder, don't worry this mod is extremely short.
hope this is helpful to you.
download:https://mega.nz/file/Or410QRI#vrdUHI...bSAR8-dwlCTwRA
I followed the "Spawning Events using Map Scripts" tutorial to create a custom event into the game map but when I test it the game freezes when the custom event is run. I have set the trigger of that event to autorun and i'm sure i erased the event after it finished running.
perhaps there is something wrong with the erase event command not executing. I searched in Game_Interpreter class and found out not only erase event but self switch related methods are having problem.
maybe the setup(list, event_id = 0) method in the Game_Interpreter class couldn't find the event_id and returned 0 making @event_id also 0 but @event_id is used to determine the event id in Control Self Switch(command_123 ) and Erase Event(command_214). so when these commands are called, it only makes changes to the event whose id is 0, to make sure I'm correct, I changed event_name = 0 and ran test:
As I expected, problem solved but this is not all, setting custom event id to 0 is really bad idea. So I found another solution. after a day of searching I got myself 2 solutions:
solution 1: replace faulty commands with script calls, copy all lines of code inside method and change @event_id, For example:
i found that erase event is not working
I find the command location
I copy the content inside paste into the script then change @event_id
it works! but this way is really cumbersome if you have many events to add to the map and also makes it difficult to edit
so we go to solution 2:
I found this solution here: https://www.rpgmakercentral.com/topi...events/?page=2
based on that i wrote a script that creates a simple method that copies an event without giving the above error, unfortunately this mod does not allow you to set a custom id because otherwise it will throw an error, event id should only be a positive integer that does not coincide with other event ids contained in the map, this id is automatically chosen by the script so you don't need to set it up.
how to use it:
if you are player:
1. Download the mod from the link below
2. Unzip this file into your /HaremCollector_vxxx folder
if you are modder:
Normally when you want to copy an event you have to:
map_name=load_data("EventMapFilePath")
$game_map.events[event_name]=Game_Event.new(@map_id, map_name.events[event_id])
$game_map.events[event_name].moveto(x, y)
you can now:
copy_event_fix(pathToMap,eventId,x,y)
Explanation:
pathToMap: the path to the map where you want to copy the event
eventId: event id you want to copy
x,y: the location you want the event to be on the map
For example:
or if you don't want to use it this way, you can refer to its code to fix the problem without putting it in your mods folder, don't worry this mod is extremely short.
hope this is helpful to you.
download:https://mega.nz/file/Or410QRI#vrdUHI...bSAR8-dwlCTwRA
Comment