Cover ability, substitute flag, using a states instead of HP?

Miyoko

Villager
Member
Joined
May 9, 2014
Messages
20
Reaction score
0
First Language
English
Primarily Uses
So a common question I see from people is about how to make substitute work on allies at any HP, instead of just low HP. I was wondering the same thing for a while, until I found a great solution which I've been using. I found someone had posted that if you install this in your materials section in your script editor, everything will work as intended.

Code:
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # overwrite : Check Substitute Condition
  #--------------------------------------------------------------------------
  def check_substitute(target, item)
    (!item || !item.certain?)
  end
end
Which is great! Works perfectly! It's there for anyone to use it if they'd like!


What I want to know, is if there is a way to further change the above formula, so that instead of looking for a discrepancy in HP values (or rather, looking that there is none? ... Which I'm pretty sure it's still not even doing!), it checks to see if enemies have a state on them instead. Allies with a state on them will be covered, while others will still be attacked as per normal.


It'd be nice to have a cover ally ability that doesn't require outside scripts, and I'm just wondering if this is possible!
 

GGZiron

Veteran
Veteran
Joined
Nov 6, 2016
Messages
89
Reaction score
32
First Language
Bulgarian
Primarily Uses
RMVXA
Hello there. Replace the above code with this :

Code:
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # overwrite : Check Substitute Condition
  #--------------------------------------------------------------------------
  def check_substitute(target, item)
    (!item || !item.certain?) and target.state?(state_id) #replace state_id with state's id number
  end
end
I did some testing and worked to me, but recommend you to test too.
Replace state_id with digit - the sate id number from your database.
Hope it helps.
 
Last edited by a moderator:

DeadManJoe

Veteran
Veteran
Joined
Aug 11, 2017
Messages
34
Reaction score
1
First Language
English
Primarily Uses
RMMV
Where is the script editor?
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
246
Reaction score
70
First Language
English
Primarily Uses
RMVXA
Before this topic closes up, here's some pointers:

1. Posting to old posts is frowned upon. If you have a question as general as that, it would have been better to start a new topic in the appropriate section or a topic that is at least recent and relevant. In fact, it's probably an answer covered in some stickied beginner topic.

2. In RPG Maker VX Ace, you should find the Script Editor on the top of your main window, next to Database, Resources, Music and Character Editor. This answer also applies to XP and VX

3. If your next reply is "but I am using RPG Maker MV", then you're posting to the wrong section. Sadly, I don't know if MV has a built-in editor in their Plugin section, but as MV uses Java and VX Ace uses Ruby, this code won't work with MV.

---

Hm, the script's pretty simple and useful.
 

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

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,990
Members
137,562
Latest member
tamedeathman
Top