rivelle

Villager
Member
Joined
Jan 16, 2023
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Hello!

I've been trying to show the next enemy action before their turn so that the player can prepare accordingly beforehand.
I've found 2 forum threads that discusses what I wanted to do, this and this.

I've tried to recreate them using the required notetags, but it never worked for me.
The enemy won't even attack or do anything and just skip their turn, they also do not show their next move.

Can someone enlighten me on what I'm doing wrong?

Skill Notetag:
Code:
<After Eval>
var old = 11
// Change # to the skill's required state
var newstate = $dataEnemies[user._enemyId].meta.states.split(',').map(function(n){return parseInt(n)});
// Reads the allowed state values from the enemy notetag
var index = Math.randomInt(newstate.length);
var choice = newstate[index]
if (user.isStateAffected(choice)) {
} else {
BattleManager._subject.removeState(old);
BattleManager._subject.addState(choice);
}
</After Eval>

<Custom Requirement>
var x = 11
// Change # to the skill's required state
if (user.isStateAffected(11)) {
value = true;
} else {
value = false;
}
</Custom Requirement>

Enemy Notetag:
Code:
<states:11,12>
 

Attachments

  • enemy.png
    enemy.png
    135.6 KB · Views: 7
  • plugin.png
    plugin.png
    53.8 KB · Views: 7
  • skills.png
    skills.png
    209.4 KB · Views: 7
  • states.png
    states.png
    169 KB · Views: 6

rivelle

Villager
Member
Joined
Jan 16, 2023
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMZ
This is how it looks in combat, 1st turn.
 

Attachments

  • image_2023-03-23_191523731.png
    image_2023-03-23_191523731.png
    599.5 KB · Views: 14

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,676
First Language
English
Primarily Uses
RMMV
The "var x" in the Custom Requirement is pointless if you never use x and you directly type in isStateAffected(11) (which makes more sense to do anyway).

When do you actually give the enemy a state? The code in the states will do stuff once a skill is used, but you need to use a Turn 0 troop event or something to put it on in the first place and start the process.
 

rivelle

Villager
Member
Joined
Jan 16, 2023
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMZ
The "var x" in the Custom Requirement is pointless if you never use x and you directly type in isStateAffected(11) (which makes more sense to do anyway).

When do you actually give the enemy a state? The code in the states will do stuff once a skill is used, but you need to use a Turn 0 troop event or something to put it on in the first place and start the process.

Thank you for replying.

I changed the skill notetag to this one:

Code:
<After Eval>
var old = 11
// Change # to the skill's required state
var newstate = $dataEnemies[user._enemyId].meta.states.split(',').map(function(n){return parseInt(n)});
// Reads the allowed state values from the enemy notetag
var index = Math.randomInt(newstate.length);
var choice = newstate[index]
if (user.isStateAffected(choice)) {
} else {
BattleManager._subject.removeState(old);
BattleManager._subject.addState(choice);
}
</After Eval>

<Custom Requirement>
// Change # to the skill's required state
if (user.isStateAffected(11)) {
value = true;
} else {
value = false;
}
</Custom Requirement>

Also, I made the Turn0 Troop as you said, applying the attack state.
I tried it in combat and they did attack, I also notice one of the enemy readied the next action, but after my 2nd turn, they just proceeded to skip their turn again.
 

Attachments

  • troop.png
    troop.png
    209.6 KB · Views: 3

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,676
First Language
English
Primarily Uses
RMMV
Okay, well, show the code for that state/skill, then.
 

rivelle

Villager
Member
Joined
Jan 16, 2023
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Attached are the states.

The codes for Attack Skill:

Code:
<After Eval>
var old = 11
// Change # to the skill's required state
var newstate = $dataEnemies[user._enemyId].meta.states.split(',').map(function(n){return parseInt(n)});
// Reads the allowed state values from the enemy notetag
var index = Math.randomInt(newstate.length);
var choice = newstate[index]
if (user.isStateAffected(choice)) {
} else {
BattleManager._subject.removeState(old);
BattleManager._subject.addState(choice);
}
</After Eval>

<Custom Requirement>
// Change # to the skill's required state
if (user.isStateAffected(11)) {
value = true;
} else {
value = false;
}
</Custom Requirement>

The codes for the Guard Skill:

Code:
<After Eval>
var old = 12
// Change # to the skill's required state
var newstate = $dataEnemies[user._enemyId].meta.states.split(',').map(function(n){return parseInt(n)});
// Reads the allowed state values from the enemy notetag
var index = Math.randomInt(newstate.length);
var choice = newstate[index]
if (user.isStateAffected(choice)) {
} else {
BattleManager._subject.removeState(old);
BattleManager._subject.addState(choice);
}
</After Eval>

<Custom Requirement>
// Change # to the skill's required state
if (user.isStateAffected(12)) {
value = true;
} else {
value = false;
}
</Custom Requirement>
 

Attachments

  • state2.png
    state2.png
    168.9 KB · Views: 3
  • states.png
    states.png
    169 KB · Views: 3

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,676
First Language
English
Primarily Uses
RMMV
I don't see the shot of the Guard skill in your database.
 

rivelle

Villager
Member
Joined
Jan 16, 2023
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Attached are the skills page.

The notetags are the ones I posted above

Edit: I also tried removing the "add state: guard 100%" and the same thing happens after their first turn, the next turns they just skip any actions.
 

Attachments

  • guard.png
    guard.png
    201.4 KB · Views: 4
  • skills.png
    skills.png
    209.4 KB · Views: 4

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,676
First Language
English
Primarily Uses
RMMV
Do they actually still have the required state?

Your states have removal at the end of 1 turn, so I would expect:
- Enemy has Attack from the turn 0 event
- Enemy does Attack for their first action which gives them the Guard Next Turn state
- End of turn 1 happens, Guard Next Turn expires and is removed
- Turn 2 starts, enemy has no state, can't use any skill

Can you see they actually have the states going into the second turn?
 

rivelle

Villager
Member
Joined
Jan 16, 2023
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Do they actually still have the required state?

Your states have removal at the end of 1 turn, so I would expect:
- Enemy has Attack from the turn 0 event
- Enemy does Attack for their first action which gives them the Guard Next Turn state
- End of turn 1 happens, Guard Next Turn expires and is removed
- Turn 2 starts, enemy has no state, can't use any skill

Can you see they actually have the states going into the second turn?

I removed them both on both states and now they are working properly!
Each enemy in the troop first starts with attacking state, they do the attack, and from there they randomly select their next turn between the 2 states and proceed on doing it, next turn it randomize again.

What if let's say I want a specific arrangement on their actions?
Let's say for example: Attack, Attack, Guard, Attack, Attack, Guard
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,676
First Language
English
Primarily Uses
RMMV
You can use $gameTroop.turnCount() to reference your current turn and affect what you do inside the codes for the states.
 

rivelle

Villager
Member
Joined
Jan 16, 2023
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMZ
You can use $gameTroop.turnCount() to reference your current turn and affect what you do inside the codes for the states.
Sorry but I don't know how to use that or where to place it.
I'm quite new. Sorry for the trouble.
 

Latest Threads

Latest Profile Posts

imgur sure is getting weird, one day I lose gradually all my images, the other I get them back randomly and then again they disappear again.
Despite OPT2 praise it still has some strange stories in it. Lady Mikka is trying to work herself to death because of guilt. Guilt over what? ¯\_(ツ)_/¯ So instead of finding a NPC to have a heart to heart with her they decide the cure is a new kimono. So when she drops dead she'll at least be well dressed. I haven't even got to the strange part yet.
Did so much work on the game today. I wish I could post it all in this status update but there is a character limit of course haha. I thought about making a topic for updates, though... maybe.
The most recent sign that I am old. I have done martial arts for over 4 decades. Never HAD to stretch out. Good, of course, but never required. Was doing some kicks in the kitchen because, why not, and I felt a pop in the back of my thigh. Now I am limping around. Gotta love getting old.
One of the biggest perks of being fluent in English is how many new and interesting recipes I am able to find and try out that I would have hardly come across if I just spoke my mothertounge :3

Forum statistics

Threads
131,682
Messages
1,222,222
Members
173,435
Latest member
TheAmplifier
Top