In my game, one of the characters is a mage partially possessed by a chaotic entity, which causes their magic to sometimes go wild and have chaotic effects, similar to the wild mage subclass from DnD. I'm having trouble figuring out how to go about forcing the character to use a different skill when their magic goes chaotic. The way I'm trying to structure it is:
I've tried to achieve this by using a switch to act as a medium between the state and skills to indicate whether or not the skills can perform their target/whole actions or not. Right now, I'm just testing it using a basic Fire spell. The issue I'm having is that when the user is forced to use the chaotic skill, they cast it twice, and then go on to cast the original spell anyway. I think the issue is with how I'm calling the forced skill to be used in the state's notetags. Any advice is helpful!
NOTE: Because this relies on random numbers, I have the randomly rolled numbers set to specific values for testing. I still have the roll occur and print to the console so I know its still functioning as expected.
'Chaos Magic' State Notetags
Basic Fire spell notetags
Test 'chaos magic' skill notetags:
Plugin List:
Code:
if stype of Skill about to be used == 2 (Black Magic) {
let randomNumA = number between 1 and 20
if randomNumA <= Total stacks of User's Passive State {
let randomNumB = number between 24 and 33 (skill IDs of 10 random effects)
Force use of Skill at randomNumB
Cancel use of originally selected skill
Add 1 stack to Passive if not at MAX stacks (MAX = 10)
}
}
I've tried to achieve this by using a switch to act as a medium between the state and skills to indicate whether or not the skills can perform their target/whole actions or not. Right now, I'm just testing it using a basic Fire spell. The issue I'm having is that when the user is forced to use the chaotic skill, they cast it twice, and then go on to cast the original spell anyway. I think the issue is with how I'm calling the forced skill to be used in the state's notetags. Any advice is helpful!
NOTE: Because this relies on random numbers, I have the randomly rolled numbers set to specific values for testing. I still have the roll occur and print to the console so I know its still functioning as expected.
'Chaos Magic' State Notetags
Code:
<Custom Battle Effect>
target.setStateCounter(31, 1);
</Custom Battle Effect>
<Custom Turn Start Effect>
$gameSwitches.setValue(1, false);
</Custom Turn Start Effect>
<Custom Action Start Effect>
let skill = BattleManager.inputtingAction();
let chaosStacks = user.getStateCounter(31);
if (skill.item().stypeId === 2) {
let chaosRoll = Math.randomInt(20) + 1;
console.log(chaosRoll);
chaosRoll = 1;
if (chaosRoll <= chaosStacks) {
$gameSwitches.setValue(1, true);
let chartRoll = Math.randomInt(24, 34);
console.log(chartRoll);
chartRoll = 24;
BattleManager.queueForceAction(user, chartRoll);
}
}
</Custom Action Start Effect>
Basic Fire spell notetags
Code:
<target action>
if !($gameSwitches.value(1))
perform start
motion chant: user
motion wait: user
motion spell: user
motion wait: user
action animation
animation wait: 4
action effect: target
end
</target action>
Test 'chaos magic' skill notetags:
Code:
<target action>
perform start
motion chant: user
motion wait: user
motion spell: user
motion wait: user
action animation
animation wait: 4
action effect: target
eval: $gameSwitches.setValue(1, false);
break action
</target action>
Plugin List: