JavaScript questions that don't deserve their own thread

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
229
Reaction score
74
First Language
German
Thank you so much for the reply! :)


I tried using BattleManager.actor.id and BattleManager.actor().id to grab the actor's ID number. Both seemed to get me a little farther but keep failing to read the ID and has only been returning "null". I'm not sure what I'm doing wrong... Sorry about being so lost, JS is new to me. ^^;



Thank you again! :)


To get the id of an actor, try this:

Code:
BattleManager.actor().actorId();
 

BloodletterQ

Chaotic Neutral Assassin
Veteran
Joined
Aug 15, 2012
Messages
1,466
Reaction score
1,066
First Language
English
Primarily Uses
N/A
Two issues involving logs:


-How can I move it higher?


-How do I make escape failure, pre-emptive, and surprise messages into battle logs?
 

yuyu!

The Hero of Rhyme
Member
Joined
Feb 19, 2014
Messages
25
Reaction score
11
To get the id of an actor, try this:



BattleManager.actor().actorId();


Unfortunately, I seem to be getting the same error: "Cannot read property 'actorId' of null"...


I'm running my code as a common event, attached to a skill. Could that be messing things up?


Sorry about this...and thank you again for the replies. :)  
 

Lowell

The Walking Atelier
Veteran
Joined
Apr 21, 2012
Messages
292
Reaction score
69
First Language
English
Primarily Uses
How difficult would it be to have the actual damage a skill does display in the description (Not the formula but the end result minus variance but using the active battlers stats)
 

Guyfon

Warper
Member
Joined
Feb 11, 2016
Messages
2
Reaction score
0
First Language
german
Primarily Uses
During Battle, how can I get the number of partymembers that are still alive? Here is my attempt: (I am using Yanfly Damage Core)


<damage formula>
var num = 0;
for (var i = 0; i < $gameParty.battleMembers().length; i++){
if ($gameParty.battleMembers(i).isAlive){
num++;
}
}
value *= 1/num;
</damage formula>




When using the skill, I get a TypeError: Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': float parameter 3 is non-finite.
 

lithkast

Quirky mini boss
Veteran
Joined
May 12, 2014
Messages
105
Reaction score
49
First Language
english
Primarily Uses
How do you read the system date and time and display it in game?
 

ThePotatoOfFire

Stop, in the name of candy!
Veteran
Joined
Jan 15, 2016
Messages
153
Reaction score
57
First Language
English
Primarily Uses
RMMV
How can I check if a certain kind of event is within range of the player? I'm trying to use Yanfly's Button Common Events to make a basic real-time battle system, just to see if it's possible. Thanks~
 
Last edited by a moderator:

Znikomek

Veteran
Veteran
Joined
Jan 18, 2016
Messages
56
Reaction score
4
Primarily Uses
During Battle, how can I get the number of partymembers that are still alive? Here is my attempt: (I am using Yanfly Damage Core)



<damage formula>
var num = 0;
for (var i = 0; i < $gameParty.battleMembers().length; i++){
if ($gameParty.battleMembers(i).isAlive){
num++;
}
}
value *= 1/num;
</damage formula>




When using the skill, I get a TypeError: Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': float parameter 3 is non-finite.
$gameParty.aliveMembers().length;
 

kyuukyuu

Veteran
Joined
Jul 28, 2015
Messages
53
Reaction score
92
First Language
English
Primarily Uses
I've been looking around for awhile now >ww< and was wondering if any of you happen to know a plugin that can change the priority of the show picture function. 


I know that TDDP_BindPicturestoMap does a good job for parallaxes but I'm looking for something that could make pictures bind in front of the message window instead. :)  


Galv's message bust has such function, but I do plan on animating the frames of the portraits shown infront of the message window D:


and using the "show picture" and "set movement route" is how I usually do it  





So anyone knows how to twerk something like this? :)  thank you in advance for taking the time to read this >www< 
 
Last edited by a moderator:

Mortalis

Veteran
Veteran
Joined
Jun 9, 2014
Messages
34
Reaction score
3
First Language
English
Primarily Uses
Is there a way to tell which party member you used an item on?
 

Znikomek

Veteran
Veteran
Joined
Jan 18, 2016
Messages
56
Reaction score
4
Primarily Uses
Fast question:


how can i check actual turn number in battle?


Thanks :)
 

Guyfon

Warper
Member
Joined
Feb 11, 2016
Messages
2
Reaction score
0
First Language
german
Primarily Uses
Znikomek: Thanks, that works. Must have overlooked it when I looked through the rpg_objects.js.
 
Last edited by a moderator:

Prescott

argggghhh
Veteran
Joined
Aug 28, 2014
Messages
468
Reaction score
357
First Language
English
Primarily Uses
RMMV
How can you add an option to the options menu that will turn a switch on and off?


I need to do this for two things: Voice Acting and a Content Filter.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
858
First Language
German
Primarily Uses
First, you need to extend the ConfigManager's "makeData" and "applyData" functions, as well as define a new property for your options. Afterwards, you need to modify Window_Options as well.
 

Prescott

argggghhh
Veteran
Joined
Aug 28, 2014
Messages
468
Reaction score
357
First Language
English
Primarily Uses
RMMV



...What? xD


I know where to add them I'm pretty sure, I'm just not sure exactly WHAT to add.
 

raitoningu

Villager
Member
Joined
May 3, 2014
Messages
9
Reaction score
0
First Language
English
Primarily Uses
Using Yanfly's Menu Manager, I've created an extra menu scene (however, it's using common events, plugin calls and script calls to function, so it's a pseudo-menu at best). The menu scene uses a normal "show message" and "show choices" thing to work. The game is paused during the Menu, and during the PHWarehouse that the choice menu brings up, but not during the message and choice themselves. Is there a way to easily pause the game using the functions that the Menu and Warehouse scenes do? I'm 99.9% sure this uses a javascript thing, since it's in the base game and that uses .js files. 
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
858
First Language
German
Primarily Uses
I don't know, what this Warehouse thing is, but it likely uses a real scene, like the ingame menu. These pause the game, since the map scene doesn't exist, while the menu is displayed (the background you are seeing is a screenshot). I would suggest reading about scenes and using one, instead of trying to imitate it.
 

raitoningu

Villager
Member
Joined
May 3, 2014
Messages
9
Reaction score
0
First Language
English
Primarily Uses
I don't know, what this Warehouse thing is, but it likely uses a real scene, like the ingame menu. These pause the game, since the map scene doesn't exist, while the menu is displayed (the background you are seeing is a screenshot). I would suggest reading about scenes and using one, instead of trying to imitate it.
Javascript is way out of my depth though. Is there a simple way to create a scene that calls a normal message and choice thing? And can scripts make plugin calls / javascript calls? I'm sure they must be able to, but I've no idea how. Would I be able to write the scene's script within a normal Script box inside MV or would I need to put it in a .js and make a plugin call to it? 
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
858
First Language
German
Primarily Uses
A simple scene may look like this:


var MyScene = function() { Scene_MenuBase.prototype.initialize.call(this); };
MyScene.prototype = Object.create(Scene_MenuBase.prototype);


and can be called like this:


SceneManager.push(MyScene);


You won't see anything except a blurred background, though, since the scene doesn't contain anything so far. Also, you can't exit the scene anymore (without calling SceneManager.pop()).


Creating a scene with a few windows isn't hard, but i suggest learning some JavaScript and taking a look at the content of js/rpg_scenes.js, so you can get a good overview over what you can do. If you don't want to learn all of that (which is completely ok, since learning programming may take some time), i suggest opening a thread requesting the scene you want to do, since the topic is a bit too big for this one.


You can do so either in "JS Plugin Requests" (for a full plugin) or "Learning Javascript" (to learn the basics, without a concrete scene in mind).
 

raitoningu

Villager
Member
Joined
May 3, 2014
Messages
9
Reaction score
0
First Language
English
Primarily Uses
A simple scene may look like this:



var MyScene = function() { Scene_MenuBase.prototype.initialize.call(this); };
MyScene.prototype = Object.create(Scene_MenuBase.prototype);


and can be called like this:



SceneManager.push(MyScene);


You won't see anything except a blurred background, though, since the scene doesn't contain anything so far. Also, you can't exit the scene anymore (without calling SceneManager.pop()).


Creating a scene with a few windows isn't hard, but i suggest learning some JavaScript and taking a look at the content of js/rpg_scenes.js, so you can get a good overview over what you can do. If you don't want to learn all of that (which is completely ok, since learning programming may take some time), i suggest opening a thread requesting the scene you want to do, since the topic is a bit too big for this one.


You can do so either in "JS Plugin Requests" (for a full plugin) or "Learning Javascript" (to learn the basics, without a concrete scene in mind).
Thanks a lot, that's really helpful. I'll probably do both. I need the plugin quickly-ish, but I'd also like to be able to work on my own in the future too.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Please watch out for your hands when handling chests! XD Did this a few days ago, it was fun to animate

Apparently, it's illegal to be drunk on licensed premises: pubs, etc. It's illegal for keepers of public houses to permit drunkenness and disorderly conduct. lol.
Pillow Hero - A 16-bit arcade styled puzzle game, update 0.5 is live now on Itch.io! --> https://bifrost09.itch.io/pillow-hero
Would you pay monthly for your pc if you'd get "free" upgrades every 2 years?
well, I definitely have a type, cute redheads with medusa piercings, met and hit it off with two of them in the last 72 hours, what does it mean lol?

Forum statistics

Threads
94,431
Messages
920,884
Members
124,236
Latest member
AkiraSenki
Top