JavaScript questions that don't deserve their own thread

Expa0

Villager
Member
Joined
Oct 7, 2015
Messages
7
Reaction score
0
First Language
English
Hello, I need a bit of help here, In RPG Maker MV I'm trying to create a part where a turret of sorts is shooting projectiles in 4 directions and if the player touches it the event plays (player takes damage). I've set it so that the players x & y location are saved in Variables 21 and 22 respectively. And a single parallel process with a script is checking if the player comes in contact with any of the projectiles.

Now I can get it to work with a single projectile like so:
$gameMap.event(3)._x == $gameVariables.value(21) && $gameMap.event(3)._y == $gameVariables.value(22)

But I get confused when I try to add more events in that, I checked javascript tutorials and it says that the code for OR command is "||" so I figured in this case for two projectiles I would set it up like this:
$gameMap.event(3)._x || $gameMap.event(4)._x == $gameVariables.value(21) && $gameMap.event(3)._y || $gameMap.event(4)._y == $gameVariables.value(22)

IIt doesn't seem to work though, the player keeps starts taking damage as soon the game starts whether or not he's touching the event or not.

My knowledge at scripting is near non existant, so I really can't figure out what I'm doing wrong.

E: I realized what I was doing wrong.
 
Last edited:

IAmJakeSauvage

Veteran
Veteran
Joined
Dec 4, 2015
Messages
418
Reaction score
671
First Language
English
Primarily Uses
RMMV
Hey guys,

I need to figure out how to space the class so that it's not squished like that and how to have the HP/MP gauges fit to fill the window. How would I go about doing that? I've looked around in rpg_window and can't seem to figure it out. :kaoeh:
Space Columns.png
 

Bonkers

I haven't seen you since the plague.
Restaff
Joined
May 26, 2013
Messages
2,941
Reaction score
2,901
First Language
English
Primarily Uses
RMMV
Really quick question, can Yanfly Class Parameters have a variable in the formula for any of the parameter calculations like:

<Custom Class Parameters>
maxhp = 40 * $gameVariable(x);
</Custom Class Parameters>

And if not, how do I enable it to do so?
 

Fomar0153

Arkz
Restaff
Joined
Mar 13, 2012
Messages
1,326
Reaction score
492
First Language
English
Primarily Uses
RMMZ
Try something like:
Code:
<Custom Class Parameters>
maxhp = 40 + $gameVariables.value(1);
</Custom Class Parameters>

Also if you update a variable I don't think it'll get picked up by the plugin straight away, you might want to call something like:
Code:
$gameParty.members().forEach(function(member) {
member.refresh();
});
 

sciencewarrior

Overzealous Technician
Member
Joined
Oct 15, 2017
Messages
22
Reaction score
7
First Language
Portuguese
Primarily Uses
RMMV
I was wondering how I could (mis)use Yanfly's Limited Skill Uses or Skill Cost Items plugins to create a D&D Mage grimoire system, i.e. one where your casters have a "loadout" of spells with a limited number of uses, rechargeable when they sleep. How much of a headache would it be to develop the UI to let the player customize their grimoires, like Baldur's Gate?

Alternatively, I could just let players cast any X spells of each level between rests, essentially like the Sorcerer class. What would be the simplest way to implement this version?
 

aljoka

Warper
Member
Joined
Oct 15, 2017
Messages
1
Reaction score
0
First Language
Bulgarian
Primarily Uses
RMMV
Hello,

I'm new here and I'm not sure that this is the right place to ask this. I want to produce a passive State that will make one of my heroes pre-counter enemy attacks. For the purpose I'm using:

YEP CoreEngine
YEP BattleEngineCore
YEP AutoPassiveStates
YEP BuffsStatesCore
YEP_X_PassiveAuras

I've created a State that is added to all of my party members via an aura. It's based on this:


Here is the code of my state. I'm using YEP BuffStatesCore Lunatic Mode – Custom Action Effects.

<Custom Select Effect>
// I want only my actor (2) to counter
var whoCounters = $gameParty.members().indexOf($gameActors.actor(2));
//This takes the index of the enemy which will be countered
var whoGetsCountered = $gameTroop.members().indexOf(user);
// Counters with skill 14
$gameParty.members()[whoCounters].forceAction(14, whoGetsCountered);

BattleManager.forceAction($gameParty.members()[whoCounters]);
<Custom Select Effect>


Everything works perfectly, but:
It's not a pre-counter - actor(2) counters after the enemy attacks.
When party members target each other with buffs/heals, actor(2) will counter the enemy that made the last attack.

My question is:
How to force this state to ignore friendly spells and skills? Something like if (friendly skill) {skip this section} else {counter}. I do not want to use a specific counter plugin, because i want to make an aura state that will apply preemptive heal/buff/shield effect.

Thank you for your help in advance :)
 
Last edited:

nadiya2000

Orange Ball
Veteran
Joined
Dec 28, 2013
Messages
38
Reaction score
0
First Language
English?
Primarily Uses
RMMV
https://forums.rpgmakerweb.com/index.php?attachments/yed_sideviewbattler-js.60393/
I'm having a problem with YED_SideviewBattler (v1.1.0), Some animations (such as Victory) are still looping despite it doesn't have "Loop" on note.
Honeycam_2017_10_21_21_39_14.gif

Note:
Code:
<Sideview Battler Motion>
  Name: victory
  Index: 8
  Frames: 9
  Speed: 10
</Sideview Battler Motion>
 

sim22x

Villager
Member
Joined
Aug 23, 2017
Messages
28
Reaction score
6
First Language
japanese
Primarily Uses
RMMV
zKDbjbekTeCh_uNo5YQq8g.png


How to draw text above objects?
Screenshot from yep tutorial. But he did not say how it works...
Is this other plugin?
 

Johnboy

Veteran
Veteran
Joined
Jan 13, 2016
Messages
348
Reaction score
126
First Language
English
Primarily Uses
@sim22x That is done by using this plugin:

http://yanfly.moe/2015/12/08/yep-40-event-mini-label/

@sciencewarrior If you wanted to have them just set their spells in the grimoire and not have control of the amount of uses, I think with some proper notetags and some dedicated time you could use Yanfly's Attachable Augments plugin paired with Limited Skill Uses. Simply have the Augments add the skill, and have the limited skill uses limit the amount of casts. If you are going for them to be able to set the number of spells, it's probably doable as well but would require some more work.
 
Last edited:

Philsco

Flipped Out RPG2Knet.com vet
Veteran
Joined
Apr 5, 2015
Messages
41
Reaction score
9
First Language
English
Primarily Uses
Feel free to ask any questions here that you feel do not warrant their own threads[...]

I did a few searches, and can't find anything that explains this that isn't like "part 34" or so of a series where they're making specific calls withing a long script. So...right, the question.

How do I call my plugin? I have a plugin I made to check progressively in a line based on the player's facing direction for events in a path, then if an event is found it checks its meta array to see if it's an enemy or a destructible object or what-have-you. After evaluating all of that, it runs a little algorithm to deal damage, and interacts with Hime's Self Variables to change its HP based on the result of the formula.

Now, because I wrote and tested it in chunks I never thought about what is probably the most important part of the plugin...initiating it!
I also use Yanfly's Button Common Events, and planned to have a keypress execute a common event which would include calling the plugin I am writing. But I got so caught up in writing the plugin and learning the "how-to" parts of the basics that I skipped over how to call it within the engine.

I'm sure it's a simple command, but for some darn reason I can't seem to find it anywhere!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,485
Reaction score
14,818
First Language
English
Primarily Uses
RMMV
Normally you will have a function that aliases Game_Interpreter.prototype.pluginCommand that will check if the plugin command is the one for your plugin, and if so, execute it, otherwise will call the aliased method.

You will then use the Plugin event command (last or second last one on tab 3) using the command your plugin is looking for and any arguments it's expecting to receive.

Find one or two really simple plugins that have plugin commands, and see how they do it.

You don't HAVE to do it this way - plugins don't have to have plugin commands. If it's something you want to change about existing functions and you don't specifically want the game to trigger it, you wouldn't have a plugin command.

For your purposes, it would depend on whether you want to turn this ability on/off at different points (if you do, you would have a plugin command to enable it, and a plugin command to disable it), or if you want it to run permanently. Without more info, I'd only be guessing. If you do need more help, you might need to provide more details about the plugin, and then it should be in its own thread.
 

Philsco

Flipped Out RPG2Knet.com vet
Veteran
Joined
Apr 5, 2015
Messages
41
Reaction score
9
First Language
English
Primarily Uses
Actually a guy named Pivoo and another named wanee95 helped me out quite a bit here! I'll spare you the bulk of the code and the algorithms and such, but it was as simple as realizing I can scope an object outside of the initial (function () {}) part of the code. I didn't realize the engine would recognize anything before that, so I didn't bother trying. They helped me realize I could create an object by writing something as simple as var MAD = MAD || {}; to declare it, and then make the subsequent functions callable by script commands (in this case,
Code:
MAD.hitTestPistol(...parameters...);
, or any of the other weapons/skills/equipment that is in the full code).

The trimmed-down-for-depiction code is below

Code:
/*:
* @plugindesc Mad's Ranged Attack
*
* @author Philsco
*
* @help
* This will enable the use of interacting with events that contain the
* <enemy> meta tag (just put <enemy> in the "Note" field of an event on the map)
* Then, call based on the weapon type to be used in a Script event call (button in the editor)
* MAD.hitTestPistol(atkDmg, atkAcc, atkRng, atkPen, atkBld);
*/

var MAD = MAD || {};

(function () {

    // Pistol hit test
    MAD.hitTestPistol  = function(atkDmg, atkAcc, atkRng, atkPen, atKBld) {
        var _startX = $gamePlayer.x;
        var _startY = $gamePlayer.y;
        var _startDir = $gamePlayer.direction();
        var _checkX = _startX;
        var _checkY = _startY;
        var _attack_range = atkRng;
        var _rangeChecked = 0;

        for (_rangeChecked = 0; _rangeChecked < _attack_range; _rangeChecked++) {
            if (_startDir == 8) {
                _checkY--;
            } else if (_startDir == 2) {
                _checkY++;
            } else if (_startDir == 6) {
                _checkX++;
            } else if (_startDir == 4) {
                _checkX--;
            }
            if ($gameMap.eventIdXy(_checkX, _checkY) != 0) {
                var _eventIdFound = $gameMap.eventIdXy(_checkX, _checkY);
                if ($dataMap.events[_eventIdFound].meta.enemy) {
                    $gameMessage.add("Hit event number " + _eventIdFound);
                }
            }
        }
    }
    
})();

// Thanks to Pivoo and waynee95 for helping me implement MAD.hitTest??();

Thanks for the ideas, though!

...btw, you're not Squirrel from RPG2knet.com, are ya?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,485
Reaction score
14,818
First Language
English
Primarily Uses
RMMV
no


I see you already have a thread for this, and that it's been going for some time. Please don't post the same question in multiple places - it's just confusing and causes extra work.
 
Last edited:

Philsco

Flipped Out RPG2Knet.com vet
Veteran
Joined
Apr 5, 2015
Messages
41
Reaction score
9
First Language
English
Primarily Uses
no


I see you already have a thread for this, and that it's been going for some time. Please don't post the same question in multiple places - it's just confusing and causes extra work.

Yeah you just have a very similar avatar to RPGSquirrel I guess.
Anwyway yeah sorry about that. But the other thread was for building this, and I had asked for suggestions but this in particular was a different issue I didn't want to branch into its own, because the people answering THAT thread didn't have the answer and only gave similar suggestions to what you gave. All good ideas, mind you, but totally not the answer I needed, which is why I came here to ask so I didn't create a new topic for something I already had ongoing where they couldn't provide the insight I required.

I ended up getting the answer from The Lunatic server in Discord. Just to clarify, I DID wait until my prior topic had tapped out and wasn't able to answer, so instead of jumping the gun and making a new topic, I asked here :p

I do appreciate your response, and I do respect your need for a workflow that isn't confusing, and so I figured on those grounds I'd clarify what you had mistaken :D
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,485
Reaction score
14,818
First Language
English
Primarily Uses
RMMV
You didn't achieve anything by reposting the question elsewhere, and bumping the original topic (which is the correct action to ask for more help after an existing topic has "tapped out") would have given the context of your plugin. You'll note my "without more info about the plugin you've made" comment - wouldn't have needed to make that comment, and might have been able to give better help, if you'd just bumped your thread.
 

Philsco

Flipped Out RPG2Knet.com vet
Veteran
Joined
Apr 5, 2015
Messages
41
Reaction score
9
First Language
English
Primarily Uses
Woah, hey buddy, I'm just trying to put into context what happened, here. Not trying to get on your bad side, at all.
Originally, I DID have a thread going for my plugin, you're right. And yeah, they gave some good advice, but it didn't fit what I needed. And see, the reason I didn't bump it is because MOST forums REALLY frown on double-posting like that to bump a topic.

So, the reason I reposted the question here was because the topic I made had two VERY well accomplished individuals who didn't know the answer, and after doing further searches, I found nothing other than lots of hits where the guidelines seemed to meet my issue best. I didn't want to make a whole new topic to reiterate what my already-long winded topic failed to answer, so instead of making a redundant thread (one that "doesn't deserve its own thread"), I just asked here.
And, even though I did NOT get the answer here (or anywhere on this forum, but I DID get some cool tips along the way!), I found the answer on Yanfly's Discord channel. So I only responded to say that I DID find a good way, and I wanted to share that information (proper scoping techniques, making the whole thing an object which you can call with a script, and then demonstrating how to do it) so that other people could get the answer in case they had similar problems. I thought that's what this whole thread was for, dude.

I'll say it one last time, I'm sorry if this muddled you a bit, but I feel I took the right actions and I came here for the right reasons, and that I acted in a proper way to ask a question, and then provided the solution once it was given to me from another source (Yanfly's Discord channel). Hope this clears things up!
 

Kiryuu

I'm a peace of sheet
Member
Joined
Oct 22, 2017
Messages
14
Reaction score
1
First Language
english
Primarily Uses
RMMV
how can I call the skill user's datas?

for example, i have a skill that summons a dragon. and that dragon's level is supposed to be equal to the skill user's level.

im using SRD_summoncore plugin for that skill.

I tried using
$gameActors.actor(this).level

but the "this" part seems to call the skill's data, not the skill user.
 

Espilonarge

Veteran
Veteran
Joined
Apr 24, 2016
Messages
144
Reaction score
67
First Language
English
Primarily Uses
I'm having a bit of a graphical issue regarding Yanfly's ATB Battle System plugin and Moghunter's Battlehud.

While everything seems to look right, the only issue is that if I change the Invocation speed of Skills (or use another plugin that increases/reduces cast times) the "charging" bar is either being stretched outside the ATB bar (long cast times) or it never reaches the end of the bar (short cast times).

The issue seems to be related to Moghunter's plugin while the "ATB Meter Flow Anime" parameter is set to "true". While turning it off and shortening the bar to 1/3 of its length semi-solves the issue, this is not the intended purpose I wish to happen as I want for the bar to continue being animated. The only thing I can think is either Moghunter's plugin or Yanfly's plugin isn't "clamping" the size for the charging bars (the ATB bar itself however is staying the correct size).

p0CiAwQ.png
 

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
314
Reaction score
104
First Language
English
Primarily Uses
RMMV
Has anybody tested Yanfly's Counter Control with this eval code below?

<Counter Condition>
Eval: attacker.hpRate() > 0
</Counter Condition>
----------------------------
I was testing with an enemy set to immortal and thinking that the enemy would no longer counter attack since his HP is 0. But the eval code doesn't work at all and he still counters.

http://yanfly.moe/2016/03/11/yep-82-counter-control/
 

Kiryuu

I'm a peace of sheet
Member
Joined
Oct 22, 2017
Messages
14
Reaction score
1
First Language
english
Primarily Uses
RMMV
Has anybody tested Yanfly's Counter Control with this eval code below?

<Counter Condition>
Eval: attacker.hpRate() > 0
</Counter Condition>
----------------------------
I was testing with an enemy set to immortal and thinking that the enemy would no longer counter attack since his HP is 0. But the eval code doesn't work at all and he still counters.

http://yanfly.moe/2016/03/11/yep-82-counter-control/
<counter condition> is not a lunatic mode tag. I think you should be using <custom counter rate>
 

Latest Threads

Latest Profile Posts

Good grief am I ever so dusty on music creation. Never move, gentleman and ladies!
After waiting for several months to observe the results of vaccines, I finally decided to go for Comirnaty, because now my job needs me to either be vaccinated or take a regular testing every 2 weeks(240 HKD per test), and it seems to me that Comirnaty is safe enough in my case :)
So, to create multiple faces one needs to first export, then import, over and over... who came up with this weird mechanism...
Away from home now since it reduce COVID spread
I hate doing voice over videos but people said they like hearing about the details.

Forum statistics

Threads
112,313
Messages
1,067,264
Members
145,938
Latest member
Raigonex05
Top