JavaScript questions that don't deserve their own thread

Motochi

Villager
Member
Joined
Nov 4, 2019
Messages
10
Reaction score
7
First Language
English
Primarily Uses
RMXP
Lol i doubt that people even know what "Alistair's Mana Barrier" is, when you just asked like that
 

Blazatryx

Warper
Member
Joined
Jul 7, 2019
Messages
3
Reaction score
1
First Language
English
Primarily Uses
RMMV
I'm playing around with Olivia's Octopack system. I'm trying to move the enemy's name/HP/weakness/shield icons from underneath the monster sprites so I can position them better. I figured out how to move them in the JavaScript files, but it seems like I can only move them them a certain amount of distance away from the sprites before they start getting cut off. As you can see here (), I've moved the stats to the left of the screen, but when I try moving the enemy names up, it's getting cut off. If I were to try to move them any further to the left from the sprites, they'd start to get cut off too, so I had to move the monster sprites to that position.

Ideally I would want to place them in one of the corners, in the same way the actor stats are listed. Is this at all possible? Worth noting that I'm very much a JavaScript newbie. I can just about read and understand what some functions do (thanks to some time messing with Game Maker Studio) but writing them from scratch is above my knowledge level right now.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,651
Reaction score
2,978
First Language
Tagalog
Primarily Uses
@BloodletterQ - please define what is "Alistair's Mana Barrier". Explain in full what it does and how it is to be used.

@Blazatryx since it involves a specific plugin, better ask in the thread of the plugin itself or in a new thread. Anyway, its most probably because the Sprite Object in which the window is drawn is made only to begin at the character's position, so when you tried to move the window outwards, it then becomes out of the bounds of its sprite object. You should find in that script where it creates the sprite object where the window is drawn and adjust that one too. But yeah please post a new thread for it because it involves a specific plugin.
 

Boonty

Veteran
Veteran
Joined
Oct 10, 2018
Messages
48
Reaction score
20
First Language
French
Primarily Uses
RMMV
Hey guys, could you help me out ?

I want to permanenlty change the stateRate of one of my heroes to make him immune with javascript formula. I am quite lame so I tried this :

$gameActors.actor(3).stateRate(19) = 0
But it didn't work. What it the correct formula ?
 

Blazatryx

Warper
Member
Joined
Jul 7, 2019
Messages
3
Reaction score
1
First Language
English
Primarily Uses
RMMV
I'm trying to make a state that reacts differently depending on if an actor's skill is targeting one enemy or multiple enemies. For instance:

if (skill targets one enemy)
add an extra action for the player
if (skill targets multiple enemies)
add an extra action and increase next turn's attack power by x1.5

I'm just struggling to find the code I would need for the if conditions. Is it possible?
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
359
Reaction score
184
First Language
English
Primarily Uses
RMMV
Hey guys, could you help me out ?

I want to permanenlty change the stateRate of one of my heroes to make him immune with javascript formula. I am quite lame so I tried this :



But it didn't work. What it the correct formula ?
Because state rate is derived from traits you can't just set it as a number. I'd advise finding a dynamic traits plugin and adding a 0% stateRate trait to the actor using that - I've used Shaz's in the past but there are others out there.

I'm trying to make a state that reacts differently depending on if an actor's skill is targeting one enemy or multiple enemies. For instance:

if (skill targets one enemy)
add an extra action for the player
if (skill targets multiple enemies)
add an extra action and increase next turn's attack power by x1.5

I'm just struggling to find the code I would need for the if conditions. Is it possible?
I would approach this using

Code:
[1, 3].contains(skill.scope) //for 1 enemy
[2, 4, 5, 6].contains(skill.scope) //for multiple enemies
You'll need to replace "skill" with a reference to the database skill, what you use though depends largely on how and when you're actually executing this code. Are you using a plugin (if so, which one) or writing one?
 

Boonty

Veteran
Veteran
Joined
Oct 10, 2018
Messages
48
Reaction score
20
First Language
French
Primarily Uses
RMMV
@Silva

Thanks for your answer. I effectively solved my problem with Galv Dynamic Traits plugin.
 

misnina

Warper
Member
Joined
Nov 16, 2019
Messages
1
Reaction score
0
First Language
English
Primarily Uses
RMMV
EDIT: Use your IDE that checks for your errors even if it takes longer to run kids! Cause it was me just making really small mistakes my lightweight editor didn't catch before it didn't compile at all.

Original: I'm missing some kind of super basic thing and I don't know what it is. This is my first plugin and the game fails to recognize it beyond the help text. I put in some stuff to make it error everywhere and it did nothing. I'm convinced it's just not reading it, and I've compared it to other scripts, started fresh projects, and nothing will happen when I do the plugin command.

So here's the code, sans the errors I was trying to make happen.
 
Last edited:

JosephSeraph

White Mage
Restaff
Joined
Mar 7, 2014
Messages
894
Reaction score
765
First Language
Portuguese
Just a random question I don't think it's worth making a thread over: I have a feeling Yanfly's Battle Engine Core doesn't allow us to have Cast Animations on front view mode + Battle Status Window? Are Cast Animations locked to sideview only? I've tried a few different setups to no avail.
Does anyone have any info on this?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,041
Reaction score
10,273
First Language
Czech
Primarily Uses
RMMV
I think so. Cast animations don't make too much sense in front view anyway, since there's not really a viable way to make them appear without it looking awkward.
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
965
Reaction score
707
First Language
English
Primarily Uses
RMMV
@JosephSeraph Yeap, the cast animations added by YEP Battle Engine Core are side view only.

Code:
// Line 2725 YEP_BattleEngineCore
if (!$gameSystem.isSideView() && this._subject.isActor()) return true;
 

JosephSeraph

White Mage
Restaff
Joined
Mar 7, 2014
Messages
894
Reaction score
765
First Language
Portuguese
Awesome, thanks for being so quick to reply and so on point. Of course I tried to pull the smarties and just erase "!$gameSystem.isSideView() &&" from the code; that did predictably not work, although it surprisingly also didn't break the game.

Cast animations don't make too much sense in front view anyway, since there's not really a viable way to make them appear without it looking awkward.
I'd argue cast animations are more important in frontview than they are in sideview in terms of communicating who is acting, because sideview at least does let the current actor step forward and pose. On frontview, the casting animation should display on the character's face when using Battle Status Window, which is how I believe it behaved on Ace; it's understandable that it doesn't now though since Battle Core and Battle Status are no longer the same thing.

Still, I find it to be quite disorienting to have no way to tell who acted, especially when using an ATB / charge time system, for example.
Slapping Victor Sant's cast animations on top seems to kinda work...

Also, and I think this is probably common knowledge, but Flashes don't work on the faceset sprites either (and that's likely just because they're not the actual target of the animations, rather the animations are probably playing on an invisible object / battler)

Speaking of flashes, a simple flash would go a long way in making which actor moved more easy to read. But yeah, that might become something more like a plugin request and not this thread. Woop!
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,041
Reaction score
10,273
First Language
Czech
Primarily Uses
RMMV
There's always the battle log ;)
 

Oracle-Raven

Villager
Member
Joined
Feb 2, 2016
Messages
10
Reaction score
2
First Language
French (Canada)
Primarily Uses
I'm sure the answer is obvious, but I've searched and didn't find anything.
By default, RPG Maker MV lists the base parameters in the following order:
HP, MP, Attack, Defense, Magic Attack, Magic Defense, Agility, Luck
But how can I reorder them like this instead?
HP, MP, Defense, Magic Defense, Attack, Agility, Magic Attack, Luck

I've started a new project for testing purposes, and I'm using Yanfly's YEP_CoreEngine v1.31, YEP_BaseParamControl v1.04, YEP_X_ClassBaseParam v1.05, and YEP_StatusMenuCore v1.04
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
359
Reaction score
184
First Language
English
Primarily Uses
RMMV
It largely depends on where you want to re-order them.

If you mean in the editor, you can't.
If you mean how things like $gameActors.actor(1).param(1) works, you'll need to rewrite how all the functions used within this function retrieve their values.
If you mean how they're displayed in menus you'll need to rewrite how the window draws its content.

You'll need to be more specific about what you want before we can give you a proper explanation on how/if you can do this.
 

Oracle-Raven

Villager
Member
Joined
Feb 2, 2016
Messages
10
Reaction score
2
First Language
French (Canada)
Primarily Uses
If you mean how they're displayed in menus you'll need to rewrite how the window draws its content.
Yep, that part is what I meant, sorry if I wasn't clear enough. Basically what the player sees when they open the Status menu or Equip menu.
Any pointers about what I should modify or be trying to look for?
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
359
Reaction score
184
First Language
English
Primarily Uses
RMMV
For the equip window you'll have to rewrite the function Window_EquipStatus.prototype.refresh. The default is this:

Code:
Window_EquipStatus.prototype.refresh = function() {
    this.contents.clear();
    if (this._actor) {
        this.drawActorName(this._actor, this.textPadding(), 0);
        for (var i = 0; i < 6; i++) {
            this.drawItem(0, this.lineHeight() * (1 + i), 2 + i);
        }
    }
};
What this is doing is drawing every parameter from numbers 2-7 in order. The line we're interested in is "this.drawItem(....". If you refer to the function Window_EquipStatus.prototype.drawItem you can see what each of the parameters actually are. You have 2 solutions for solving this, you can either remove the for loop and write out the drawItem functions individually, or you can create an array to hold the order the params will be written in. For simplicity I'll show you the latter.

Code:
Window_EquipStatus.prototype.refresh = function() {
    this.contents.clear();
    if (this._actor) {
        this.drawActorName(this._actor, this.textPadding(), 0);
        var order = [2, 4, 3, 6, 5, 7];   //create an array with the order we want parameters to show in
        for (var i = 0; i < 6; i++) {
            this.drawItem(0, this.lineHeight() * (1 + i), order[i]); //retrieve the appropriate value from the above array
        }
    }
};
Note - I've just used a random order for the parameters, you'll need to shuffle them around inside the array to suit your needs.

I would advise saving the above code snippet as a .js file using a text editor and adding it to your game as a plugin as opposed to messing with the existing code. This will overwrite the function but means you can easily revert the change if there's any mistakes by removing the plugin.

This approach can be used for adjusting within the status windows too. As you're using Yanfly's StatusMenuCore you'll need to look for the function that's drawing the parameters within that plugin's code and overwrite that in a similar manner.
 

Oracle-Raven

Villager
Member
Joined
Feb 2, 2016
Messages
10
Reaction score
2
First Language
French (Canada)
Primarily Uses
Thank you very much Silva! This is exactly what I needed!
It is very much appreciated! :kaocry:
 

Indinera

Indie Dev
Veteran
Joined
Mar 13, 2012
Messages
1,783
Reaction score
746
First Language
French
What part to edit to alter the default selling price of items and equipment?
 

Papillon

Veteran
Veteran
Joined
Feb 22, 2017
Messages
54
Reaction score
8
First Language
English
Primarily Uses
RMMV
Probably going about this wrong, but is there any way to delay a SceneManager.pop(); call?
I'm trying to make an animation that occurs when a menu is closed but it's skipped over when I call the pop command.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Wasting so much time trying to get a sprite behavior to work. I feel like banging my head against a wall.
Well... it’s been a real pain in the IRS today. :/
My kitty still young (3-4 months), I think I could teach her some funny tricks... like: "Play dead-ly good music for my games"
Here's a quality DPS class idea: The Beekeeper, who uses the "Bees!!" skill to attack and poison enemies.
Please don't create long, boring cutscenes in which characters do nothing but stand around talking.

Forum statistics

Threads
94,274
Messages
919,553
Members
123,997
Latest member
Xafir
Top