first text
I want to make a mini Plugin for the SRPG engine.This plugin should replicate a "Force Action" on Map without "SV battles".
In my Case the SRPG engine allready uses a Plugin that enables *MapBattle"true"*.
Thats why i need to use 1 function which is "Scene_Map.prototype" and its somehow needed to trigger it with "this"..
(thats how other SRPG plugins do it).
Here is the experimental Plugin Code for better Explanation:
(this wont work correctly)
I also tried to build this direcktly into a "Scene_Map.prototype" and not using "Game_Interpreter.prototype" with this experimental Plugin Code:
..and using this as Scriptcall :
But i realized that i dont know how exactly "Scene_Map.prototype" works..
-> this Scriptcall(Example 2) will work, but it will somehow store data and make strange Functions, if used later serveral times in several Situations.
( for example using Multiple Attacks ect)
=> i think i need to create a "Scene_Map.prototype.srpgMapForceAction" ,and to be able to update it, with data that is inserted with a ScriptCall ,an reset it after Usage.But i dont know how to do this.
The Goal is to have a ScriptCall, that can be Used similar like the ScriptCall: "user[1].forceAction(skillId, target[1]);"
Thx in advance
In my Case the SRPG engine allready uses a Plugin that enables *MapBattle"true"*.
Thats why i need to use 1 function which is "Scene_Map.prototype" and its somehow needed to trigger it with "this"..
(thats how other SRPG plugins do it).
Here is the experimental Plugin Code for better Explanation:
(this wont work correctly)
Code:
//"this.isMapForceAction(userId, targetId, skillId, payCost);"
//Scene_Map.prototype.srpgMapForceAction = function() {
Game_Interpreter.prototype.isMapForceAction = function(userId, targetId, skillId, payCost) {
var user = $gameSystem.EventToUnit(userId);
var target = $gameSystem.EventToUnit(targetId);
if ((!user[1].isDead()) && (!target[1].isDead())) {
$gameTemp.setActiveEvent($gameMap.event(userId));
$gameTemp.setTargetEvent($gameMap.event(targetId));
$gameTemp.setShouldPayCost(payCost);
$gameSystem.forceSRPGBattleMode('map');
user[1].forceAction(skillId, target[1]);
$gameSystem.setSubBattlePhase('invoke_action');
//this.srpgBattleStart(user, target); // this is the "Scene_Map.prototype" Function
var action = user[1].currentAction();
user[1].useItem(action.item());
}
};
//};Code:
//"Scene_Map.prototype.srpgMapForceAction(userId, targetId, skillId, payCost);"
Scene_Map.prototype.srpgMapForceAction = function(userId, targetId, skillId, payCost) {
var user = $gameSystem.EventToUnit(userId);
var target = $gameSystem.EventToUnit(targetId);
if ((!user[1].isDead()) && (!target[1].isDead())) {
$gameTemp.setActiveEvent($gameMap.event(userId));
$gameTemp.setTargetEvent($gameMap.event(targetId));
$gameTemp.setShouldPayCost(payCost);
$gameSystem.forceSRPGBattleMode('map');
user[1].forceAction(skillId, target[1]);
$gameSystem.setSubBattlePhase('invoke_action');
this.srpgBattleStart(user, target);
var action = user[1].currentAction();
user[1].useItem(action.item());
}
return true
};Code:
Scene_Map.prototype.srpgMapForceAction(userId, targetId, skillId, payCost);
//Example:
Scene_Map.prototype.srpgMapForceAction(9, 28, 1, true);
//this will forceAction, with "user"(event id 9 ),"target"(event id 28 ),..
//..,using "Skill 1" with "PayCost"= true.But i realized that i dont know how exactly "Scene_Map.prototype" works..
-> this Scriptcall(Example 2) will work, but it will somehow store data and make strange Functions, if used later serveral times in several Situations.
( for example using Multiple Attacks ect)
=> i think i need to create a "Scene_Map.prototype.srpgMapForceAction" ,and to be able to update it, with data that is inserted with a ScriptCall ,an reset it after Usage.But i dont know how to do this.
The Goal is to have a ScriptCall, that can be Used similar like the ScriptCall: "user[1].forceAction(skillId, target[1]);"
Thx in advance
I think i solved a few Issues but i still could need help in understanding how "Scene_Map.prototype" works..
the current "Version" of the Plugin is this:
experimental Plugin
Code:
//=============================================================================
// SRPG_MapForceAction.js
//=============================================================================
/*:
* @plugindesc v1.0 Adds <SRPG_MapForceAction> ScritCall to SRPG
* @author dopan
*
*
*
*
*
*
* @param Blank_Skill ID
* @desc Skill ID: ID of the Blank Skill that is used in the "this.isCreateMapForceAction();"-ScriptCall
* @type skill
* @default 1
*
*
*
* @help
*
* This Plugin helps to replicate the "force Action" Function for skills in: MapBattle"True" BattleMode.
* the Plugin ScriptCall will activate a "force Action" on Map without using "SV battleMode"
* Note: the Plugin is still experimental pls report any Bugs or Issues u might find.
*
* -> the "SkillAction" from this ScriptCall, wont work with a Skill that uses "minRange" or if,
* the Target is Outside of SkillRange from the User-position.It will also trigger Counters,
* if the added Skill would do that (ignoring range on counters).
*
*
*
* Plugin Scriptcalls:
*---------------------
*-------------------------------------------------------------------------------------------------------
*-------------------------------------------------------------------------------------------------------
* - "this.isMapForceAction(userId, targetId, skillId, payCost);"
*-------------------------------------------------------------------------------------------------------
*-------------------------------------------------------------------------------------------------------
* Example : "this.isMapForceAction(9, 28, 1, true);"
*
* => this will forceAction, with "user"(event id 9 ),"target"(event id 28 ),using "Skill 1" with "PayCost"= true
*
* => there is an Example for this in the Updated-SRPG_demo
*-------------------------------------------------------------------------------------------------------
*-------------------------------------------------------------------------------------------------------
* - "this.isMapForceActionNote(userId, targetId, skillId, payCost);
*-------------------------------------------------------------------------------------------------------
*-------------------------------------------------------------------------------------------------------
* Example : "this.isMapForceAction(9, 28, 1, false);"
*
* => this will add a second attack if used in a Custom Ex SkillNoteTag ,..
* .. with "user"(event id 9 ),"target"(event id 28 ),using "Skill 1" with "PayCost"= false
*
* => I advive to use the Following ScriptCall instead of using numbers on "user" and "target":
*
* var user = $gameTemp.activeEvent().eventId();
* var target = $gameTemp.targetEvent().eventId();
*
* this.isMapForceActionNote(user, target, 11, false); // Skill 11 as another example
*
* => However this can be used in different ways it will add the Action but without a battlestart,...
* ..so the action will happen as soon there is a battlestart.
*
* => there is an Example for this in the Updated-SRPG_demo
*-------------------------------------------------------------------------------------------------------
*-------------------------------------------------------------------------------------------------------
* - "this.isCreateMapForceAction();"
*-------------------------------------------------------------------------------------------------------
*-------------------------------------------------------------------------------------------------------
* => use this Scriptcall one time at the Start of a battle. Its a not very elegant walkaround,
* that should make the other Scriptcalls work properly and must be used till i found a better solution.
*
* => this make sure that the First action that happens is an action from this plugin,i dont know exactly why,
* but this has to happen in order to let the "Scene_Map.prototype;" of this Plugin work properly..
*
* => there is an Example for this in the Updated-SRPG_demo
*
*
*
* Known Issue:
* -> 1 Action from this Plugin Must happen at battleMap start, that means there will be a delay,
* and a pre&post Action Phase.. This issue is nothing gamebreaking and can be handled ,
* but i will try to find a better solution in the Future..
* ( at this moment i just dont know enough about JS and "Scene_Map.prototype;" to solve it properly.)
*
*
* ============================================================================
* Terms of Use
* ============================================================================
* Free for any commercial or non-commercial project!
* (edits are allowed but pls dont claim it as yours without Credits.thx)
* ============================================================================
* Changelog
* ============================================================================
* Version 1.0:
* - first Release 01.09.2020 for SRPG (rpg mv)!
*/
(function() {
// Plugin param Variables:
var parameters = $plugins.filter(function (plugin) { return plugin.description.contains('SRPG_MapForceAction'); });
var parameters = PluginManager.parameters("SRPG_MapForceAction");
var _blankSkill = Number(parameters['Blank_Skill ID'] || 0);
var _mapForceUserNote = 1 || userNoteId;
var _mapForceTargetNote = 1 || targetNoteId;
var _mapForceSkillNote = 1 || skillNoteId;
var _mapForceUser = 1 || userId;
var _mapForceTarget = 1 || targetId;
var _mapForceSkill = 1 || skillId;
var _mapForcePayCost = 'true' || 'false' || payCost;
var _sceneMapProto = Scene_Map.prototype;
//-----------------------------------------------------------------------------------------
//Plugin ScriptCalls:
//"this.isMapForceAction(userId, targetId, skillId, payCost);"
Game_Interpreter.prototype.isMapForceAction = function(userId, targetId, skillId, payCost) {
_mapForceUser = userId;
_mapForceTarget = targetId;
_mapForceSkill = skillId;
_mapForcePayCost = payCost;
_sceneMapProto.srpgMapForceAction();
};
//"this.isMapForceActionNote(userId, targetId, skillId, payCost);"
Game_Interpreter.prototype.isMapForceActionNote = function(userNoteId, targetNoteId, skillNoteId, payCost) {
_mapForceUserNote = userNoteId;
_mapForceTargetNote = targetNoteId;
_mapForceSkillNote = skillNoteId;
_mapForcePayCost = payCost;
_sceneMapProto.srpgMapForceActionNote();
};
//"this.isCreateMapForceAction();"
Game_Interpreter.prototype.isCreateMapForceAction = function() {
_sceneMapProto.srpgCreateMapForceAction();
};
//Plugin Function:
var _srpgCreateMapForceAction = Scene_Map.prototype.srpgCreateMapForceAction;
Scene_Map.prototype.srpgCreateMapForceAction = function() {
if ($gameSystem.isSRPGMode()) {
var lastUnit = $gameSystem._EventToUnit.length - 1;
var user = $gameSystem.EventToUnit(lastUnit);
var target = $gameSystem.EventToUnit(lastUnit);
if ((!user[1].isDead()) && (!target[1].isDead())) {
$gameTemp.setActiveEvent($gameMap.event(lastUnit));
$gameTemp.setTargetEvent($gameMap.event(lastUnit));
$gameSystem.forceSRPGBattleMode('map');
user[1].forceAction(_blankSkill, target[1]);
$gameSystem.setSubBattlePhase('invoke_action');
_sceneMapProto.srpgBattleStart.call(this, user, target);
}
}
return true;
};
var _srpgMapForceAction = Scene_Map.prototype.srpgMapForceAction;
Scene_Map.prototype.srpgMapForceAction = function() {
if ($gameSystem.isSRPGMode()) {
var user = $gameSystem.EventToUnit(_mapForceUser);
var target = $gameSystem.EventToUnit(_mapForceTarget);
if ((!user[1].isDead()) && (!target[1].isDead())) {
$gameTemp.setActiveEvent($gameMap.event(_mapForceUser));
$gameTemp.setTargetEvent($gameMap.event(_mapForceTarget));
$gameTemp.setShouldPayCost(_mapForcePayCost);
$gameSystem.forceSRPGBattleMode('map');
user[1].forceAction(_mapForceSkill, target[1]);
$gameSystem.setSubBattlePhase('invoke_action');
_sceneMapProto.srpgBattleStart.call(this, user, target);
}
}
return true;
};
var _srpgMapForceActionNote = Scene_Map.prototype.srpgMapForceActionNote;
Scene_Map.prototype.srpgMapForceActionNote = function() {
if ($gameSystem.isSRPGMode()) {
var user = $gameSystem.EventToUnit(_mapForceUserNote);
var target = $gameSystem.EventToUnit(_mapForceTargetNote);
if ((!user[1].isDead()) && (!target[1].isDead())) {
$gameTemp.setActiveEvent($gameMap.event(_mapForceUserNote));
$gameTemp.setTargetEvent($gameMap.event(_mapForceTargetNote));
$gameTemp.setShouldPayCost(_mapForcePayCost);
$gameSystem.forceSRPGBattleMode('map');
user[1].forceAction(_mapForceSkillNote, target[1]);
_sceneMapProto.srpgBattleStart.call(this, user, target);
}
}
return true;
};
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
//--End:
})();-atm i can use 3 scriptCalls:
->"this.isMapForceAction(userId, targetId, skillId, payCost);"
will forceAction on Map if no other action is currently happen
(can not be used in Custom Ex skillNotetags!)
->"this.isMapForceActionNote(userId, targetId, skillId, payCost);"
will add a Note to forceAction on another Action that happens
(can be used in Custom Ex skillNotetags!)
->"this.isCreateMapForceAction();"
this is needed to make sure that the Plugin makes the first action..
.. its a self action of the last unit,this causes extra Issues.
But its the only walkaround i could find in order to make the plugin work correctly
The left "Issues" i got:
-the SelfAction from "this.isCreateMapForceAction();",..
..will also make a little delay and trigger a Pre&PostAction Phase ect.
=>its not Gamebreaking and can be handled ,but i would preffer to find a better solution..
Edit 2
Thread can be closed, its not perfect but the current Version is working,anyone who has an Idea to solve it better can message me in Private. thx