Hi, I need help with the script for this passive skill:
Pharmacology
-> 50% chance to not consume potions when used.
im using Yanfly Plugins, with this script:
State Notetag:
<Custom Action Start Effect>
// Add the ID's of the potions that can be affected by pharmacology.
potions.push(1, 2, 3, 4);
potions.push(5, 6, 7, 8);
// Loop through each of the potion ID's.
for (var i = 0; i < potions.length; ++i) {
// Get the current ID.
var id = potions;
// If the party has this potion in its item bag...
if ($gameParty.numItems($dataItems[id]) > 0) {
// ...then set the value to true.
value = true;
// ...and break the loop.
break;
}
}
// Get current action.
var action = user.currentAction();
// Check if the current action is using item.
if (action && action.isItem()) {
var item = $dataItems[id];
// Chance for pharmacology to activate.
var conserveRate = 0.5;
// Check if conservation succeed.
if (Math.random() < conserveRate) {
$gameParty.getItem(item, 1);
}
}
</Custom Action Start Effect>
It didnt work...
Can someone help me where i did wrong?
I am still learning, pls enlighten me >.<
Pharmacology
-> 50% chance to not consume potions when used.
im using Yanfly Plugins, with this script:
State Notetag:
<Custom Action Start Effect>
// Add the ID's of the potions that can be affected by pharmacology.
potions.push(1, 2, 3, 4);
potions.push(5, 6, 7, 8);
// Loop through each of the potion ID's.
for (var i = 0; i < potions.length; ++i) {
// Get the current ID.
var id = potions;
// If the party has this potion in its item bag...
if ($gameParty.numItems($dataItems[id]) > 0) {
// ...then set the value to true.
value = true;
// ...and break the loop.
break;
}
}
// Get current action.
var action = user.currentAction();
// Check if the current action is using item.
if (action && action.isItem()) {
var item = $dataItems[id];
// Chance for pharmacology to activate.
var conserveRate = 0.5;
// Check if conservation succeed.
if (Math.random() < conserveRate) {
$gameParty.getItem(item, 1);
}
}
</Custom Action Start Effect>
It didnt work...
Can someone help me where i did wrong?
I am still learning, pls enlighten me >.<
