JavaScript questions that don't deserve their own thread

Discussion in 'Javascript/Plugin Support' started by Shaz, Oct 23, 2015.

  1. kiriseo

    kiriseo Veteran Veteran

    Messages:
    229
    Likes Received:
    74
    First Language:
    German


    To get the id of an actor, try this:

    Code:
    BattleManager.actor().actorId();
     
    yuyu! likes this.
  2. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,462
    Likes Received:
    1,060
    Location:
    My head's in the clouds at least...
    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?
     
  3. yuyu!

    yuyu! The Hero of Rhyme Member

    Messages:
    25
    Likes Received:
    11
    Location:
    Texas


    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. Lowell

    Lowell The Walking Atelier Veteran

    Messages:
    292
    Likes Received:
    69
    First Language:
    English
    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. Guyfon

    Guyfon Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    german
    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. lithkast

    lithkast Quirky mini boss Veteran

    Messages:
    105
    Likes Received:
    48
    Location:
    Nebraska, USA
    First Language:
    english
    How do you read the system date and time and display it in game?
     
  7. ThePotatoOfFire

    ThePotatoOfFire Stop, in the name of candy! Veteran

    Messages:
    153
    Likes Received:
    56
    Location:
    Phoenix Caves
    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: Feb 14, 2016
  8. Znikomek

    Znikomek Veteran Veteran

    Messages:
    56
    Likes Received:
    4
    $gameParty.aliveMembers().length;
     
  9. kyuukyuu

    kyuukyuu Veteran

    Messages:
    53
    Likes Received:
    92
    First Language:
    English
    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: Feb 15, 2016
  10. Mortalis

    Mortalis Veteran Veteran

    Messages:
    34
    Likes Received:
    3
    First Language:
    English
    Is there a way to tell which party member you used an item on?
     
  11. Znikomek

    Znikomek Veteran Veteran

    Messages:
    56
    Likes Received:
    4
    Fast question:


    how can i check actual turn number in battle?


    Thanks :)
     
  12. Guyfon

    Guyfon Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    german
    Znikomek: Thanks, that works. Must have overlooked it when I looked through the rpg_objects.js.
     
    Last edited by a moderator: Feb 16, 2016
  13. Prescott

    Prescott argggghhh Veteran

    Messages:
    459
    Likes Received:
    335
    Location:
    USA
    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.
     
  14. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    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. Prescott

    Prescott argggghhh Veteran

    Messages:
    459
    Likes Received:
    335
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    [​IMG]


    ...What? xD


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

    raitoningu Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    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. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    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 likes this.
  18. raitoningu

    raitoningu Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    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. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    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 likes this.
  20. raitoningu

    raitoningu Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    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.
     

Share This Page