Hey, I'm an absolute beginner and basically don't know anything about javascript.
I'm trying to get a plugin done that allows me to have common events fire off automatically on map entrance & exit based on mapnotes.
That...should not be difficult. In fact, there's a script that pretty much almost does exactly that:
https://forums.rpgmakerweb.com/index.php?threads/plugin-assistance.64866/#post-621453
And it works. There's just one problem: I don't want to enter some number & tag every time. I want something simple that's quickly entered and that's so simple that the others working on the project with me don't need a guide either. Something like <indoors> <outside> or <weather_off>, that's easy to remember and quickly done.
So I've tried to use that script as basis to somehow get it working with parameters and it failed miserably. Like, not even bones.
I've since tried writing an even simpler version from scratch using the code of the above plugin as orientation...and I still fail. Yeah. 0 javascript experience.
-----------------------------------------------------------------------------------------------------
This is how it should work:
1. The user assigns parameters to six parameter slots in the plugin with the ID of the common event that should be called.
So I set the values up via
Basically everything beyond there starts to get sketchy.
Now that's me hoping I've got the plugin setup and the parameters loaded.
I'm...just replicating what the other plugin does here, and I'm absolutely not sure what it is I'm doing.
I guess I'm sharing variables around.
Last part of the plugin:
I've also tried it with removing $data_common_events and just using $gameTemp.reserveCommonEvent(this._MAPCHECKOffEvent); but it's not working out either.
I have a feeling what I'm trying to do is incredibly simple and can be done in a couple of lines, meanwhile I'm cluttering everything up, but I've really got no idea what's going on here.
Help would really be appreciated - I've pretty much wasted my entire day on this and I still can't get anywhere.
I'm trying to get a plugin done that allows me to have common events fire off automatically on map entrance & exit based on mapnotes.
That...should not be difficult. In fact, there's a script that pretty much almost does exactly that:
https://forums.rpgmakerweb.com/index.php?threads/plugin-assistance.64866/#post-621453
And it works. There's just one problem: I don't want to enter some number & tag every time. I want something simple that's quickly entered and that's so simple that the others working on the project with me don't need a guide either. Something like <indoors> <outside> or <weather_off>, that's easy to remember and quickly done.
So I've tried to use that script as basis to somehow get it working with parameters and it failed miserably. Like, not even bones.
I've since tried writing an even simpler version from scratch using the code of the above plugin as orientation...and I still fail. Yeah. 0 javascript experience.
-----------------------------------------------------------------------------------------------------
This is how it should work:
1. The user assigns parameters to six parameter slots in the plugin with the ID of the common event that should be called.
So I set the values up via
Code:
* @param Outside Common Event
* @desc Set this to the Number of the Common Event you wish to call
* @default 0
Basically everything beyond there starts to get sketchy.
Code:
var Imported = Imported || {};
Imported.SMTE_MapTransferCommonEvent = true;
var SMTE = SMTE || {};
SMTE.MAPCHECK = SMTE.MAPCHECK || {};
var params = PluginManager.parameters('SMTE.MAPCHECK')
SMTE.MAPCHECK.outside = Number(params['Outside Common Event']);
SMTE.MAPCHECK.inside = Number(params['Inside Common Event']);
SMTE.MAPCHECK.off = Number(params['Invisible Weather Common Event']);
SMTE.MAPCHECK.leave_outside = Number(params['Leave Outside Common Event']);
SMTE.MAPCHECK.leave_inside = Number(params['Leave Inside Common Event']);
SMTE.MAPCHECK.leave_off = Number(params['Leave Invisible Weather Common Event']);
Now that's me hoping I've got the plugin setup and the parameters loaded.
Code:
SMTE.MAPCHECK.Game_Map_initialize = Game_Map.prototype.initialize;
Game_Map.prototype.initialize = function() {
this._MAPCHECKInterpreter = new Game_Interpreter();
this._MAPCHECKOutsideEvent = SMTE.MAPCHECK.outside;
this._MAPCHECKInsideEvent = SMTE.MAPCHECK.inside;
this._MAPCHECKOffEvent = SMTE.MAPCHECK.off;
this._MAPCHECKExitOutsideEvent = SMTE.MAPCHECK.leave_outside;
this._MAPCHECKExitInsideEvent = SMTE.MAPCHECK.leave_inside;
this._MAPCHECKExitOffEvent = SMTE.MAPCHECK.leave_off;
SMTE.MAPCHECK.Game_Map_initialize.call(this)
I guess I'm sharing variables around.
Last part of the plugin:
Code:
SMTE.MAPCHECK.Game_Map_setup = Game_Map.prototype.setup;
Game_Map.prototype.setup = function(mapId) {
if (($gamePlayer.newMapId() != $gameMap.mapId()) && ($dataMap.meta.exit_outside || $dataMap.meta.exit_outdoor) && (this._MAPCHECKExitOutsideEvent > 0)) {
$gameTemp.reserveCommonEvent($data_common_events(this._MAPCHECKExitOutsideEvent));
} else
if (($gamePlayer.newMapId() != $gameMap.mapId()) && ($dataMap.meta.exit_inside || $dataMap.meta._exit_indoor) && (this._MAPCHECKExitInsideEvent > 0)) {
$gameTemp.reserveCommonEvent($data_common_events(this._MAPCHECKExitInsideEvent));
} else
if (($gamePlayer.newMapId() != $gameMap.mapId()) && ($dataMap.meta.exit_no_weather || $dataMap.meta.exit_weather_off) && (this._MAPCHECKExitOffEvent > 0)) {
$gameTemp.reserveCommonEvent($data_common_events(this._MAPCHECKExitOffEvent));
}
SMTE.MAPCHECK.Game_Map_setup.call(this, mapId);
if (($gamePlayer.newMapId() == $gameMap.mapId()) && ($dataMap.meta.enter_outside || $dataMap.meta.enter_outdoor) && (this._MAPCHECKOutsideEvent > 0)) {
$gameTemp.reserveCommonEvent($data_common_events(this._MAPCHECKOutsideEvent));
} else
if (($gamePlayer.newMapId() == $gameMap.mapId()) && ($dataMap.meta.enter_inside || $dataMap.meta._enter_indoor) && (this._MAPCHECKInsideEvent > 0)) {
$gameTemp.reserveCommonEvent($data_common_events(this._MAPCHECKInsideEvent));
} else
if (($gamePlayer.newMapId() == $gameMap.mapId()) && ($dataMap.meta.enter_no_weather || $dataMap.meta.enter_weather_off) && (this._MAPCHECKOffEvent > 0)) {
$gameTemp.reserveCommonEvent($data_common_events(this._MAPCHECKOffEvent));
}
};
I have a feeling what I'm trying to do is incredibly simple and can be done in a couple of lines, meanwhile I'm cluttering everything up, but I've really got no idea what's going on here.
Help would really be appreciated - I've pretty much wasted my entire day on this and I still can't get anywhere.