Lunatic States - Isolated States?

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
Lunatic States by Yanfly

I just want states to accept any values they're given just once until they're removed. So if I were to use a variable to set a value that the state uses, the effects of said state wouldn't be affected if the value of said variable changed later.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Then you'd probably want to use a localized variable to the actor-state tandem rather than a global variable...

You could do something like

Code:
class Game_Battler  def lunatic_variables_array(state_id)    @lunatic_variables_array = [] if @lunatic_variables_array.nil?    return @lunatic_variables_array[state_id]  end  def set_lunatic_variables_array(state_id,value)    @lunatic_variables_array = [] if @lunatic_variables_array.nil?    @lunatic_variables_array[state_id] = value  endend
Now you have usable variables per state_id per battler which you can use on the state formulas of lunatic states.
 
Last edited by a moderator:

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
I was about to give up on this to be honest. Dealing with hundreds of states could not be more time-consuming than trying to figure this one out, but I digress... Would this be similar to using self state variables from the Self Data Suite? My experience with the Ruby programming language (and programming in general) is limited to this year, so my interpretation of how things should be implemented is perhaps a bit basic.

Here's what I did:

(Requires Actor Self Data and Lunatic States)
damage formula: a.slip(a, b, 4420, 5) ; damage_formula

################################################################################=begin#==============================================================================#---------------------------- Set Slip Effect -----------------------------------#==============================================================================#By: RinobiUsed by skills to set slip damage values. --------------------------------------------------------------------------------Instructions:--------------------------------------------------------------------------------Use "a.slip(a, b, value, element)" without quotes, within a damage formula.--------------------------------------------------------------------------------Avaliable Variables:--------------------------------------------------------------------------------a = user    b = target    v = value    e = variable id--------------------------------------------------------------------------------Examples:--------------------------------------------------------------------------------a.slip(a, b, 1200, 2) ; a.atk * 4 - b.def * 2#==============================================================================#--------------------------------------------------------------------------------#==============================================================================#=end################################################################################class Game_Battler < Game_BattlerBase  def slip(a, b, v, e)    if a.is_a?(Game_Actor)      $game_party.self_variables[[a.id, e]] = ((v / 100.0) * a.level).to_i    else    end  endend
Code:
#==============================================================================## ▼ Yanfly Engine Ace - Lunatic States Package - Slip Damage## -- Requires: YEA - Lunatic States v1.00+##==============================================================================$imported = {} if $imported.nil?$imported["YEA-LSP-SlipDamage"] = true#==============================================================================# ▼ Instructions# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# To install this script, open up your script editor and copy/paste this script# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.## Install this script under YEA - Lunatic States. Then, proceed to use the# proper effects notetags to apply the proper LSP Slip Damage item desired.# Look within the script for more instructions on how to use each effect.##==============================================================================# ▼ Compatibility# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that# it will run with RPG Maker VX without adjusting.## This script requires YEA - Lunatic States v1.00+ to work. It must be placed# under YEA - Lunatic States v1.00+ in the script listing.##==============================================================================if $imported["YEA-LunaticStates"]class Game_BattlerBase   #--------------------------------------------------------------------------  # ● Lunatic States Package Effects - Slip Damage  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  #--------------------------------------------------------------------------  alias lunatic_state_extension_lsp3 lunatic_state_extension  def lunatic_state_extension(effect, state, user, state_origin, log_window)    case effect.upcase          #----------------------------------------------------------------------    # Slip Damage Effect No.0: Slip Damage    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    # Affected receives increasing damage based on the state's remaining turns.    #    # Recommended notetag:    #   <while effect: element x damage>    #   <close effect: element x damage>    #   <leave effect: element x damage>    #----------------------------------------------------------------------    when /ELEMENT[ ](\d+)[ ]DAMAGE/i      s_turns = @state_turns[state.id] + 1      dmg = ($game_party.self_variables[[state_origin.id, $1.to_i]] / s_turns).to_i      rate = element_rate($1.to_i) ; dmg = (rate * dmg).to_i      s_turns == 0 ? dmg : dmg /= s_turns      if $imported["YEA-BattleEngine"] && dmg > 0        text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:hp_dmg], dmg.group)        user.make_rate_popup(rate)        user.create_popup(text, "HP_DMG")      end      user.perform_damage_effect      user.hp = [user.hp - dmg, 1].max      user.add_state(1) if user.hp <= 1    #----------------------------------------------------------------------    # Stop editting past this point.    #----------------------------------------------------------------------    else      so = state_origin      lw = log_window      lunatic_state_extension_lsp3(effect, state, user, so, lw)    end  end end # Game_BattlerBaseend # $imported["YEA-LunaticStates"]#==============================================================================## ▼ End of File##==============================================================================
State Notetags

<close effect: element 5 damage>

<while effect: element 5 damage>
<leave effect: element 5 damage>
(I know it wouldn't work for enemies - testing)

The issue was that "state_origin" always changes to whomever applied the state last, and stacking states just made everything worse. xD How would I convert my current formula to make use of your state variables? Is this even worth doing because making slip states on an individual bases is looking real good right about now...
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Ah, multiple battlers can inflict the same status effect? Hmmmm... Then you'd need to add more key into it or something.


Something like instead of just state_id, you'd need to use some data from the source as well. But the problem with that is you'd then need a custom script or add the state thru a custom method so that you can catch who caused that state
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Agreed. I think this could actually be done by changing the code on state origins (under apply state) to save the parameters of the one who inflicted the state, and then edit the lunatic code to use the saved parameters instead. That should fix the problem. I may investigate this more over the next couple weeks as I do want something similar for my game too.

Otherwise, right now you can weaken the effects of poison by casting a spell to lower the targets MAT on the one who inflicted poison on you (as I use lunatic states to make poison damage based on the MAT of the one who inflicted it)!
 
Last edited by a moderator:

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
I was afraid of this. It seems the problem is much more complicated than I'd thought. Having states added this way was more for game Dev convenience than game balance.

Now instead of having slip damage controlled by 10 states (one per element), I'd have to make a new one per slip damage skill (likely over 100). I made an alternate version of the code just in case it didn't work out. I don't want to give up on this, but I also can't spend too much time pursuing something that isn't entirely necessary.

I know this is a little off topic but, I am having another slight issue.

#---------------------------------------------------------------------- # Protection Effect No.2: Mana Barrier # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Best used with react effect. This causes a set percentage of HP damage to # instead be absorbed into MP. # # Recommended notetag: # <react effect: mana barrier x> #---------------------------------------------------------------------- when /MANA BARRIER[ ](\d+)/i return unless @result.hp_damage > 0 @result.mp_damage = (@result.hp_damage * ($1.to_f / 100.00)).to_i @result.hp_damage = (@result.hp_damage * (1.00 - ($1.to_f / 100.00))).to_i return unless $imported["YEA-BattleEngine"] create_popup(state.name, "REST_ELE")This effect literally multiplies when another state (any other state) is also affecting the target. When damage is received you see the "Mana Barrier" popup twice if the defending target happens to have another state. Three times if the target has two other states, and so on... There's also a noticeable difference in damage reduction.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
That is because Yanfly accidentally used a nested for loop, which causes ALL states to do that. To fix this, delete one of the for loops.

I can send you the fixed version of the script I wrote in a PM, it fixes this problem. I don't know if I'm allowed to post it on the forums though.
 

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

Latest Threads

Latest Posts

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,845
Messages
1,016,961
Members
137,561
Latest member
JaCrispy85
Top