Ahoy, experienced scripters!
I have made a snippet like this:
class RPG::Enemy::Action #!!NEW!! #-------------------------------------------------------------------------- # public instance variables - !!NEW!! #-------------------------------------------------------------------------- attr_accessor :discovery #-------------------------------------------------------------------------- # new method: discovery - !!NEW!! #-------------------------------------------------------------------------- def discovery return false if @discovery.nil? return @discovery endendAnd now I want to set this new data to true when the enemy uses the selected skill, but only after it is executed.I tried to put it in the 'set_enemy_action' definition in the 'Game_Action' class like this:
def set_enemy_action(action) if action set_skill(action.skill_id) action.discovery = true # <-- here else clear end endWhich works but in a rather odd way.I want to display the real info only when the @discovery is true, else it will show a lot of "???????" only. Yeah, it is for a bestiary, showing enemy skills only after the enemy used them at least one.
So, trying this out in a new game makes the info show "???????" for everything like it should.
I have 7 slimes and 1 archer in my battle test. Only the archer used one skill, after that, I debug-killed everything, so no other enemy action was made.
After the battle, the info for the archer shows that it used that single skill only, this part is working like it should.
But when I change to the slime enemy, it shows real info instead of the "???????"s for a few random actions, it always changes after each test.
The check I use for the drawing is good, I did the same for drop items and that one works like it should.
But this one with the skills is killing me. It seems the action is decided before it is actually executed, so it unlocks some other skills for my slimes too, even if they haven't used any skills in the battle.
So, what I need now, is a place to put the discovery data to the right place, so it won't update until the skill is actually used, and not when selected by the randomizer. Does anyone knows where I should set the discovery data to true if I want to achieve what I described above?
Thanks for any help in advance!
[Ace] Enemy Skills - Selection and Actual Trigger Timing
● ARCHIVED · READ-ONLY
-
-
If I am correct, enemy actions are all made at once during the same time the player makes their own action choices. (Either before the player starts their choice-making or as soon as the player finalizes every party member action)
That is why your slime's skill shows instead of ????? without it even attacking yet, because the default engine AI already inputted its commands.
As to where to change it to in order to prevent this, I do not know. =/ -
That doesn't sound good. >.>
So, I guess I must give up on this thing? :(
Is there really no way of doing what I want?
I remember seeing a script which changes how enemy actions are made, it was from Tsukihime, I guess.
I will try my luck with that then.
Thanks for the help!
Well, my memory tricked me, there is no script which would change this.
But doing this:
class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Invoke Skill/Item #-------------------------------------------------------------------------- alias sixth_skill_disc121 invoke_item def invoke_item(target, item) if @subject.is_a?(Game_Enemy) $data_enemies[@subject.enemy_id].actions.each do |action| if action.skill_id == item.id action.discovery = true end end end sixth_skill_disc121(target, item) endendDid exactly what I wanted. :) It seems persistence always prevails when someone needs to find a solution to something. There is always a solution, it just needs to be found. :)