I need help with Java Script for the Equip Requirement
I want to make a weapon requirement where a character can dual-wield only if there is a type of weapon, but if single wielding then can equip any. Example: A character can wield Light Blade, Dark Blade, and Twilight Blade, however if decide to dual-wield, can dual wield Light Blade with Darkblade, darkblade with light blade, but cannot dual wield light blade with light blade, darkblade with darkblade, twilight with twilight, twilight with darkblade, twilight with light blade, and vice versa. Using the lunatic mode how would
<Custom Equip Requirement Condition>
if (user.has weapon type){
condition = true;
}else if (user has no weapon equipped){
condition = true;
}else{
condition = false;
}
</Custom Equip Requirement Condition>
be used, I know we can have a if no blade is equipped to return true, and then else if there is (if light) a dark type of blade equipped to return true, but what are the java script command for these?
JavaScript questions that don't deserve their own thread
● ARCHIVED · READ-ONLY
-
-
I have the code that disables the OPTION menu and so where do I put this in MV ?
-
I'm looking for a way to detect and swap the weaponsprite animation of an actor's mainhand weapon to the corresponding offhand weapon.
Long story short - I've got dual wielding set up so that it attacks with the mainhand and then the offhand in sequence, showing the battle animation of weapon1, damage of weapon1, then animation and damage from weapon2. The problem is that the actor swings twice with the weapon type of the weapon in his mainhand. If the actor is using a flail in his mainhand, and a sword in his offhand, I want the individual swings to show the weaponsprite for the correct weapon.
I'm sure this information is stored on items somewhere, but I'm sort of new at this and am not sure how to go about finding/storing/changing these values on the fly.
Any help is appreciated.
edit:
After some more extensive testing, if the actor has no weapon in his mainhand, he uses the weaponanimation of his offhand both times instead.
if I modify $dataWeapons[3018].wtypeId at run time, it has no effect on the weapon swing animation on the first attack (for testing I was using a flail animation), then the second reverted to the offhand weapon because it updated and removed the unequippable weapon from the actor after his attack.
edit2:
If I modify $dataWeapons[3018].weaponImageIndex seems to be what I'm looking for.
edit3:
I managed to cook up something after several hours using @Yanfly's weapon animations script, which it appears weaponImageIndex is coming from, as the weapons that I didn't set notetags for didn't have this property to pull from.
by saving the index to a variable, and then swapping them around in the Window_BattleLog.prototype.showActorAttackAnimation function, I was able to get actors to alternate weaponindexes as well as swapping the battle animations from the main and offhand. The only thing left to fix now is getting actors to swap swing/thrust/missile animations when they're dual wielding weapons of different types.
View attachment Test Project 001 2016-03-06 5_17_16 AM_VP8.webm -
Is there a faster way to grab the screen and save it to a bitmap than Bitmap.snap()?
Trying to have a 'ghosting' effect like I did in the VX Ace game where I used these methods and it's a lot slower in JS than it was in RGSS. -
Being the flop at Javascript that I am, I have a question. I'm trying to eliminate the standard levels in MV, and am using Yanfly's Job Points/Fox JP Levels instead. What should I do to get rid of default levels, or is this a plugin request-worthy subject?
-
Hello, I'm currently kind of "trial and error"-ing my way through code when I need to use it. In other words, I don't know what I'm doing. I'm having an "undefined is not a function" type error on this and would appreciate any advice I could get. I'm probably missing something fundamental ^^;
<Custom Apply Effect>
if (target.isActor()) {
if (target.hasState(12) == false) {
var hp = Math.floor(target.mhp * 0.15);
target.gainHp(hp);
target.addState(12);
}
}
</Custom Apply Effect>
This is for use with Yanfly's Buff & States Core, which, in this case, would run custom code when a state is applied. This is on my state 1 "knockout." What I'm trying to achieve is to revive an actor with a small amount of hp, but also apply a "near-death" state. If the actor's hp hits 0 again, and still has state 12, "near-death", then they would remain under state 1, "knockout", with 0 hp. -
Hello, I'm currently kind of "trial and error"-ing my way through code when I need to use it. In other words, I don't know what I'm doing. I'm having an "undefined is not a function" type error on this and would appreciate any advice I could get. I'm probably missing something fundamental ^^;
<Custom Apply Effect>
if (target.isActor()) {
if (target.hasState(12) == false) {
var hp = Math.floor(target.mhp * 0.15);
target.gainHp(hp);
target.addState(12);
}
}
</Custom Apply Effect>
My guess would be your target.hasState(12).
Try target.isStateAffected(12) instead -
Hello everyone! I'd like to make a variable randomizer accompanied with an if else statement. I'm going to use it with yanfly's action sequence pack, wherein the player shouts or not upon attacking an enemy.
Ex.
1. Generate random variable from 1 to 3
2. if variable <= 2
3. play SE
4. else
5. none(or play another SE)
6. end
Thank you in advance!
EDIT: Solved! For yanfly's actseq pack atleast.
if Math.randomInt(3)+1 <= 2
se: filename1
else
se: filename2
end -
My guess would be your target.hasState(12).
Try target.isStateAffected(12) instead
Thank you very very much, that was exactly it. I've been trying to find the rpgm specific calls, but have only found incomplete lists.
My method here was flawed, but I've since fixed it up. -
I'm currently using this plugin Custom Stats to have some additional values attached to enemies and actors.
Using Yanflys script i use these values in calculating the final attack value - that works without a problem.
The problem however is the equip-screen which shows the stat-change when changing equipment. I narrowed the problem down, to calculate this change a temporary actor-copy is created using JsonEx.makeDeepCopy - and in this copy my additional values are not included.
I assume that this arise because the script above will not store the actual values on the actor/enemey but instead somewhere else and just has the getter-function on the actor/enemy.
So i thought about writing my own plugin for what i need (i started writing utility-function for this anyway), so now my question is probably really simple: What do i need to ensure my additional values are included in the deepCopy? Do i just have to make them part of the BattlerBase-object? (Like this._myExtraStats = 1234) I would assume so, but i want to be sure.
Edit:
Answering my own question. After writing my own plugin i can conclude that having them part of the Game_BattlerBase object itself is enough. -
Is there anything wrong with the following? Cube root, and also what's the correct term for the user's level if it's not a.lvl?
<damage formula>
value = Math.cbrt(a.atk * a.mat / a.lvl) * 100 / (100 + b.def);
</damage formula> -
Is there anything wrong with the following? Cube root, and also what's the correct term for the user's level if it's not a.lvl?
<damage formula>
value = Math.cbrt(a.atk * a.mat / a.lvl) * 100 / (100 + b.def);
</damage formula>
user's level should be
Code:a.level -
Hello all. Can anyone help me with showing picture above message window in MV without adding any of the bust plugins. I don't want to use those cause I have a system completely evented and I show busts in another style then the plugins available provide. So if someone with enough JS knowledge can lead me any way to accomplish this, It would be much appreciated.
-
So I would like to use the script below to use specific skills from the actor with the use of buttons.
http://forums.rpgmakerweb.com/index.php?/topic/56988-button-cast-plugin/
The problem now is that currently there is now way that the user of the game can change the skills or the buttons used, while playing the game.
So in the moba mode you can press for example "q" and then it uses skill "dual attack" (for the first actor).
My question now is, if it would be possible and how it would look like to use a variable in the notetag like this:
<ButtonCast Key: var1: var2>
where var 1 is set to for example "t" (button)
and var 2 is set to "15" (skill id) in other script calls.
Or would it be possible to get the note and change it in a external script call alltogether ? like
$gameActors.actor(1).getNote("ButtonCast Key").setValues("t", 15);
sorry for false syntax and the like, first time working with javascript and wanted to know if it would be possible for something like this to be implemented. -
How do I properly reference state turns left. I want to make a spell that scales w/ the number of turns left on a state.
something like...
<damage formula>
value = a.mat * .stateTurns or ._stateTurns[116];
</damage formula>
idk how's it supposed to be formatted -
I asked this last year but never got an answer or figured out a solution and it is extremely frustrating. I made the font size larger for my game and now the text gets cut off at the bottom if its a long letter like "g" or "y". there is also extra space at the top of the message windows because the text isnt aligned right. I need to figure out how to change the position of the text on the y axis so i can move it up slightly but there is no option for that in the yanfly message core. i tried messing with the window padding and text padding but it didn't work.
-
So I have a question and I'm not sure it's worthy of it's own thread. I am having trouble with the equip screen. My game uses custom stats like Strength, Dexterity and the like to determine Base Parameters like Attack, Defence and so on. What I'm seeing is when I change equipment, it doesn't show what the change will be, whether it is unequipped or if I am putting on a new piece of equipment. I'm using Bobstah's Custom Stats to define the stats, but I want to fix this show the equipment shows the before and after values properly.
I have added an image of my problem.
-
I'm having a problem trying to get the party leader's actorID.
i tried using this code(i'm using yanfly's auto passive states plugin)
<Custom Passive Condition>
if ($gameParty.leader().actorId() == 3) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>
but it gives me back "Cannot read property 'actorId' of undefined.
what im trying to get is that it checks if the leader is party member #
I tried 3 equals,
removing the '()s' (it'll run the game but the passive skill wont work)
after checking the party leader's id it checks if he already learned a certain skill.
in short, what im trying to get is:
if party.leader.actorId == ##
if actorid=3 islearnedskill ## == true <-- something like that
hope you could help me out of this!
Thanks guys! -
I'm having a problem trying to get the party leader's actorID.
i tried using this code(i'm using yanfly's auto passive states plugin)
<Custom Passive Condition>
if ($gameParty.leader().actorId() == 3) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>
but it gives me back "Cannot read property 'actorId' of undefined.
what im trying to get is that it checks if the leader is party member #
I tried 3 equals,
removing the '()s' (it'll run the game but the passive skill wont work)
after checking the party leader's id it checks if he already learned a certain skill.
in short, what im trying to get is:
if party.leader.actorId == ##
if actorid=3 islearnedskill ## == true <-- something like that
hope you could help me out of this!
Thanks guys!
Try this.
Code:if ($gameParty.leader() && $gameParty.leader().actorId() === 3) { condition = true; } else { condition = false; } -
Try this.
if ($gameParty.leader() && $gameParty.leader().actorId() === 3) {
condition = true;
}
else {
condition = false;
}
tried this out, sadly the skill works even if the party leader isnt actor 3.
thanks for replying tho!