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: 9
  • plugin.png
    plugin.png
    53.8 KB · Views: 9
  • skills.png
    skills.png
    209.4 KB · Views: 9
  • states.png
    states.png
    169 KB · Views: 8

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: 15

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,035
Reaction score
8,955
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
Regular
Joined
Jul 2, 2014
Messages
11,035
Reaction score
8,955
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
Regular
Joined
Jul 2, 2014
Messages
11,035
Reaction score
8,955
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
Regular
Joined
Jul 2, 2014
Messages
11,035
Reaction score
8,955
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
Regular
Joined
Jul 2, 2014
Messages
11,035
Reaction score
8,955
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 Posts

Latest Profile Posts

Some storyboard thingies for an opening cutscene, I started work on it a couple months ago but I didn't get much done.
Cutscecne-Story-Board.png
Is it okay to post links to your game when its completed in the profile posts here? I'm wondering because I've never done it out of concern it may come off as gauche, or may be against some rule or something, but I've seen others do it.
Okay... I went and got examined... apparently I have had 'cardiac events'. But the current problem is a bit of inflammation around my heart, and in airways. So... got some medication and two days off work. Yay. :p
image.png

A lil concept for chara portraits!

Forum statistics

Threads
134,796
Messages
1,250,729
Members
177,588
Latest member
Bomazius
Top