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
517
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
517
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,930
Reaction score
2,991
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 Posts

Latest Profile Posts

New sprites & animations for Mint and Beri are coming along!
Guh-Colorbound.gif
ScreenShot_10_5_2022_4_44_8.png
Mad O' Malley... a stick figure that's afraid of it's existence being erased. so they always start battle in an anxious state.
Before, I was drawing all the sprite work, super big and shrinking it down. Which was really time consuming if thing's changed. So instead I'm drawing the characters sketch, and then remaking it with pixel art instead.
Why are job interviews so terrifying. :kaodes:

Forum statistics

Threads
125,801
Messages
1,173,662
Members
164,964
Latest member
oliveleaf
Top