Status
Not open for further replies.

Mattsuharu

Veteran
Veteran
Joined
Apr 15, 2022
Messages
104
Reaction score
39
First Language
English
Primarily Uses
RMVXA
So, I found an awesome mini script in an old post that allow you to use a script call in damage formulas to remove 1 random state that has a special tag on the state box.

The mini script works perfectly!
Ruby:
class RPG::State < RPG::BaseItem
  def neg_state?
    self.note =~ /<neg>/i
  end
end

class Game_Battler < Game_BattlerBase
 
  def remove_random_state
    return if neg_states_and_debuffs.empty?
    state_id = neg_states_and_debuffs.sample
    state_id.is_a?(Array) ? remove_buff(state_id[0]) : remove_state(state_id)
  end
 
  def neg_states_and_debuffs
    debuffs = Hash[@buffs.map.with_index { |x,i| [i,x] }]
    debuffs = (debuffs.select { |k,v| v < 0 }).to_a
    return @states.select { |s| $data_states[s].neg_state? } + debuffs
  end
 
end

But there's a little problem, I'm also using a script that make that the same stats can be stacked. The problem with the mini script, is that it erase all stacks of a same state. Is there some way to fix the script to make it only erase 1 stack of a same state?
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
512
Reaction score
219
First Language
English
Primarily Uses
RMXP
Didn't I recommend you or a similar forumer that it was better just to stack extra turns instead of copies of a given state?

I strongly believe your problem has a lot to do with a flawed design. Try removing state turns instead.
 

Mattsuharu

Veteran
Veteran
Joined
Apr 15, 2022
Messages
104
Reaction score
39
First Language
English
Primarily Uses
RMVXA
Didn't I recommend you or a similar forumer that it was better just to stack extra turns instead of copies of a given state?

I strongly believe your problem has a lot to do with a flawed design. Try removing state turns instead.

I can't quite remember such comment. It could be but I don't remember.
Do you mean adding turns to the duration of states?
My game has a lot of unique mechanics that depends on the number of times a state is applied. Some of them are not even related to turns.

I'm making a card game based on yugioh, and I tried to recreate some cards the best I can. For example this card:
1660751015509.png
In yugioh you can have a maximum of 3 copies of a card. If you use 3 times the skill related to this card, you will have the same state 3 times, allowing you to gain 200 ATK * 3.
If I didn't have the stacks, it will only do it once. Also, this card (state) is permanently as long as the battle continue or if the state is removed in this case with the script talked above that remove states, so adding "turns" would do nothing.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
512
Reaction score
219
First Language
English
Primarily Uses
RMXP
Perhaps you should call them buffs and debuffs instead. ;)

Can you give us an example of how exactly you are adding the so called states?

I will see if I can get some spare time to invest it on analysing the original script.
 
Last edited:

Mattsuharu

Veteran
Veteran
Joined
Apr 15, 2022
Messages
104
Reaction score
39
First Language
English
Primarily Uses
RMVXA
Perhaps you should call them buffs and debuffs instead. ;)

Can you give us an example of how exactly you are adding the so called states?

I will see if I can get some spare time to incest it on analysing the original script.

"incest"? :ewat:
hahaha.

ammm, I just add them normally with the traits box in the skills database. Like a regular poison skill would add the poison state to an enemy, nothing too overcomplicated.

EDIT: I'm sorry, after a lot of testing, I discovered that it wasn't the mini script the one that removed all stacks of a same state, it was another script called "quasi passive" that made states tagged with a passive note to not show. For some reason, this script made that removing a state removed all stacks of said state. So this post can be closed.
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,924
Reaction score
2,982
First Language
EN
Primarily Uses
RMMZ

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Sometimes I wonder why I still try and recruit others to help with my games. It never works.
ScreenShot_10_3_2022_4_27_17.png
welp, thanks to Luna MV, I was able to add the Balloon as a window... thus allowing me to edit the font color and outline... so now it looks like comic bubbles above characters. I have NO idea why I couldn't get this to work through more conventional means, but here we are.
CUTE CUTE CUTE.gif
I cannot cease doing cute art
War and Wonder is a 100% choice-based open-world visual novel.
1664821313732.png
1664821466359.png
1664821547746.png
Going live soon on Twitch, and will continue Fortunastreet's game "Verloren". For those who are curious, you are welcome to join ;)

-> Franz' Twitch channel

Forum statistics

Threads
125,749
Messages
1,173,225
Members
164,911
Latest member
KyzerKiba
Top