ZakRew

Villager
Member
Joined
Aug 3, 2019
Messages
7
Reaction score
2
First Language
Russian
Primarily Uses
RMMV
Hello everyone! I tried so many times to learn scripting in RPGM but unsuccesful.. Or tutorials are bad, or I'm stupid idk...
Can someone help me to find a script?

Script mechanic:
Me
: Choose which states must be counted (poisoned, sleep, paralyze etc.)
Counter: Starts counting this states from moment when I press in Title Screen "New Game"
Counter Complete: When counter counts to needed points - Actor learns skill

Ex.:
1. Counting Poisoned state to 200
2. Actor in battles gets a poisoned state many times...
3. In any battle when counter reach "200 times get poisoned state" Actor get skill "blah-blah (skillId)"
4. Counter for that state stopped.

I nearly understand an algorithms but with syntaxis and at all with scripting I'm freaking bad. I wrote some ****ty code by tutorials and U can laugh so loud if opened a spoiler.

(function() {
var params = PluginManager.parameters('StateCounter');
var stateId = Number(params["State ID"]);
var counter = Number(params["Counter"])
var target = $gameActors.actor(1);
target.addState(params["State ID"]);

if (!stateId && target.stateId()){
counter = counter + 1;

}
if (counter = 2) {
actor.learnSkill(6);
}
})();

I hope u'll help me with it. Even if u send me in answers good tutorials that can help me - It'll be awesome!
Waiting for answers and..
the force will be with you!
 

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
154
Reaction score
130
First Language
German
Primarily Uses
RMMV
I haven't actually tested this, so it may as well set your game on fire, but my initial attempt would be something like this:
JavaScript:
//=============================================================================
// Game_Battler
//=============================================================================
var original_addNewState = Game_Battler.prototype.addNewState;

Game_Battler.prototype.addNewState = function(stateId) {
    original_addNewState.call(this, stateId);

    if (this.isActor()) {
        if(this._myStateCountArray[stateId] >= 200) {
            this.learnSkill(stateId);
        }
        else {
            this._myStateCountArray[stateId]++;
        }
    }
};

//=============================================================================
// Game_Actor
//=============================================================================
var original_initMembers = Game_Actor.prototype.initMembers;

Game_Actor.prototype.initMembers = function() {
    original_initMembers.call(this);
    this._myStateCountArray = [];
};

For simplicity's sake the actor will simply learn the skill with the same id as the state had. You could of course expand that either by performing math with the stateId (for example learn the skill with the ID equal to the stateId + 50 or something) or even by defining in an array which state should map to which skill on an individual basis.

Good luck with your learning javascript endeavor.
 

ZakRew

Villager
Member
Joined
Aug 3, 2019
Messages
7
Reaction score
2
First Language
Russian
Primarily Uses
RMMV
Thanks for the answer) I'll try to analyze this code and understand what the different parts of the code are doing)
 

xabileug

Veteran
Veteran
Joined
Jul 1, 2014
Messages
364
Reaction score
101
you could use yanflys autostate, everytime that state is applied, a variable increases, then when variable is 200, run common event
 

ZakRew

Villager
Member
Joined
Aug 3, 2019
Messages
7
Reaction score
2
First Language
Russian
Primarily Uses
RMMV
you could use yanflys autostate, everytime that state is applied, a variable increases, then when variable is 200, run common event
This plugin is YEP_AutoPassiveStates?
 

Latest Threads

Latest Posts

Latest Profile Posts

SF_People3_5 added!
index.php

Marketing seems to be about reducing dependence on luck to sell a product, as well as expanding the number of avenues in which luck can play a role in selling a product.
So, I've been wanting to do this randomized logic puzzle in my game for years now. I finally figured out how to do it by using arrays and a few small script calls. It's based on the Einstein Fish Puzzle! :D Though, I have no idea how to actually have the player put in answers.... might start a thread about it.

The projectiles shown in this video are as follows:
1, Basic Triple
2, 30-Degree Arc
3, Randomized Blast Wave
4, 8-way
5, 8-way Double
6, 8-way Slowness
7, 120-Degree Arc Repetitive
8, Projective Triple
9, Split 8-way
10, 2-way Split Randomized Arc
11, HP-MP Split Arc
12, Split Laser
13, Shock
14, Cosine
Drop shadows and water reflections tests in RPG Maker VX Ace


BgI3F80.png

Forum statistics

Threads
118,630
Messages
1,117,429
Members
155,719
Latest member
ElRuby
Top