JavaScript questions that don't deserve their own thread

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
819
First Language
English
Primarily Uses
tried this out, sadly the skill works even if the party leader isnt actor 3.
thanks for replying tho!
What do you mean by "the skill works"? This is a condition for a state.


If you mean state:


It's working for me. The state is applied when leader has the id 3, then removed when the leader does not have the id 3.


Make sure that your <Passive State: x> notetag is ONLY on the actor with id 3 for this state.


Here's the condition also with that other condition about learning a skill:


<Custom Passive Condition>
if ($gameParty.leader() && $gameParty.leader().actorId() === 3 && $gameParty.leader().isLearnedSkill(26)) {
condition = true;
}
else {
condition = false;
}
</Custom Passive Condition>


Replace 26 with the skill id.
 
Last edited by a moderator:

Reaxus

Villager
Member
Joined
Dec 13, 2015
Messages
14
Reaction score
1
First Language
English
What do you mean by "the skill works"? This is a condition for a state.


If you mean state:


It's working for me. The state is applied when leader has the id 3, then removed when the leader does not have the id 3.


Make sure that your <Passive State: x> notetag is ONLY on the actor with id 3 for this state.


Here's the condition also with that other condition about learning a skill:



<Custom Passive Condition>
if ($gameParty.leader() && $gameParty.leader().actorId() === 3 && $gameParty.leader().isLearnedSkill(26)) {
condition = true;
}
else {
condition = false;
}
</Custom Passive Condition>


Replace 26 with the skill id.
OMG! now it's working!!!!! thanks a ton!!!
 

slycode

Warper
Member
Joined
Dec 2, 2014
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Hello, I'm having trouble reading $gameVariables from a note tag and storing it into a variable to be used later.


What I want to do is have a note tag like <VAR X> or something to that extent, then in the script, have it take the value and store it into another variable for later use. How do I parse it right?
 

Chaos17

Dreamer
Veteran
Joined
Mar 13, 2012
Messages
1,253
Reaction score
421
First Language
French
Hi,


I would like to know if there's a way to check the enemy party HP with a script call ?


Because I would like to trigger a dialog when one of the enemy is low HP (so not a specific one) in a conditionnal branch.
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
819
First Language
English
Primarily Uses
Hi,


I would like to know if there's a way to check the enemy party HP with a script call ?


Because I would like to trigger a dialog when one of the enemy is low HP (so not a specific one) in a conditionnal branch.
Try


$gameTroop.members().some(function(member) { return member.hpRate() <= .5});


Replacing .5 with whatever you want.
 

Chaos17

Dreamer
Veteran
Joined
Mar 13, 2012
Messages
1,253
Reaction score
421
First Language
French
@DreamX


I did.


But I think the problem is the battle condition itself.


Even if I put turn 0, the condittional branch isn't triggered :(
 
Last edited by a moderator:

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
819
First Language
English
Primarily Uses
@DreamX


I did.


But I think the problem is the battle condition itself.


Even if I put turn 0, the condittional branch isn't triggered :(
Try using turn end with turn as the span.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I have a problem. In my Game_Actor class I made two new things, being sizeX and sizeY. Now, I want to use those variables as the value of each different actors when they are created in battle:


Spriteset_Battle.prototype.createActors = function() {
this._actorSprites = [];
for (var i = 0; i < $gameParty.maxBattleMembers(); i++) {
this._actorSprites = new Sprite_Actor();
this._actorSprites.scale.x = $gameParty.members()._sizeX;
this._actorSprites.scale.y = $gameParty.members()._sizeY;
this._battleField.addChild(this._actorSprites);
}
};


This to be exact. When I console.logged it, there's an extra thing that is printed that says it is undefined. I wonder where that came from. This is the reason why the code does not work because it equates to an undefined variable afterwards. That's why you'd have to be specific instead of using the variable i.


Any possible solution for this?
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
819
First Language
English
Primarily Uses
Unless you have a particular reason, there's no need to do it in that function. The actor sprite index does not necessarily correspond to the game party members index, anyway.

Code:
    alias_Game_Actor_initMembers = Game_Actor.prototype.initMembers;
    Game_Actor.prototype.initMembers = function () {
        alias_Game_Actor_initMembers.call(this);
        this._sizeX = 1;
        this._sizeY = 1;
    };

    // alias the Sprite_Actor.prototype.updateBitmap function
    alias_Sprite_Actor_updateBitmap = Sprite_Actor.prototype.updateBitmap;
    Sprite_Actor.prototype.updateBitmap = function () {
        // call the original function we are aliasing
        alias_Sprite_Actor_updateBitmap.call(this);
        // check if we didn't already scale.
        if (!this._scaled) {
            // scale the sprite according to the scale variable of the actor.
            this._mainSprite.scale.x = this._battler._sizeX;
            this._mainSprite.scale.y = this._battler._sizeY;
            // mark that we scaled
            this._scaled = true;
        }
    };
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Ahhh that helped, DreamX. Looks okay now! <3
 

Rizzle

Villager
Member
Joined
Mar 19, 2016
Messages
8
Reaction score
0
First Language
English
Primarily Uses
Hello, 


I apologize if this has been answered already, but I'm having a slight annoyance with Yanfly's Message Core. It involves the plugin command "MessageWith 400" and how it seemly goes everywhere I don't want it. Even when I don't put it in an event, it shrinks the text box regardless. The problem even bleeds into the combat where the text windows shrink and cut off words. Is there a way to turn it off and I just do not see it?


Please and thank you. 
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
819
First Language
English
Primarily Uses
Hello, 


I apologize if this has been answered already, but I'm having a slight annoyance with Yanfly's Message Core. It involves the plugin command "MessageWith 400" and how it seemly goes everywhere I don't want it. Even when I don't put it in an event, it shrinks the text box regardless. The problem even bleeds into the combat where the text windows shrink and cut off words. Is there a way to turn it off and I just do not see it?


Please and thank you. 
Does it not work if you just call the plugin command again with the original message box size?
 

Punamaagi

Hero on their own terms
Veteran
Joined
Jan 23, 2016
Messages
200
Reaction score
305
First Language
Finnish
Primarily Uses
RMMV
Is there a way to prevent an event with Event Touch activating if the event is on the edge of a cliff and player happens to walk past it (i.e. check for collisions)? I'm trying to make visible enemy encounters, but it's a bit awkward when the player gets into a battle with a monster which shouldn't be able to reach them.
 

Rizzle

Villager
Member
Joined
Mar 19, 2016
Messages
8
Reaction score
0
First Language
English
Primarily Uses
Does it not work if you just call the plugin command again with the original message box size?
I could try this, but I don't know what the default size is. Please, do you know?
 
Joined
Jan 23, 2014
Messages
159
Reaction score
19
First Language
English
Hi folks,


I am curious about the funciton $gameScreen.startFlash(color, duration) used in battle.


In the Animations tab there is a window to adjust the "SE and Flash Timing" see below:



I was wondering where the function is that knows whether it is screen / target / hide target?


For example, in Game_Screen.startFlash:


Game_Screen.prototype.startFlash = function(color, duration) {
this._flashColor = color.clone();
this._flashDuration = duration;
};


is the function that does flash on the screen. but no parameters for the type (screen, target, hide) etc.


Curious on this because I want to have character's flash on conditions.


Thanks!
 
Last edited by a moderator:

BloodletterQ

Chaotic Neutral Assassin
Veteran
Joined
Aug 15, 2012
Messages
1,466
Reaction score
1,067
First Language
English
Primarily Uses
N/A
I may have suggested it already, but there are countless questions about how to remove or skip stats and I'm suggesting to Shaz that perhaps there can links to certain answers in the original post?
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I have a question about blt and numbers. I want to change the texts Lv and the HP MP numbers into an image. For example, if I use sprite, it becomes cluttered and since it gets created everytime, the sprite will just double up in the window. Is there a proper way to make the text LV into an image? How about the numbers?
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Just had a stranger SPRINT away from me in the grocery store. Talk about overreaction...
...I don't think I'm that ugly! ^-^
I wonder if I can go outside ye-

Government: lemme stop you right there
Alright, who's playing Jumanji? And whose turn is it?!
*Buys all the PVGames assets, ends up creating his own ground tiles.* At least I used the other types of graphics? Right? :kaoswt:

Forum statistics

Threads
95,507
Messages
929,681
Members
125,769
Latest member
MrOrgazm
Top