JS Codes
JS Codes
<JS Post-Apply>
user.setHome(user._homeX - 64, user._homeY);
</JS Post-Apply>
Code:
<JS On Erase State>
const targetId = Math.randomInt($gameTroop.aliveMembers().length);
const target = $gameTroop.aliveMembers()[targetId];
const damage = Math.floor(target.mhp * 0.05);
target.gainHp(-damage);
</JS On Erase State>
For your expire:
Code:
<JS On Expire State>
target.addState(ID of new state);
</JS On Expire State>
--Let's say you want a state to deal 10% + 10 damage to the sufferer per turn:
Code:
<JS HP Slip Damage>
damage = Math.floor(target.mhp * 0.1) + 10;
</JS HP Slip Damage>
--
1) A skill that is only enabled when HP is 70% of that actor's Max HP and disabled
otherwise. Without any HP Costs involved if that makes sense?
2) 5 Potions in the Inventory needed for a skill to be enabled, and it's disabled
if that number drops. Without any x5 Potion costs attached to the skill.
Code:
<JS Skill Enable>
enabled = user.hpRate() <= 0.7;
</JS Skill Enable>
and
Code:
<JS Skill Enable>
enabled = $gameParty.numItems($dataItems[id of potion]) >= 5;
</JS Skill Enable>
--
<JS Passive Condition>
code
code
condition = target.hpRate() >= 0.75;
</JS Passive Condition>
If i need this passive to only be active if the user is above 75% HP
--
Code:
<JS Post-Damage as User>
delete user._attackStack;
user.setStateDisplay(11, "");
user.removeState(14);
</JS Post-Damage as User>
Replace 11 with the ID of your passive state and 14 with the ID of the state you
just created.
This will cause every 3rd hit that actor makes to have 50% increased crit chance
which will reset after their next hit (misses shouldn't affect it).
The state will show just the icon, then a "1", then a "2", with the next hit after
that being the boosted one.
--
--
You need to edit the JS: Draw Gauge section: change the "const label" line to say
"Fury" rather than the TP name from TextManager
(you can also change the colour values here as I imagine you'd probably prefer it
to be red rather than green)
--
5 flat heal, and each extra point of MAT above 15 add 2 additional healing
<JS HP Slip Heal>
heal = 5 + Math.max(user.mat - 15, 0) * 2
</JS HP Slip Heal>
-------
Something like
Code:
<JS On State Apply>
target._stateStacks = target._stateStacks || 0;
target._stateStacks++;
target.setStateDisplay(id of state, target._stateStacks);
</JS On State Apply>
This would only handle the visual part; actually having it do different things
depending on number of stacks would be separate, like
Code:
<JS HP Slip Damage>
target.gainHp(-(target._stateStacks * 10));
</JS HP Slip Damage>
-------------
Is there a way to manually increase an actor's AP?
It's something like:
$gameActors.actor(x).gainAP(n);
-----For Action Sequence use to check if target is affected by state and if passive
state
///////////////////////
Sharing a useful macro for Message Core real quick. It basically allows you to
display stats in an esthetic way.
////////////////
idea for improvement: factor in enemies countering you, as well as you countering
enemies
<JS Targets>
//const counter = $gameTroop.members()[$gameTemp.lastActionData(3) - 1];
targets = [];
const counter = this.opponentsUnit().members()[$gameTemp.lastActionData(3) - 1];
targets.push(counter);
</JS Targets>
<Auto Trigger: Physical Enemy>
//////////////////////////////
Requires AutoSkillTriggers
To make a counter-attack:
You can change auto-trigger as you want for other means, but this makes it so the
skill always targets the last enemy that attacked the player
/////////////////////////
I was messing around with an old state from my MV project and managed to get a slip
damage state to calculate a target's element rate in MZ. Original code was based on
an old Tips and Tricks
////////////////////////////////
simple dynamic mana regen code if anyone wants it, just put it on a loop with
desired wait time and it'll plink away regenerating mana for your characters in
real time (does not work during battle)
//////////////////////////////
made a skill that deals damage and then heals all allies for a portion of the
damage dealt. I don't know if anyone else would want this, but I thought I'd share
this because I spent a little bit of time troubleshooting how to make this work for
MZ. It's based off an old Yanfly Tips and Tricks from MV.
<JS Post-Damage>
if (target.result().hpDamage > 0) {
// establish the rate of healing proportional to damage dealt
var healRate = 0.5;
// establish the actual amount of healing to be done
var healValue = Math.floor(target.result().hpDamage * healRate);
// for loop to run through every member of "allies" and heal them
for (var i = 0; i < allies.length; i++) {
var ally = allies[i];
ally.gainHp(healValue);
ally.startDamagePopup();
}
user.clearResult();
}
</JS Post-Damage>
////////////////////////////////////////