DoubleX RMVXA Confusion Edit

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,500
Reaction score
565
First Language
Chinese
Primarily Uses
N/A
DoubleX RMVXA Confusion Edit v1.02f
by DoubleX

Introduction

If a battler has inflicted states with restrictions "attack an enemy", "attack anyone" or "attack an ally", he/she/it'll attack the respective targets via autobattle like actions with the autobattle flag unchanged.
This is done by reversing his/her/its identifications of allies and enemies(allies are identified as enemies and vice versa) with 50% and 100% chance with "attack anyone" and "attack an ally" respectively.
The battler won't just use "Attack"(skill #1), but instead will use all available skills. Actors will randomly pick actions as if they've autobattle flags; Enemies will pick actions according to their action patterns.

Ruby:
#==============================================================================|
#  ** You only need to edit this part as it's about what this script does      |
#------------------------------------------------------------------------------|

#------------------------------------------------------------------------------|
#  * (v1.01a+)Notetag <confusion edit> for states                              |
#    To make a state with those restrictions have edited confusion effects, put|
#    the above notetag into that state's notebox in the database.              |
#------------------------------------------------------------------------------|
#  * (v1.02a+)Notetag <exclude self> for states                                |
#    To make battlers with an edited confusion state never target themselves,  |
#    put the above notetag into that state's notebox in the database.          |
#    This noteag only works on skills picking a single non-random target       |
#------------------------------------------------------------------------------|

module DoubleX_RMVXA
  module Confusion_Edit

#------------------------------------------------------------------------------|
#  * (v1.01a+)Always_Confusion_Edit, default = false                           |
#    Notetags will be ignored and all states with those restrictions will have |
#    the edited confusion effects if Always_Confusion_Edit is true             |
#------------------------------------------------------------------------------|
  Always_Confusion_Edit = false

#------------------------------------------------------------------------------|
#  * (v1.02a+)Always_Exclude_Self, default = false                             |
#    Notetags will be ignored and all states with those restrictions will stop |
#    the battlers from targeting themselves if Always_Exclude_Self is true     |
#    This setting only works on skills picking a single non-random target      |
#------------------------------------------------------------------------------|
  Always_Exclude_Self = false

  end # Confusion_Edit
end # DoubleX_RMVXA

#==============================================================================|

Features
Use of notetags(requires knowledge of notetag usage) to set specific states with those restrictions to have the edited confusion effects
A way to set all states with those restrictions to have edited confusion effects without using notetags(and ignoring them)

Screenshots



How to use
Open the script editor and put this script into an open slot between Materials and Main. Save to take effect.

FAQ
None

Credit and Thanks
DoubleX(Giving me credit is completely optional)
No terms of use other than not claiming this script as created by anyone except DoubleX or his alias

Compatibility
Scripts aliasing or rewriting method:
- evaluate_item_with_target, friends_unit, opponents_unit, prepare, valid?, make_targets, confusion_target, targets_for_opponents or targets_for_friends under class Game_Action
- make_actions under class Game_Actor
may have compatibility issues with this script
Place this script above those aliasing any of these methods if possible

Changelog
v1.02f(GMT 0200 6-6-2020):
- Fixed actions having no targets not executing bug
v1.02e(GMT 0100 13-8-2015):
- Fixed some syntax errors and typos
v1.02d(GMT 1400 7-7-2015):
- Improved this script's efficiency and readability
v1.02c(GMT 0000 2-6-2014):
- Fixed bugs on adding stuff other than damage in custom damage formula
v1.02b(GMT 0300 22-3-2014):
- Fixed bugs on <exclude self> notetag implementations
v1.02a(GMT 0600 21-3-2014):
- Added <exclude self> notetag
v1.01b (GMT 0000 17-1-2014):
- Methods are aliased rather than rewritten
v1.01a (GMT 0000 3-1-2014):
- Added <confusion edit> notetag to enable confusion edit for states
v1.00a (GMT 1600 1-1-2014):
- 1st version of this script finished
 

Attachments

Last edited:

tiagoms

Veteran
Veteran
Joined
May 19, 2014
Messages
181
Reaction score
4
Primarily Uses
Hello doublex again.

Very interesting your script, however, when using:
- VXAce_SP1
- Doublex: Confusion Edit
- Doublex: Unison
           * Fix Unison
- Doublex: Intercept Magic

Link VXAce_SP1: http://forums.rpgmakerweb.com/index.php?/topic/23038-vxace-sp1-bug-fix/

The following problem occurs:
Script "DoubleX - Unison" line 240: NoMethodError ocurred.
Undefined Method 'Size' for # <Game_Action:0x34b5b10>

The test was done only with scripts cited.
The error only occurs when adding the "Edit Confusion" script, and add the notetag <confusion edit> in a state, and after applying it on an actor (1 turn after application)
 
Last edited by a moderator:

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,500
Reaction score
565
First Language
Chinese
Primarily Uses
N/A
Hello doublex again.

Very interesting your script, however, when using:

- VXAce_SP1

- Doublex: Confusion Edit

- Doublex: Unison

           * Fix Unison

- Doublex: Intercept Magic

Link VXAce_SP1: http://forums.rpgmakerweb.com/index.php?/topic/23038-vxace-sp1-bug-fix/

The following problem occurs:

Script "DoubleX - Unison" line 240: NoMethodError ocurred.

Undefined Method 'Size' for # <Game_Action:0x34b5b10>

The test was done only with scripts cited.

The error only occurs when adding the "Edit Confusion" script, and add the notetag <confusion edit> in a state, and after applying it on an actor (1 turn after application)
I've tested but failed to reproduce the error. I've also checked the scripts and it seems that it just have no chance to happen. Would you please give me a demo to work with? It may help me figure out the cause :)
 

tiagoms

Veteran
Veteran
Joined
May 19, 2014
Messages
181
Reaction score
4
Primarily Uses
I've tested but failed to reproduce the error. I've also checked the scripts and it seems that it just have no chance to happen. Would you please give me a demo to work with? It may help me figure out the cause :)
All right! =D

With Erik, in battle, use the "Confusão", and wait. =)

Project1.rar
 

Attachments

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,500
Reaction score
565
First Language
Chinese
Primarily Uses
N/A
All right! =D

With Erik, in battle, use the "Confusão", and wait. =)
The root cause is the VXAce_SP1 you're using. Precisely and technically speaking, it's because it changed the method make_auto_battle_actions under class Game_Actor. The original one is this:

def make_auto_battle_actions @actions.size.times do |i| @actions = make_action_list.max_by {|action| action.value } endendAnd the VXAce_SP1 changed it to this:

def make_auto_battle_actions @actions.size.times do |i| @actions = make_action_list.max_by {|action| action.value } endendOriginally, @actions is an array of Game_Action, but due to the above changes made by the VXAce_SP1, @actions now becomes Game_Action.

It causes my unison script to return error as it expects @actions as an array of Game_Action but now it's actually an Game_Action.

The easiest and fastest way to fix this is to remove the method make_auto_battle_actions under class Game_Actor in the VXAce_SP1, but I don't know if it'll create some other problems :)

Off topic: I don't have any clue why the VXAce_SP1 changes @actions from an array of Game_Action to Game_Action. I don't know what it's trying to achieve and it seems to me that it can screw up lots of stuffs.
 
Last edited by a moderator:

tiagoms

Veteran
Veteran
Joined
May 19, 2014
Messages
181
Reaction score
4
Primarily Uses
 

But so far, the error only occurs if you add the script Confusion Edit.
"this error" ...

In unison, I did only superficial tests (to check the functioning), but had no problems (without the confusion edit).





*** Edit

This "VXace_SP1" script is not official?
 
Last edited by a moderator:

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,500
Reaction score
565
First Language
Chinese
Primarily Uses
N/A
 

But so far, the error only occurs if you add the script Confusion Edit."this error" ...

In unison, I did only superficial tests (to check the functioning), but had no problems (without the confusion edit).





*** Edit

This "VXace_SP1" script is not official?
You can try to test with some actors having autobattle flag and see what happens if you use the VXAce_SP1 and my unison script :)

You had that conclusion as my confusion edit makes confused actors behave like autobattle actors although no autobattle flag is added to them.

It's done by asking those actors to make actions using methods that are used by actors with autobattle flags, i.e., method make_auto_battle_actions under class Game_Actor.

I don't know much about the VXAce_SP1 but I heard from somewhere that it's included in the English version, which doesn't change @actions from an array of Game_Actions to Game_Actions:

def make_auto_battle_actions @actions.size.times do |i| @actions = make_action_list.max_by {|action| action.value } endendMaybe they think they did some undesirable changes to the above method in the VXACE_SP1 so they reverted that method back to what it was, but I don't know what actually happened :D
 
Last edited by a moderator:

tiagoms

Veteran
Veteran
Joined
May 19, 2014
Messages
181
Reaction score
4
Primarily Uses
You can try to test with some actors having autobattle flag and see what happens if you use the VXAce_SP1 and my unison script :)

You had that conclusion as my confusion edit makes confused actors behave like autobattle actors although no autobattle flag is added to them.

It's done by asking those actors to make actions using methods that are used by actors with autobattle flags, i.e., method make_auto_battle_actions under class Game_Actor.

I don't know much about the VXAce_SP1 but I heard from somewhere that it's included in the English version, which doesn't change @actions from an array of Game_Actions to Game_Actions:

def make_auto_battle_actions @actions.size.times do |i| @actions = make_action_list.max_by {|action| action.value } endendMaybe they think they did some undesirable changes to the above method in the VXACE_SP1 so they reverted that method back to what it was, but I don't know what actually happened :D



Indeed, the same error if I add the option of "auto battle" occurs (even without the script "confusion Edit".

After all, you consider "VXAce_SP1" an important script? What does it do? corrects something? add something? (beyond what you already mentioned)

I just added it because many spoke it was official, and almost everything is official, is important.

But would like to know your opinion.
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,500
Reaction score
565
First Language
Chinese
Primarily Uses
N/A
Indeed, the same error if I add the option of "auto battle" occurs (even without the script "confusion Edit".

After all, you consider "VXAce_SP1" an important script? What does it do? corrects something? add something? (beyond what you already mentioned)

I just added it because many spoke it was official, and almost everything is official, is important.

But would like to know your opinion.
My opinion is that you may want to ask someone understanding the VXAce_SP1 what it does then think if you want to change anything. That's the safest approach I can think of.

A faster but more risky approach is to just delete the whole method make_auto_battle_actions under class Game_Actor in the VXAce_SP1 and test if something undesirable happens.
 

tiagoms

Veteran
Veteran
Joined
May 19, 2014
Messages
181
Reaction score
4
Primarily Uses
Got it, so for the purpose of "testing". what is the correct form?

A ) This form (check the number and locations of "ends")

class Game_Actor  #--------------------------------------------------------------------------  # ● 装備できない装備品を外す  #     item_gain : 外した装備品をパーティに戻す  #--------------------------------------------------------------------------  alias vxace_sp1_release_unequippable_items release_unequippable_items  def release_unequippable_items(item_gain = true)    loop do      last_equips = equips.dup      vxace_sp1_release_unequippable_items(item_gain)      return if equips == last_equips    end  endend

B ) Deleting all this. B)

class Game_Actor  #--------------------------------------------------------------------------  # ● 装備できない装備品を外す  #     item_gain : 外した装備品をパーティに戻す  #--------------------------------------------------------------------------  alias vxace_sp1_release_unequippable_items release_unequippable_items  def release_unequippable_items(item_gain = true)    loop do      last_equips = equips.dup      vxace_sp1_release_unequippable_items(item_gain)      return if equips == last_equips    end  end  #--------------------------------------------------------------------------  # ● 自動戦闘時の戦闘行動を作成  #--------------------------------------------------------------------------  def make_auto_battle_actions    @actions.size.times do |i|      @actions = make_action_list.max_by {|action| action.value }    end  endend


******************** EDIT 1

see this :unsure:

http://forums.rpgmakerweb.com/index.php?/topic/23038-vxace-sp1-bug-fix/
 
Last edited by a moderator:

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,500
Reaction score
565
First Language
Chinese
Primarily Uses
N/A
Got it, so for the purpose of "testing". what is the correct form?

A ) This form (check the number and locations of "ends")

class Game_Actor  #--------------------------------------------------------------------------  # ● 装備できない装備品を外す  #     item_gain : 外した装備品をパーティに戻す  #--------------------------------------------------------------------------  alias vxace_sp1_release_unequippable_items release_unequippable_items  def release_unequippable_items(item_gain = true)    loop do      last_equips = equips.dup      vxace_sp1_release_unequippable_items(item_gain)      return if equips == last_equips    end  endend
B ) Deleting all this. B)

class Game_Actor  #--------------------------------------------------------------------------  # ● 装備できない装備品を外す  #     item_gain : 外した装備品をパーティに戻す  #--------------------------------------------------------------------------  alias vxace_sp1_release_unequippable_items release_unequippable_items  def release_unequippable_items(item_gain = true)    loop do      last_equips = equips.dup      vxace_sp1_release_unequippable_items(item_gain)      return if equips == last_equips    end  end  #--------------------------------------------------------------------------  # ● 自動戦闘時の戦闘行動を作成  #--------------------------------------------------------------------------  def make_auto_battle_actions    @actions.size.times do |i|      @actions = make_action_list.max_by {|action| action.value }    end  endend


******************** EDIT 1

see this :unsure:

http://forums.rpgmakerweb.com/index.php?/topic/23038-vxace-sp1-bug-fix/

I've checked the VXAce SP1 Bug Fix there and found something strange with your VXAce_SP1. It's about the method make_auto_battle_actions. The one in that version is this:

def make_auto_battle_actions @actions.size.times do |i| @actions = make_action_list.max_by {|action| action.value } endendAnd yours is this:

def make_auto_battle_actions @actions.size.times do |i| @actions = make_action_list.max_by {|action| action.value } endendAs it seems to me that you didn't touched this, the root cause to this maybe problems related to downloads. I guess that due to some reasons, square brackets(i.e., []) and things included by them(i in this case) are gone during your download. I've checked the whole VXAce SP1 Bug Fix and only the above problematic line has square brackets.

So you can try to replace your VXAce_SP1 with the original VXAce SP1 Bug Fix and see if the square brackets come back: http://forums.rpgmakerweb.com/index.php?/topic/23038-vxace-sp1-bug-fix/
 
Last edited by a moderator:

tiagoms

Veteran
Veteran
Joined
May 19, 2014
Messages
181
Reaction score
4
Primarily Uses
I've checked the VXAce SP1 Bug Fix there and found something strange with your VXAce_SP1. It's about the method make_auto_battle_actions. The one in that version is this:

def make_auto_battle_actions @actions.size.times do |i| @actions = make_action_list.max_by {|action| action.value } endendAnd yours is this:

def make_auto_battle_actions @actions.size.times do |i| @actions = make_action_list.max_by {|action| action.value } endendAs it seems to me that you didn't touched this, the root cause to this maybe problems related to downloads. I guess that due to some reasons, square brackets(i.e., []) and things included by them(i in this case) are gone during your download. I've checked the whole VXAce SP1 Bug Fix and only the above problematic line has square brackets.

So you can try to replace your VXAce_SP1 with the original VXAce SP1 Bug Fix and see if the square brackets come back: http://forums.rpgmakerweb.com/index.php?/topic/23038-vxace-sp1-bug-fix/



 

Truth ...I changed and "Auto Battle" now work perfectly.

Thanks DoubleX (Again)
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,500
Reaction score
565
First Language
Chinese
Primarily Uses
N/A
Updates

v1.02d(GMT 1400 7-7-2015):

- Improved this script's efficiency and readability
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,500
Reaction score
565
First Language
Chinese
Primarily Uses
N/A
Updates


v1.02e(GMT 0100 13-8-2015):


- Fixed some syntax errors and typos
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,500
Reaction score
565
First Language
Chinese
Primarily Uses
N/A
Updates
v1.02f(GMT 0200 6-6-2020):
- Fixed actions having no targets not executing bug
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,323
Reaction score
482
First Language
English
Primarily Uses
RMVXA
@DoubleX I wonder if you could help me find the issue I'm having.
I use Luna Engine and with your script I get an error when attempting to do an auto battle command (Yanfly Command Autobattle script). It just seems to be something to do with the graphical hud?
1591460903906.png
SpriteHUD_Main is a part of Battle_Luna script

If I put your script above Luna Engine It gives an error on line 160.

Thoughts?
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,500
Reaction score
565
First Language
Chinese
Primarily Uses
N/A
@DoubleX I wonder if you could help me find the issue I'm having.
I use Luna Engine and with your script I get an error when attempting to do an auto battle command (Yanfly Command Autobattle script). It just seems to be something to do with the graphical hud?
View attachment 146795
SpriteHUD_Main is a part of Battle_Luna script

If I put your script above Luna Engine It gives an error on line 160.

Thoughts?
While I don't have time to make a formal fix now(it involves making a script fixing a default RMVXA bug), you can still try to place this snippet right below the confusion edit script:
Ruby:
class Game_Action
  def evaluate_item_with_target(target)
    target.result.clear
    target.make_damage_value(subject, item)
    if item.for_opponent?
      return target.result.hp_damage.to_f / [target.hp, 1].max
    else
      recovery = [-target.result.hp_damage, target.mhp - target.hp].min
      return recovery.to_f / target.mhp
    end
  end
end
Just make sure no auto battle actor can ever use any skill/item having its damage formula doing anything other than calculating the damage.
If any of such damage formula have any side effect, the skill/item would trigger a default RMVXA auto battle bug where those side effects would be wrongly applied to all the available targets of the skill/item :)
 

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

Latest Threads

Latest Profile Posts

made a bio for the protag in my project!
Beggar : "I haven't eat for days..."
Kid : "Just do crime! You will get daily necessity for free in prison~"
Stream is a bit late but will be live shortly with some game development! Feel free to drop by!
omg, why persona 5 is so good?

Forum statistics

Threads
99,158
Messages
962,438
Members
130,725
Latest member
teendinsaikha
Top