Improved CONFUSED state - uses battler skills instead of meele only

Nugem

The Hobbit
Veteran
Joined
Jun 28, 2013
Messages
93
Reaction score
0
First Language
PT-BR
Primarily Uses
As we know well, in VX ACE when a battler (hero or enemy) is under a CONFUSED state he will just use (001: Attack) skill rather than all it's skills like Final Fantasy series and other RPGs.

The question is: there's any way to change this? A script? Is it really hard to make a script for this?

Anyway, thanks!
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
797
Reaction score
350
First Language
English
Primarily Uses
N/A
I don't mind battlers just using attack when confused, however, I'd like to see some more diverse skill use when under "charm"

Gotta go do some script hunting!
 

Nugem

The Hobbit
Veteran
Joined
Jun 28, 2013
Messages
93
Reaction score
0
First Language
PT-BR
Primarily Uses
I don't mind battlers just using attack when confused, however, I'd like to see some more diverse skill use when under "charm"

Gotta go do some script hunting!
Yeah! I've hunted a lot but without results. Please, If you find something post it here. Thanks!
 

Nugem

The Hobbit
Veteran
Joined
Jun 28, 2013
Messages
93
Reaction score
0
First Language
PT-BR
Primarily Uses
So, anyone have any idea how to change this behavior?

This issue is prolly linked with the "ATTACK ALLY" option at STATES in the DATABASE.

Theres prolly a bult-in script for that and when modified we could get it to use more skills rather than default "001:Attack"

Maybe adding a behavior similar to auto-battle?

I know we've got very talented scripters here.

I would be very thankful if somebody could fix this "issue" that bothers me a lot.
 
Last edited by a moderator:

Nugem

The Hobbit
Veteran
Joined
Jun 28, 2013
Messages
93
Reaction score
0
First Language
PT-BR
Primarily Uses
Update here:

In GAME_ACTION  I've found the definition of confusion state:

  def set_confusion
    set_attack
  end


I've managed to change it to:

  def set_confusion
    set_skill(22)
  end


Now, obviously the confused battler uses the skill 22 in the database. If I could make it to use all his default skills like an auto-battler...
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
854
First Language
English
Primarily Uses
RMMV
I'm tinkering with the script now. Seems fairly straight forward.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Just replace it to grab a random skill from the subject's skill or action list.


For enemies this is easy: it's just the enemy's list of actions.


For actors, you need to add attack and guard to the list.


If you want to execute an arbitrary command such as using items or something...that's a bit more engaged.
 
Last edited by a moderator:

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
854
First Language
English
Primarily Uses
RMMV
This should work. Keep in mind I have not tested the script much, and there may be unforeseen ... complications. This is also an over-write, so other battle-related scripts may run into issues.

class Game_Action #-------------------------------------------------------------------------- # * Set Confusion Action #-------------------------------------------------------------------------- def set_confusion if subject.enemy? == true subject.make_actions else confused_skill = Array.new confused_skill.push($data_skills[subject.attack_skill_id]) if subject.attack_usable? confused_skill.push($data_skills[subject.guard_skill_id]) if subject.guard_usable? confused_skill.concat(subject.usable_skills) confused_skill.concat(subject.usable_items) @item.object = confused_skill[rand(confused_skill.size-1)] end end endclass Game_Actor #-------------------------------------------------------------------------- # * Get Array of Currently Usable Items #-------------------------------------------------------------------------- def usable_items $game_party.items.select {|item| usable?(item) } end endEDIT : Edited for sake of code prettiness.Eeh, and the 'All Enemies' option on a skill is not working the way it should ... I'll tinker with it some more.
 
Last edited by a moderator:

Nugem

The Hobbit
Veteran
Joined
Jun 28, 2013
Messages
93
Reaction score
0
First Language
PT-BR
Primarily Uses
This should work. Keep in mind I have not tested the script much, and there may be unforeseen ... complications. This is also an over-write, so other battle-related scripts may run into issues.

class Game_Action #-------------------------------------------------------------------------- # * Set Confusion Action #-------------------------------------------------------------------------- def set_confusion if subject.enemy? == true subject.make_actions else confused_skill = Array.new confused_skill.push($data_skills[subject.attack_skill_id]) if subject.attack_usable? confused_skill.push($data_skills[subject.guard_skill_id]) if subject.guard_usable? confused_skill.concat(subject.usable_skills) confused_skill.concat(subject.usable_items) @item.object = confused_skill[rand(confused_skill.size-1)] end end endclass Game_Actor #-------------------------------------------------------------------------- # * Get Array of Currently Usable Items #-------------------------------------------------------------------------- def usable_items $game_party.items.select {|item| usable?(item) } end endEDIT : Edited for sake of code prettiness.Eeh, and the 'All Enemies' option on a skill is not working the way it should ... I'll tinker with it some more.
Guess what, you saved my life again!!

Except for the fact that the battler can use "USER ONLY" skills on targets (don't know why exactly), It works just fine!

Thanks! I own you two!!

I might not be really advanced, but Im a designer, if you need anyting graphic-related for your projet, contact me.

You can have a sample of my work in DeviantArt profile! Obviously, the most recent works shows my actual skills.
 
Last edited by a moderator:

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
854
First Language
English
Primarily Uses
RMMV
confusion_target
Yeap. I thought I could find a native method I could use, but I ended up having to write one.

At any rate, the code does work ... albeit hacky.

Code:
class Game_Action    #--------------------------------------------------------------------------  # * Set Confusion Action  #--------------------------------------------------------------------------  def set_confusion    if subject.enemy? == true      subject.make_actions    else      confused_skill = Array.new      confused_skill.push($data_skills[subject.attack_skill_id]) if subject.attack_usable?      confused_skill.push($data_skills[subject.guard_skill_id]) if subject.guard_usable?      confused_skill.concat(subject.usable_skills)       confused_skill.concat(subject.usable_items)      @item.object = confused_skill[rand(confused_skill.size-1)]    end  end    #--------------------------------------------------------------------------  # * Create Target Array  #--------------------------------------------------------------------------  unless method_defined?(:ex_ga_make_targets)    alias_method(:ex_ga_make_targets, :make_targets)  end    def make_targets(*args, &block)    if !forcing && subject.confusion?      return confusion_target if confusion_target.is_a?(Array)    end    ex_ga_make_targets(*args, &block)  end    #--------------------------------------------------------------------------  # * Target When Confused  #--------------------------------------------------------------------------  def confusion_target(*args, &block)    case subject.confusion_level    when 1      unit_scope(opponents_unit)    when 2      if rand(2) == 0        unit_scope(opponents_unit)      else        unit_scope(friends_unit)      end    else      unit_scope(friends_unit)    end  end    #--------------------------------------------------------------------------  # * Unit Scope  #--------------------------------------------------------------------------  def unit_scope(unit)        if item.for_random?      Array.new(item.number_of_targets) { unit.random_target }    elsif item.for_user?      [subject]    elsif item.for_dead_friend?      if item.for_one?        [unit.smooth_dead_target(@target_index)]      else        unit.dead_members      end    elsif item.for_one?      num = 1 + (attack? ? subject.atk_times_add.to_i : 0)      if @target_index < 0        [unit.random_target] * num      else        [unit.smooth_target(@target_index)] * num      end    else      unit.alive_members    end  end  endclass Game_Actor    #--------------------------------------------------------------------------  # * Get Array of Currently Usable Items  #--------------------------------------------------------------------------  def usable_items    $game_party.items.select {|item| usable?(item) }  end  end
 
Last edited by a moderator:

Nugem

The Hobbit
Veteran
Joined
Jun 28, 2013
Messages
93
Reaction score
0
First Language
PT-BR
Primarily Uses
And works just great here!

I'm sure this script will also help a lot of ppl besides me!

'bout that "USER ONLY" target issue, not really a problem. In my case this kind of skill just add a state, so make battlers immune to that state ;)

Thanks again, Exhydra!!

Anything just contact me!

Also, thanks to Tsukihime for the support!
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
854
First Language
English
Primarily Uses
RMMV
I updated my previous message with code that should resolve the 'User Only' issue.
 

Nugem

The Hobbit
Veteran
Joined
Jun 28, 2013
Messages
93
Reaction score
0
First Language
PT-BR
Primarily Uses
I updated my previous message with code that should resolve the 'User Only' issue.
Really?! Wow!! Thats just awesome!

Now I own you three!!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,868
Messages
1,017,066
Members
137,576
Latest member
SadaSoda
Top