ive wrote and copy pasted so much code the past week but those are the 4 l cannot find an answer to. any help is greatly appreciated and also a classified request should be on the way if you are looking for payment.
1. random state removal or add on a list of state when condition is true on a skill
Example: I use a skill that can remove buff A or B or C or D if target is below 50% hp
state categories doesn't work unless l can have the script call because its a notetag.
the only thing l found this here but it doesn't work on MZ:
<JS Post-Apply>
// List all the states the item can remove (change to your state IDs)
// If there a lots of them in consecutive order, you can also use a loop to add them more conveniently.
var removeStates = [1, 2, 3, 4];
// Make an empty pool of states
var currentStates = [];
// Loop through each of the padawan states
for (var i = 0; i < removeStates.length; ++i) {
// Get the currently looped state
var current = removeStates;
// Check if the target is affected by that state
if (target.isStateAffected(current)) {
// If it is, add it to the pool of states
currentStates.push(current);
}
}
// Run the following code 3 times (or five times, or however many times you want - just change the number)
// For the tier 1 items, when it should run only once, you can remove the loop (this line and the very last curly bracket).
for (var j = 0; j < 3; j++) {
// Check if the pool of states isn't empty
if (currentStates.length > 0) {
// Get a random state from that pool
var removedState = currentStates[Math.floor(Math.random() * currentStates.length)];
// Remove the random state
target.removeState(removedState);
// Remove the state from the list of current states
currentStates.splice(currentStates.indexOf(removedState), 1);
}
}
</JS Post-Apply>
2. putting a condition in a function that targets the whole party doesn't work
in this example l put if (member.hp = member.mhp) { meaning for the state 11 to be added the targeted member must be full hp. theres probably just something wrong with how l wrote it but lve tried around 100 different ways.
$gameParty.aliveMembers().forEach(function(member) {
if (member.hp = member.mhp) {
member.addState(11); })};
}
3. l need a code similar as 2 but will detect which of all the alive actors who has a state or who has the highest hp
the reason why l need it is to show the exact damage the enemy skill will do depending on the stats of the actor with the condition as true so instead of
value = Math.floor((($gameTroop.members()[0].atk * 1) * dmg) * $gameParty.members()[0].pha) it can be
value = Math.floor((($gameTroop.members()[0].atk * 1) * dmg) * member.pha)
4. SRD hud maker crash when party member is not there
if you do anything that calls the second or third party member and those are not in the party the game will crash
l tried to do this condition but the crash still persist, anything related to those actors shouldnt be loaded when theyre not in the game.
if ($gameParty.members().length > 1) {
return true; }
1. random state removal or add on a list of state when condition is true on a skill
Example: I use a skill that can remove buff A or B or C or D if target is below 50% hp
state categories doesn't work unless l can have the script call because its a notetag.
the only thing l found this here but it doesn't work on MZ:
<JS Post-Apply>
// List all the states the item can remove (change to your state IDs)
// If there a lots of them in consecutive order, you can also use a loop to add them more conveniently.
var removeStates = [1, 2, 3, 4];
// Make an empty pool of states
var currentStates = [];
// Loop through each of the padawan states
for (var i = 0; i < removeStates.length; ++i) {
// Get the currently looped state
var current = removeStates;
// Check if the target is affected by that state
if (target.isStateAffected(current)) {
// If it is, add it to the pool of states
currentStates.push(current);
}
}
// Run the following code 3 times (or five times, or however many times you want - just change the number)
// For the tier 1 items, when it should run only once, you can remove the loop (this line and the very last curly bracket).
for (var j = 0; j < 3; j++) {
// Check if the pool of states isn't empty
if (currentStates.length > 0) {
// Get a random state from that pool
var removedState = currentStates[Math.floor(Math.random() * currentStates.length)];
// Remove the random state
target.removeState(removedState);
// Remove the state from the list of current states
currentStates.splice(currentStates.indexOf(removedState), 1);
}
}
</JS Post-Apply>
2. putting a condition in a function that targets the whole party doesn't work
in this example l put if (member.hp = member.mhp) { meaning for the state 11 to be added the targeted member must be full hp. theres probably just something wrong with how l wrote it but lve tried around 100 different ways.
$gameParty.aliveMembers().forEach(function(member) {
if (member.hp = member.mhp) {
member.addState(11); })};
}
3. l need a code similar as 2 but will detect which of all the alive actors who has a state or who has the highest hp
the reason why l need it is to show the exact damage the enemy skill will do depending on the stats of the actor with the condition as true so instead of
value = Math.floor((($gameTroop.members()[0].atk * 1) * dmg) * $gameParty.members()[0].pha) it can be
value = Math.floor((($gameTroop.members()[0].atk * 1) * dmg) * member.pha)
4. SRD hud maker crash when party member is not there
if you do anything that calls the second or third party member and those are not in the party the game will crash
l tried to do this condition but the crash still persist, anything related to those actors shouldnt be loaded when theyre not in the game.
if ($gameParty.members().length > 1) {
return true; }