JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 31 of 171 View original ↗
  1. use .x instead of ._x
  2. DreamX said:
    use .x instead of ._x



    It works, but it somehow takes the x and y from the editor, I think?


    Because I want the sprite I showed on the map to be in the exact location with the event's x and y.


    My event is at 4, 3 and the sprite only shows on top. It should be on the same position as the event.
  3. Milena said:
    It works, but it somehow takes the x and y from the editor, I think?


    Because I want the sprite I showed on the map to be in the exact location with the event's x and y.
    Code:
    // change to event id you're looking for
    var eventId = 1;
    
    var event = $gameMap.events().filter(function(event) { return event.eventId() === eventId; } )[0];
    var x = event.x;
    var y = event.y;
  4. DreamX said:
    // change to event id you're looking for
    var eventId = 1;

    var event = $gameMap.events().filter(function(event) { return event.eventId() === eventId; } )[0];
    var x = event.x;
    var y = event.y;



    It does work. The x and y is detected. But say for example, my sprite is at 4, 16 on the editor. When I detect the x and y using this code, it shows me 4 and 16 as well. So when I update the picture's x and y, it also goes to 4 and 16, instead of where the event sprite is being placed on the screen. Is there a solution so the image should follow the event instead? The game player has a screenX and screenY where you can use it to make an image follow the player, but I don't know for events.
  5. Oh sorry, I missed that you wanted the screen x and y.


    To get the screen x and y try


    screenX()


    and


    screenY()

    Code:
    // change to event id you're looking for
    var eventId = 1;
    
    var event = $gameMap.events().filter(function(event) { return event.eventId() === eventId; } )[0];
    var screenX = event.screenX();
    var screenY = event.screenY();
  6. Ah, thanks, it works properly now :) I never thought there's one too for events. I missed that out. Thanks!
  7. What do I need to do to get the following calculation to work?


    ($gameTroop.members()[1]._mmp / $gameTroop.members()[1]._mp) * 100
  8. Never mind. My problem was coming from trying to do the calculation on a nonexistent enemy in the troop I was testing, as I forgot that was zero-based.
  9. I know I could just use the event command, but how would I control a variable using a script call with a condition, in the same script call, for controlling the variable.


    I need to do many variable calculations in a short amount of time, and script calls are very quick.
  10. Hi. I wonder if anyone could help me.


    In my game, I want a character to have a passive ability like the Thornmail effect presented by Yanfly, but with some changes. 


    I would like to tie the recoil damage within a variable, so depending of the value of the variable, the recoil could range from 0 to a +50% boost and also  a -50% deboost.


    Also, I would like to add a check, so the recoil effect only activates with contact physical damage. It would be very strange seeing a long range attack like a bow being punished by the recoil. Maybe a piece of code to put on long ranged skills that surpass and negate the recoil damage? I'm clueless in how to make this kind of thing, though. The code for the Thornmail effect is below. Thanks in advance!

    Code:
    [SIZE=10px]<Custom React Effect>
    // Check to see if any physical damage is dealt.
    if (value > 0 && this.isPhysical()) {
      // Sets the Recoil Rate to 15%.
      var rate = 0.15;
      // Determines the amount of recoil damage dealt.
      var recoil = value * rate;
      // Sets the DEF bonus rate to 25%.
      var rate = 0.25;
      // Determines the amount of bonus damage dealt.
      var bonus = target.def * rate;
      // Rounds up the bonus damage and recoil damage.
      var dmg = Math.ceil(bonus + recoil);
      // Makes the attacker lose damage equal to the dmg variable.
      user.gainHp(-1 * dmg);
      // Check to see if the attacker is dead.
      if (user.isDead()) {
        // If the attacker is dead, make it collapse.
        user.performCollapse();
      }
    }
    </Custom React Effect>[/SIZE]
  11. I was wondering if this would be a good place to ask about an RPG Maker MV Plugin tutorial. I tried a couple on YouTube, and looked around for some other ones, but I'm not having much luck. I already finished a JS tutorial on CodeAcademy, but I would like to understand the RPGM system much better.
  12. The_D said:
    I was wondering if this would be a good place to ask about an RPG Maker MV Plugin tutorial. I tried a couple on YouTube, and looked around for some other ones, but I'm not having much luck. I already finished a JS tutorial on CodeAcademy, but I would like to understand the RPGM system much better.



    Which ones did you try? Driftwood Gaming featured some channels that do MV Plugin tutorials. This channel is by far the most updated one.
  13. Milena said:
    Which ones did you try? Driftwood Gaming featured some channels that do MV Plugin tutorials. This channel is by far the most updated one.



    That's one of the two I tried. I got stuck on #14 the other was by SumRndmDude, but someone suggested trying a non-video tutorial. I think I might just go back and try the Soulpour one again.
  14. I'd like to add my own parameters, but I don't know if I should add them ontop of the existing parameter array, or if I should create a new one.


    Does anyone happen to know off the top of their head if any default scripts perform loops on actor parameters under the assumption it's always the standard length?
  15. How would I check to see if a certain scene is loaded?
  16. How do i get the party leaders level and or the average level among all party members
  17. So I've done some digging and can't find an answer in the help file or around the forums. I'm trying to check if the control variable 1, has a value of 1 or more. I'm using YED Skill shop which allows for custom requirements to learn a skill via notetags. The example given used actor level, which works  great.


    actor.level > 10


    So I just need the equivalent snippet for checking control variable 1 (or is it 0001). Any help would be appreciated. I'm sure this is super simple.
  18. That should just be as follows :

    Code:
    $gameVariables.value(1) >= 1;
  19. Ossra said:
    That should just be as follows :

    thank you so much. I happened to find another posters code example(earlier in this thread). Very much appreciated.
  20. Hello, I am trying to make Yanflys Main Menu Manager disable a menu command with a switch.  How can I make it do that?  It says it is an "eval" what ever that means.  I assume it want a piece of code that says "GameSwitch23 = True" or something but I don't know how to format it exactly.


    Please help!