RMMV To javasccript or not to javascript?

Snarkyfork

Veteran
Veteran
Joined
Oct 29, 2015
Messages
399
Reaction score
54
First Language
English
Primarily Uses
I have a general question about javascript, I hope this is the right area to ask. I need the yanfly stealth plugin to flip a switch on or off in my game so I can implement a pickpocket event for NPC's. The problem is that the stealth script call that can be used in conditional branches doesn't seem to work unless the event is set to player touch.

I figure I could just use a parallel CE but I am trying to keep the number of parallel events to a minimal. So my question is:

if I get a plugin made that flips a switch when yanflys stealth is "true" and turns that switch off when the stealth ends... would that plugin make less of a performance hit than a parallel event?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,787
Reaction score
7,876
First Language
German
Primarily Uses
RMMV
that completely depends on how the script works and what you're doing with the results.
So I suggest you place screenshots of how your events are made and are supposed to work, then someone might be able to tell you more.

and by the way - it's javascript, not java.
java is to javascript like ham is to hamster - they have nothing to do with each other.
 

Snarkyfork

Veteran
Veteran
Joined
Oct 29, 2015
Messages
399
Reaction score
54
First Language
English
Primarily Uses
As I said above, what I am trying to do is create a pickpocket event on NPC's that triggers when the player is in stealth mode. I am using Yanflys Event Chase Stealth plugin which gives a script call that can be used in conditional branches to determine if the player is in stealth:

$gamePlayer.isStealthMode(true)

But it doesn't seem to work in the event trigger is set to action button, only when the event is set to player touch.

I figured an easy fix would be to use a parallel common event to manually flip a switch when it detects the script call but wanted to inquire about whether or not a plugin would be better suited for the job.

1.png
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,787
Reaction score
7,876
First Language
German
Primarily Uses
RMMV
But it doesn't seem to work in the event trigger is set to action button,
of course not - the action button is like tipping the NPC on the shoulder to get its attention and have it turn to you. So it always destroys stealth.

But you seem to have a few misconceptions on what causes lag and problems. There is almost no difference in the performance between switching by script call and by event command, because that has nothing to do with the problems you're imagining.
The difference is how often the check is made - which is something you can easily control with waits in commands, while the check by plugin is always active and thereby can cost more processing power depending on where and how it is done by plugin. Plugins aren't miracles, you know...

and in all cases you still haven't described what that switch is supposed to do - that is much more important, because if you go to plugins it is much more effective to have the plugin cause the results directly instead of turning a switch that does nothing on its own.
 

Snarkyfork

Veteran
Veteran
Joined
Oct 29, 2015
Messages
399
Reaction score
54
First Language
English
Primarily Uses
The switch would simply be there so I can flp NPC's over to a player touch page where the player can pickpocket them. Here are some screenshots of me using a CE to make it work. I don't want a parallel event trying to check for it CONSTANTLY if its possible to have the switch flipped on ONLY when stealth mode is activated.

3.png

2.png
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,616
Reaction score
1,978
First Language
English
Primarily Uses
RMMV
Have you tried just $gamePlayer.isStealthMode() for your check? That function doesn't take an argument, since it only returns the value rather than setting it.
 

Snarkyfork

Veteran
Veteran
Joined
Oct 29, 2015
Messages
399
Reaction score
54
First Language
English
Primarily Uses
Have you tried just $gamePlayer.isStealthMode() for your check? That function doesn't take an argument, since it only returns the value rather than setting it.

Yeah, it doesn't work. It seems the second you click on an event stealth modes ends, no matter what. So basically the NPC event has to be set to player touch so no action button needs to be pressed.
 

Latest Threads

Latest Posts

Latest Profile Posts

I haven't make anything new yet, but I'm back addicted to writing some MZ plugins. Man, I wish I have more free time like I did 5 years ago.
Holy cow... work is demanding and I'm back in college. I'm kind of scared of my dad right now after the incident, but at least I don't live with him all the time. Anyway, working on Fandom Scouts and my FNAF character set. The FNAF sprites are actually going to be used in the game... unfortunately the enemy sprites are FNAF World traces, so no sharing those.
The honeymoon period is over with Cyberpunk 2077, It sadly doesnt live up to the hype, pretty graphics arent everything (especially when I cant even do something as simple as changing the radio station over!). Replaying Breath of the wild has reminded me what a good game really looks like, plus that one has good glitches!....

Forum statistics

Threads
107,689
Messages
1,031,461
Members
139,805
Latest member
oo_K_DASH_oo
Top