DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
91
Reaction score
36
First Language
English
Primarily Uses
RMMV
These might be super basic, but they helped me out a lot so I wanted to offer them here in case it was helpful to others.

The first tip I got from @caethyril which is that if you are going to use scripts in a movement route, you can put them all in a single script entry in the movement route. I was originally using a different script line for each line of script that I had, but this made the event lag a bit while moving. If you put them all in a single script line separated with ";" it speed up the event considerably.

The second I figured out only recently but made all of the difference for bug-testing. I used to write each bundle of scripts in a text editor and then copy and paste them into the script line, however I found that its much more productive to write the scripts in an IDE (I use visual studio) first. The intellisense and error checking catches a ton of hard to find typos/syntax errors and this cut my development time way down.

A final point is that if you want the scripts in the movement route to run instantly, you have to set the movement speed and frequency to the highest settings, you can then set the movement route back to the desired speed with a little script at the end like this: "this.setMoveSpeed(3); this.setMoveFrequency(5);"

Hope this helps someone!
 
Last edited:

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
6,027
Reaction score
2,360
First Language
Dutch
Primarily Uses
RMMV
another way instead for a very long scriptcall is to create functions
and place those functions in a plugin, than use a super smal scriptcall
Movement1() (depending how you cal the function).

there are ways, but most scriptcalls that are more than 11 lines long,
can be used as a one liner, so it always fit (I do this on a transparancy function
of 30+ lines to 1 line or 3 lines,
but it also work for a function I made made :

function 5x7Roof() {
code here
}

and use the scriptcall 5x7Roof() and it's working :)
this function only helps if you have the plugin inside your project,
this is usefull for personal use, if others don't exacly know what the function
exacly does or how it works :)

but there are also other methodes you can use, but everyone has their own way :)
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
91
Reaction score
36
First Language
English
Primarily Uses
RMMV
Very cool @ShadowDragon, I tried doing that but didn't have much success.

I don't know the exact terminology, but can you use the "this" object designation (referencing the event itself) in a plugin for a movement script?

In other words could I have an event call a script in a plugin that references something like:
"if (this.pos(8, 7)) this.setDirection(8);"

Or would I have to reference the event by name?
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
6,027
Reaction score
2,360
First Language
Dutch
Primarily Uses
RMMV
I dont know the movement scriptcall, so I cant help you on it.
but most movement route calls have a specific calls you can fill out in any way
you need, but in the correct javascript language that is handled in the cores.

someone else might be able to help you on this one, I need to search for those
on how exacly this is done, but the sample I gave above counts, but the code
section is something I need to learn from parts I dont know.

@caethyril might know or any other that has more knowledge than I do :)
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
91
Reaction score
36
First Language
English
Primarily Uses
RMMV
No worries, I was just curious. I've already taken enough of Caethryl's time!
 

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,110
Reaction score
572
First Language
German
Primarily Uses
RMMV
In other words could I have an event call a script in a plugin that references something like:
"if (this.pos(8, 7)) this.setDirection(8);"

Or would I have to reference the event by name?
to adress the MoveSpeed options or other Event stuff , you need something that has access to event_ID..
JavaScript:
$gameMap.event(id)
// OR
Game_Event.prototype.
or another Function that has acces to gamemap event over the event id..
By coincidense i lately worked on something similar, and @caethyril helped me with making the :
Code:
    Game_Battler.prototype.hasMoveSpeedStates = function() {
        return this.states().some(function(state) {
               return state.meta.MoveSpeed_State;
        });
    };
work correctly..
I used this Code to edit a Plugin that was made by boomy for SRPG-..
This Plugin was used to reset the movespeed ,or stepAnim or walkAnim, of an Event..
I edited it in order to be able to not reset if a MoveSpeedState is active..
(to build skills like "slow" and let the map event sprite act slower)
However this Plugin also uses a "Gamebattler Function" that has acces to event ID.. and can use "this" on the Game battler function in order to adress game event stuff
( im not sure if that was a RPG default it could be something from the SRPG_Core)

ill put the plugin here in a spoiler for tutorial purposes, perhaps you might find something helpfull
JavaScript:
//=============================================================================
//SRPG_EventResetAfterAction.js
//=============================================================================
/*:
* @plugindesc Reverts character/unit move speed and stepping/walking animations to default values after an SRPG action
* @author Boomy (edited by dopan)

* @help
* This plugin is plug and play and play
* Requires a Dr_Q plugin such as SRPG_RangeControl.js to give all battlers the event() call such that we can control events based on their battlers
* Works best with SRPG_PositionEffects.js
*
* dopan edit info: Fixed & SRPG_MoveSpeedStates Function included
* NEW State Note = <MoveSpeed_State>
* # this StateNote makes sure that the MoveSpeed will be reseted to the defaut of the EventPage when the state is gone.
*
* NEW ScriptCalls Info:
* ( Usage for States on Active Event ID)
* -$gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]._defaultMoveSpeed = X;
* -$gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]._defaultStepAnime = X;
* -$gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]._defaultWalkAnime = X;
* ( Usage for States on Target Event ID)
* -$gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1]._defaultMoveSpeed = X;
* -$gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1]._defaultStepAnime = X;
* -$gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1]._defaultWalkAnime = X;
*
* These ScripCals will overwrite the default "MoveSpeed" & "StepAnime" & "WalkAnime" to the Number X
* ( use this with the States that have the StateNote : <MoveSpeed_State> )
* => these Scriptcalls can be added with SkillCommon Event or Custom Execution SkillNote
* => these Scriptcalls will be reseted to the default of the EventPage after the State with StateNote <MoveSpeed_State> is gone.
*
* ScriptCalls for usage before Action without State usage:
*
* (this can also be done with SkillDMG Formula. Example: "a.event().setMoveSpeed(x);" or
* "a.event().setStepAnime(x);" or "a.event().WalkAnime(x);" )
* - Following Scriptcalls are for usage on "dash Skils" for Example. Use this instead of using the SkillDMG Formula.
* - these ScriptCalls without State Usage will be reseted after Action from the Plugins: "_defaultMoveSpeed" or
*   "_defaultStepAnime" or "_defaultWalkAnime"
*   (instead of when a State is gone)
*
* ( Usage WITHOUT States on Active Event ID)
* -$gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].event().setMoveSpeed(X);
* -$gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].event().setStepAnime(X);
* -$gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].event().setWalkAnime(X);
* ( Usage WITHOUT States on Target Event ID)
* -$gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1].event().setMoveSpeed(X);
* -$gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1].event().setStepAnime(X);
* -$gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1].event().setWalkAnime(X);
*
* - Use these ScriptCalls with Custom Execution SkillNote in order to happen before the Action
* - This will be reseted to the default of the EventPage after Units Action.
* - If the Units has a "SpeedState" with StateNote <MoveSpeed_State> ,it will be reseted to the "x" Number which was added with "State Usage ScriptCalls"
* ( like explained above the "State Usage ScriptCalls" will be reseted to the default of the EventPage when the State is Gone )
*
* Dopan sideNote:
*  If this Help Info is not Well enough Explained pls ask in RPG Forum for help.( in the SRPG thread )
*
*/


// test edit dopan // store States meta data
    Game_Battler.prototype.hasMoveSpeedStates = function() {
        return this.states().some(function(state) {
               return state.meta.MoveSpeed_State;
        });
    };

// Function Overwrite: Replaces SRPG_core.js method of processing at the start of a units action and inserts a line to store move speed and step animation
    Game_Battler.prototype.srpgMakeNewActions = function() {
        this.clearActions();
        //if (this.canMove()) {
            var actionTimes = this.makeActionTimes();
            this._actions = [];
            for (var i = 0; i < actionTimes; i++) {
                this._actions.push(new Game_Action(this));
            }
        //}

        //Edit store current data
        this._defaultMoveSpeed = this.event()._moveSpeed;
        this._defaultStepAnime = this.event()._stepAnime;
        this._defaultWalkAnime = this.event()._walkAnime;

        this.setActionState('waiting');
    };

// Function Overwrite: Replaces SRPG_core.js method of processing at the end of a units action and inserts a line to reset move speed to be the same as player speed
    var _SRPG_Game_Battler_onAllActionsEnd = Game_Battler.prototype.onAllActionsEnd;
    Game_Battler.prototype.onAllActionsEnd = function() {
        if ($gameSystem.isSRPGMode() == true) {
            this.updateSrpgStateTurns(1);
            this.removeStatesAuto(1);
            this.clearResult();

            //Edit reset character speed
            if (this._defaultMoveSpeed !== undefined) {
                this.event().setMoveSpeed(this._defaultMoveSpeed);
            } else {
                this.event().setMoveSpeed(this.event().page().moveSpeed);
                //dopan Sidenote: this was default and should be deleted//this.event().setMoveSpeed($gamePlayer.realMoveSpeed());
            }
            //Edit: reset default walk animation status
            if (this._defaultWalkAnime !== undefined) {
                this.event().setWalkAnime(this._defaultWalkAnime);
            } else {
                this.event().setWalkAnime(this.event().page().walkAnime);
                //dopan Sidenote: this was default and should be deleted//this.event().setWalkAnime(true);
            }
            //Edit: reset default step animation status
            if (this._defaultStepAnime !== undefined) {
                this.event().setStepAnime(this._defaultStepAnime);
            } else {
                this.event().setStepAnime(this.event().page().stepAnime);
                //dopan Sidenote: this was default and should be deleted//this.event().setStepAnime(true);
            }
            // test edit dopan reset moveSpeed on State Usage
            if ((this.hasMoveSpeedStates == false) && (this._defaultMoveSpeed !== undefined)) {
                 this.event().setMoveSpeed(this.event().page().moveSpeed);
            }
            // test edit dopan reset stepAnime on State Usage
            if ((this.hasMoveSpeedStates == false) && (this._defaultStepAnime !== undefined)) {
                 this.event().setStepAnime(this.event().page().stepAnime);
            }
            // test edit dopan reset walkAnime on State Usage
            if ((this.hasMoveSpeedStates == false) && (this._defaultWalkAnime !== undefined)) {
                 this.event().setWalkAnime(this.event().page().walkAnime);
            }

        } else {
            return _SRPG_Game_Battler_onAllActionsEnd.call(this);
        }
    };

Like i mentioned this Plugin is for SRPG only ,it wont work on normal rpg projects, but the main part of the Code could be inserted in selfmade other functions..
in the case of the Plugin the gamebattler can use following Scriptcall to access event id stuff:

this.event().setMoveSpeed(this.event().page().moveSpeed);
thats from Game_battler,this would need a "$gameMap.event(id)" OR "Game_Event.prototype."- Function by default..

also you can find more info related to that in the RPG Objects.. there you can find other things aswell that can be changed/adressed on an Event
Screenshot_5.png
 
Last edited:

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
91
Reaction score
36
First Language
English
Primarily Uses
RMMV
Wow @Dopan this is great stuff here thanks so much for it! I'm going to have to dig deeper into this to see if I can make it work for my own project.

I don't really know how to use the game prototype objects yet. Can you recommend a resource to learn how to use it?

For example: I wanted to turn of the "blinking" damage effect in combat which I think is here below in the RPG Sprites file, but I'm not sure how to override this for a specific Battler. I assume that I have to create a new prototype object in a plugin and then somehow call that to override this one but I'm not really sure how.

1605025851475.png
 

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,110
Reaction score
572
First Language
German
Primarily Uses
RMMV
Wow @Dopan this is great stuff here thanks so much for it! I'm going to have to dig deeper into this to see if I can make it work for my own project.

I don't really know how to use the game prototype objects yet. Can you recommend a resource to learn how to use it?

For example: I wanted to turn of the "blinking" damage effect in combat which I think is here below in the RPG Sprites file, but I'm not sure how to override this for a specific Battler. I assume that I have to create a new prototype object in a plugin and then somehow call that to override this one but I'm not really sure how.

View attachment 167372
well i have to admit that i am to nooby myself to give proper advice and correct explanations.
The most things i know are from studying the SRPG Core plugin
and the best help and explanations i got (in Case it wasnt about SRPG related code only) came from caethyril ^^

However the first things i learned on my own was using and adding Switches in order to break nothing and get a walkaround that works for my needs..

And i think in your case you could add a $GameSwitch aswell in order to Enable and Disable " the blinking " ..

JavaScript:
case 'blink':
                if ($gameSwitches.value(Switch_ID)===false) {
                    this.startBlink();
                };
                break;

if you replace the case blink with this Code it will only Blink if the Switch with the Switch ID you used is FALSE.
Making the Switch true will disable it^^
this can be used in a lot of situations, as long you can find the right timing to set the Switch true and reset it afterwards..

in my Case (SRPG) i just use mostly Common Event and YEP skillCore "custom execution" Skillnote for the timing but there are always ways to change a switch^^


Edit
also the Code you showed on IMG,seems to be only for enemys,if you want that for actors aswell you will have to find the actors function aswell
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,815
Reaction score
2,873
First Language
EN
Primarily Uses
RMMZ
Maybe a little off-topic, but I've used this kind of approach before to disable blink and other effects:
JavaScript:
(function(alias) {
  Sprite_Enemy.prototype.startEffect = function(effectType) {
    if (effectType !== 'blink') alias.apply(this, arguments);
  };
})(Sprite_Enemy.prototype.startEffect);
I.e. "if the effect type is not 'blink' then start the effect as normal, otherwise do nothing". :)

I have a plugin that focuses on disabling specific effects on tagged enemies using this approach. Link in case you're interested: view/download Cae_DisableBattlerFX (Google Drive).
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
91
Reaction score
36
First Language
English
Primarily Uses
RMMV
This is great. Exactly what I needed to turn off the blinking in my battler, thanks!
 

Latest Threads

Latest Posts

Latest Profile Posts

I'M BACK BABEY!!!
College is hitting me a lil' softer than I expected, so I'm back on MV!
And to kick things off, here's a lil' test of a tileset edit I made today! (Took me, like, 5 hours, considering this was the first time I've EVER used GraphicsGale...)Edit test SUCCESS.PNG
Red_1,png.PNG
I don't know when I'll have time to finish this, so I'll post this mostly complete version now. Another major character of my project, his name is Red (at least until I can think up a better R-name). In case he looks familiar, it's because his design (and personality) is based directly from my favorite anime character of all time (who is, unfortunately, fairly obscure).
Here's a showcase of layers of visual effects I've added over a scene. By stripping them off, one by one. :kaoblush:












Aaaaand, here's me working on the above scene, adding weather effects to it: :kaoeh:


Forum statistics

Threads
124,591
Messages
1,164,627
Members
163,416
Latest member
lucster10
Top