JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 36 of 171 View original ↗
  1. Hi all,


    I have a question about items. Is there any way to make some kind of item like Tent from Final Fantasy VII? For those who don't know, Tent was an item you could use only at certain locations, like World Map and near Save Points to heal your entire party. Is it possible to make this kind of item in RPG Maker MV? I don't know, using Regions maybe?


    Any ideas?


    Thanks in advance


    Regards
  2. That's not really a JavaScript question... but well, if your save points are events, you can add a choice command which then asks them if they want to save or use tent, if they choose use tent, then you check if they have the item, then do whatever the tent does then reduce it's amount by 1
  3. @Engr. Adiktuzmiko I asked here, because I believe there is no way to do this without plugins in a way it works in Final Fantasy VII. Your solution is really good, tho. Thank you very much. I think I just gonna use this one to sort it out.


    Thanks again.
  4. I asked here, because I believe there is no way to do this without plugins



    If ur looking for a plugin, then that question deserves it's own thread, I think. :)


    On the world map case, you can have a parallel process event on the world map that checks for button press so that if a button is pressed then show the Use tent choice, then do the same process as the tent use I stated above.


    It might also be worth looking at Yanfly's plugins, see if he has anything for customizing item use cases. 
  5. There is a plugin requests forum if you want a plugin to do it.  This thread is for 'simple' questions that might have just a couple of lines of code to solve them.
  6. Does anyone know if there's a javascript command that can alter the opacity of a battler in the battle scene? I kind of need invisible enemies that the player can interact with, so using the Appear Halfway thing isn't really an option for me.
  7. You could just make your sprites semi-transparent.
  8. Shaz said:
    You could just make your sprites semi-transparent.

    I mean... I guess??? Not like it wouldn't be hard to switch between sprites/battler images even for enemies, so it'd be alright for the games I want to make. Not gonna lie, I was hoping that there'd be an easy way to do it, but alas I must take my work seriously. :p


    Thank you for your help.
  9. Well, you didn't indicate if you want the same enemy to always be 'invisible' or sometimes 'invisible' and sometimes not.  If you want them to always be 'invisble' (not really invisible, but semi-transparent) then creating the sprite that way is the best way to go, as you're not doing extra processing at runtime.


    mmm - what do you mean by 'invisible' - REALLY invisible?  How does the player know they can interact with them?  Try just not giving the enemy a battler sprite at all.


    You could have one opaque and one semi-transparent version, set them both up as enemies with the same stats, and use the Enemy Transform command to switch between them.


    You MIGHT be able to call battler.setOpacity(n) but then you have to get the right battler object.
  10. Shaz said:
    Well, you didn't indicate if you want the same enemy to always be 'invisible' or sometimes 'invisible' and sometimes not.  If you want them to always be 'invisble' (not really invisible, but semi-transparent) then creating the sprite that way is the best way to go, as you're not doing extra processing at runtime.


    mmm - what do you mean by 'invisible' - REALLY invisible?  How does the player know they can interact with them?  Try just not giving the enemy a battler sprite at all.


    You could have one opaque and one semi-transparent version, set them both up as enemies with the same stats, and use the Enemy Transform command to switch between them.


    You MIGHT be able to call battler.setOpacity(n) but then you have to get the right battler object.



    Ah, I suppose it would have helped if I had been a bit more specific about my needs. Sorry!


    Edit: Ooooh, that's a good point. My thought process was something like "random encounter, and the player doesn't see anything so they have to use certain skills to reveal the enemy" but that might actually be sort of obnoxious. Hrm, maybe the enemy has really low opacity, but is still just visible enough that the player can go "wait a frikken' second..." and realize that there's more enemies than they can see? I'll need to think about this a bit more.


    I'll experiment with the script call. Any advice on making sure I have the correct battler object?
  11. If you want the player to be able to use a skill on an enemy, and then for the enemy to become visible, you could make it part of the damage formula of the skill.  Just put b.setOpacity(255) into the damage formula (if there's also damage from the skill, put a ; followed by the actual damage formula after it).  This will make the target of the skill change opacity.  In that case, the target is the 'correct battler object'.
  12. Shaz said:
    If you want the player to be able to use a skill on an enemy, and then for the enemy to become visible, you could make it part of the damage formula of the skill.  Just put b.setOpacity(255) into the damage formula (if there's also damage from the skill, put a ; followed by the actual damage formula after it).  This will make the target of the skill change opacity.  In that case, the target is the 'correct battler object'.



    Okay so I experimented with the script call. I decided to make a skill that targets the user just to see if I could alter the opacity using a damage formula set to a.setOpacity(20). RPGMaker keeps telling me "undefined is not a function". So either I did something wrong, or I'd need a plugin to make it work like that if I want a JS solution to this, or it's impossible (I mean, it's not impossible since I have photoshop and would probably only have a handful of enemies capable of being 'invisible' but I digress).
  13. If it targets the user, you could still use b instead of a.  I don't see anything wrong with that command - are you using it in battle or outside of battle via the menu?  Again, I don't think that really matters.  A screenshot of the console to provide full error details would be helpful, as well as a screenshot of the skill (and this is probably now beyond 'questions that don't deserve their own thread').


    I do know that people have trouble trying to do changes to battlers during a battle, that they don't always actually change.  And the engine itself might manipulate the opacity, so even if you didn't get an error, it might not work still.  But it shouldn't give you an error message.


    Edit: actually, setOpacity is a Game_CharacterBase method, which affects your sprites on the map, not battlers, and the battler sprite doesn't get its information from the character for this value.  Looking through the battler sprites, there is no method to change opacity, and the engine itself does manipulate opacity a lot, so the above script call (even if you could do it for a battler) is not going to work.


    You will either need to have a plugin written, or go for a non-plugin solution, and you already have a couple of those.
  14. Shaz said:
    If it targets the user, you could still use b instead of a.  I don't see anything wrong with that command - are you using it in battle or outside of battle via the menu?  Again, I don't think that really matters.  A screenshot of the console to provide full error details would be helpful, as well as a screenshot of the skill (and this is probably now beyond 'questions that don't deserve their own thread').


    I do know that people have trouble trying to do changes to battlers during a battle, that they don't always actually change.  And the engine itself might manipulate the opacity, so even if you didn't get an error, it might not work still.  But it shouldn't give you an error message.



    First of all: Derp. How could I make such a beginner level mistake!?


    So, I very quickly adjusted the battle formula and uh.... that is still one hell of an error message. And since this is now beyond the scope of this thread, I'll bring up the topic of the error message some other time. For now though, I guess that's that on my question.


    EDIT: I should clarify that the game isn't actually crashing when I do this, but rather that the console log is getting forced open whenever some bad code gets run. This debugging fail safe comes courtesy of Yanfly's plugins. So, uh, what I should have said in the first place was "it's not working, and I don't know why" as opposed to implying a crash.


    EDIT2 THE EDITING: 

    Edit: actually, setOpacity is a Game_CharacterBase method, which affects your sprites on the map, not battlers, and the battler sprite doesn't get its information from the character for this value.  Looking through the battler sprites, there is no method to change opacity, and the engine itself does manipulate opacity a lot, so the above script call (even if you could do it for a battler) is not going to work.


    You will either need to have a plugin written, or go for a non-plugin solution, and you already have a couple of those.



    Ah. Well that explains that. Time to edit opacity on images then.
  15. Hello there,


    pretty new here, so sorry in advance if I'm using the wrong thread.


    Here's my "problem":

    I'm using yanflys core engine plugin. I know that within the plugin manager I am able to change the opacity for all my message windows. But I need a way to somehow change the opacity with an event "on the fly" since I don't want the change to be permanent throughout the whole game.


    The reason for this is pretty simple. For the message windows during conversations I want to use a custom textbox image instead of the default maker windows. I know, I could simply make each message window transparent and that works completely fine. But it's a bit annoying to go through that dropdown menu on every single Show Text command in every conversation. It would be easier to reduce the window opacity in the same common event that shows the textbox image and then raise it again after the conversation, so my menus will still be visible.


    tl;dr: I'm just asking for this for the sake of convenience.


    Is there a command to achieve this in any way?


    Thanks :)
  16. Can someone help me fix this:
     


    if(Input.keyTriggered("up") || Input.keyPressed("up")){
    $gamePlayer.setTransparent(flag);
    };




    What I need this to do is to, regardless of if the up key is pressed or triggered (in both instances), I need the player to be switched to transparent. This gives me a script call error. I tried to set it up myself though. :)
  17. @Phinx Without testing, I looks like you can use


    Yanfly.Param.WindowOpacity = opacity;


    in a script call (replace opacity with the number you want to change the opacity to). That basically changes the value from the plugin parameter to whatever you write in this line of code. Let me know if that works; if it doesn't, you might need a mini-extension plugin.


    @Zaen Also without testing, I believe


    $gamePlayer.setTransparent(flag);


    is looking for a boolean - so you need to replace flag with either true or false. I'm also not sure about the semicolon after the curly bracket in your last line - I don't use it at the end of blocks, but if it doesn't give you any errors, it's probably fine.
  18. LadyBaskerville said:
    @Phinx Without testing, I looks like you can use



    Yanfly.Param.WindowOpacity = opacity;


    in a script call (replace opacity with the number you want to change the opacity to). That basically changes the value from the plugin parameter to whatever you write in this line of code. Let me know if that works; if it doesn't, you might need a mini-extension plugin.



    Tried this with several values ranging from 0 to 255, but it seemed to have no actual effect.
  19. LadyBaskerville said:
    @Zaen Also without testing, I believe



    $gamePlayer.setTransparent(flag);


    is looking for a boolean - so you need to replace flag with either true or false. I'm also not sure about the semicolon after the curly bracket in your last line - I don't use it at the end of blocks, but if it doesn't give you any errors, it's probably fine.



    if(Input.keyTriggered("up") || Input.keyPressed("up")){
    $gamePlayer.setTransparent(true);
    };


    in the console, script call error


    Typeerror undefined not a function, something about a stack.
  20. Zaen said:
    in the console, script call error


    Typeerror undefined not a function, something about a stack.



    I suggest making a new topic as this sounds to become more complex.


    As a minimum, you'll need to give a screenshot of the console error message, and you need to tell us where exactly you place the code - a lot of code is context-sensitive and needs to be different depending on where in the engine it is placed.


    Especially if this is a stack error, that would indicate that it is placed inside itself and create a stack overflow, but there are several types of stack errors...