JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 18 of 171 View original ↗
  1. yuyu! said:
    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();
  2. Two issues involving logs:


    -How can I move it higher?


    -How do I make escape failure, pre-emptive, and surprise messages into battle logs?
  3. kiriseo said:
    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. :)  
  4. 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)
  5. 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.
  6. How do you read the system date and time and display it in game?
  7. 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~
  8. Guyfon said:
    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;
  9. 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< 
  10. Is there a way to tell which party member you used an item on?
  11. Fast question:


    how can i check actual turn number in battle?


    Thanks :)
  12. Znikomek: Thanks, that works. Must have overlooked it when I looked through the rpg_objects.js.
  13. 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.
  14. 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.
  15. yyWGteW.gif


    ...What? xD


    I know where to add them I'm pretty sure, I'm just not sure exactly WHAT to add.
  16. 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. 
  17. 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.
  18. Iavra said:
    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? 
  19. 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).
  20. Iavra said:
    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.