theolis-wolfpaw

Villager
Member
Joined
Jan 4, 2016
Messages
22
Reaction score
4
First Language
English
Oh boy, so I've been making these wasp enemies and have been running into so many issues, simply because they interact with other enemies. First I couldn't get them to keep track of how many of them there were, now I'm having trouble getting them to target a flower. I know that sounds weird, so let me explain:

The hornets have a skill called Gather Nectar, it is meant to heal them and give them a state that buffs their max HP, ATK, and MAT. The idea, though, is they can only use the when there is a flower enemy present, they can identify the flower because it has a passive state called Nectar Flower. Specifically, the skill works by them targeting the flower, and through action sequences they move to it, it plays an animation on the flower, and they get the effects of the skill. This works fine if they use it randomly, with no other conditions, but I want them to use it more often when their HP is low, so this is what I have in their AI Priority:

<AI Priority>State === State 194 && eval user.hp <= user.mhp * 0.45: skill 533State === State 194 && eval user.hp <= user.mhp * 0.33: skill 533variable 22 >= 2: skill 531always: skill 1State === State 194: skill 533</AI Priority>State 194 is Nectar Flower, and skill 533 is Gather Nectar, the one at the bottom works fine, but the two at the top have them targeting themselves, instead. This even occurs if the flower is defeated, the bottom tag still works fine (they won't use Gather Nectar at all if there is no flower and their health is above 45%), but again they target themselves if they have low HP. Is there anyway to make them use the skill more often at low health, but make them have to target the flower?
 

Crimson Dragon Inc.

Crimson Dragon
Veteran
Joined
Aug 8, 2012
Messages
921
Reaction score
135
First Language
english
Primarily Uses
RMMV
you might have to make it target a specific enemy instead... of state..... this way only the flower can be targeted when they use the ability and only while the flower is alive
 

theolis-wolfpaw

Villager
Member
Joined
Jan 4, 2016
Messages
22
Reaction score
4
First Language
English
Would you have any idea how to do that? All of the targeting options in the plugin seem to be stat based (which is not going to guarantee the correct target is chosen) or the first target, which should just be the first enemy that's alive.
 

Crimson Dragon Inc.

Crimson Dragon
Veteran
Joined
Aug 8, 2012
Messages
921
Reaction score
135
First Language
english
Primarily Uses
RMMV
well i know the enemy id on the troop is based on the order they are placed when you made the troop.... um he had some nice things in the video

http://yanfly.moe/2015/10/19/yep-16-battle-a-i-core/ here is a link.... the video has nice tips and if you cant find the proper one here you could ask him directly.... 

cuase i'm pretty sure if you set the condition and then have the target be monster id(id for the troop not the database or if its for database its id in database) then it should work (havent actually played around with the script that much due to other things i need to work on
 

theolis-wolfpaw

Villager
Member
Joined
Jan 4, 2016
Messages
22
Reaction score
4
First Language
English
Unfortunately, I can't set the target to be a specific troop ID, cause then that restricts it to one specific troop set up, not that I would know how to do that in the first place. I think my problem is in the eval user, means the potential targets of the skill, so by checking for the user's hp I think it's telling the script it's okay to target things that don't have the state. I know that sounds completely wrong, but I have no other ideas.

EDIT: No, it can't be the case, user is the current battler, because this problem only occurs when the hornets have low HP, so the game is successfully detecting that the user has low HP, but then it's deciding to throw the state condition out the window.
 
Last edited by a moderator:

Crimson Dragon Inc.

Crimson Dragon
Veteran
Joined
Aug 8, 2012
Messages
921
Reaction score
135
First Language
english
Primarily Uses
RMMV
then set it to the flower's ID in the monster database 

or it probaly has to be set like this

if user.hp <= user.mhp * 0.45

then a second like defining the target 

target with state

then third line

use skill

as in you have to state the condition (45% or less health) then set the target (monster with this state) instead of defining both in one line it has to be two lines
 
Last edited by a moderator:

theolis-wolfpaw

Villager
Member
Joined
Jan 4, 2016
Messages
22
Reaction score
4
First Language
English
I don't think that's how the plugin works, having a new line tells it to set up another evaluation, so I have to have the entire evaluation in one line. Though, I think I know the problem. This is the code Yanfly wrote for checking eval conditions.

AIManager.conditionEval = function(condition) { var action = this.action(); var item = action.item(); var user = this.battler(); var s = $gameSwitches._data; var v = $gameVariables._data; if (!eval(condition)) return false; var group = this.getActionGroup(); this.setProperTarget(group); return true;};All of the other conditions have something like this before it determines valid targets.

var group = this.getActionGroup();var validTargets = [];for (var i = 0; i < group.length; ++i) { var target = group; if (!target) continue; if (this.elementRateMatch(target, elementId, type)) { validTargets.push(target); }}Which means that the eval conditions lacks any filter, it just okays any target in scope of the skill as long as the condition is true. In other words, I don't think there's a work around for this without writing an extension to the plugin.
 

theolis-wolfpaw

Villager
Member
Joined
Jan 4, 2016
Messages
22
Reaction score
4
First Language
English
Well once I found out where it was, it was a laughably simple fix. Like seriously no fuss, for something that I spent almost all day trying to figure out.I just changed the AIManager.conditionEval function to this.

AIManager.conditionEval = function(condition) { var group = this.getActionGroup(); var validTargets = []; var action = this.action(); var item = action.item(); var user = this.battler(); var s = $gameSwitches._data; var v = $gameVariables._data; for (var i = 0; i < group.length; ++i) { var target = group; if (!target) continue; if (!eval(condition)) continue; validTargets.push(target); } if (validTargets.length <= 0) return false; this.setProperTarget(validTargets); return true; }; And it worked, ridiculously perfectly from that point on. Admitedly, I don't think I'd have figured it out if Yanfly hadn't already had most of this code in the other condition's functions. Makes me wonder why they did that, and if I ended breaking something (though it does seem to be working right now).

EDIT: Now I know why, it doesn't work with other conditions, so this notetag works

eval user.hp <= user.mhp * 0.45 && target.isStateAffected(194): skill 533but not this one

State === State 194 && eval user.hp <= user.mhp * 0.45: skill 533This one still has the same issues as before, but I think I won't have to worry too much about having to use the full eval with no other tags.
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

%2FswUmX.png


I'm excited to announce I've received a great deal of feedback from a fellow tactics fan!
bandicam 2023-05-29 22-28-54-159.png
When will I be able to play my own game? There is a lot of work, but I am working hard towards the goal
Add Monser2.png!!
index.php

Happy Memorial Day to those on here like me who live in the United States. :)
Alright got a video of a review of a fake PS5 here. I've decided I'm only going to do maybe 10 videos about bootleg consoles, and then I think I'm going to move on, and post YouTube videos of old video game TV advertisements for franchises like Mario and Sonic and Spyro and all that for a little nostalgia. :cool:

Forum statistics

Threads
131,527
Messages
1,220,547
Members
173,221
Latest member
ZecaVn
Top