Arsist

Veteran
Veteran
Joined
May 16, 2014
Messages
140
Reaction score
10
Primarily Uses
So, I have managed to use text from skill notetags as data before (see below), using examples from scriptors.


But this data has always been based on numerical digits and not arrays, and I'm not really experienced with or can comprehend enough of Regexp processes to figure this out myself.


#Tag items and skills with <armor ignore: x>
#A value of 50 means that an opponent's armor rating will only be
half as effective.
#Do not include the percentage symbol.
module TH
  module Armor_Ignores
    
    Regex = /<armor[-_ ]ignore:\s*(\d+)>/i
  end
end
#===============================================================================
# ** Rest of script
#===============================================================================
module RPG
 class UsableItem < BaseItem
    def armor_ignore
      return @armor_ignore unless @armor_ignore.nil?
      load_notetag_armor_ignore
      return @armor_ignore
    end
    
    def load_notetag_armor_ignore
      res = self.note.match(TH::Armor_Ignores::Regex)
      @armor_ignore = res ? res[1].to_i : 0
    end
  end
end


With this script tidbit example I just posted, I could use in a formula 'item.armor_ignore' for additional processes.


I know that the adjustment to be made would have to be at the

Regex = /<armor[-_ ]ignore:\s*(\d+)>/i

part.


I would like to be able to tag in a skill notetag <secondary effects: [data]>


So if I were to use 'item.secondary_effects' in a formula, it would return the [data] array in the skill's notetag.


An example of an application of this would be for me to make [data] into, say,


[["Poison", 0.3, [1,2], physical, true], ["Burn", 0.15, [1,2], magical, false]]


"Poison" would be the display name for the secondary effect in the battle log, '0.3' would be the base chance of the ailment, [1,2] would be the stat influences of Attack and Luck respectively (meaning that the ATK stat would be normally influential in the effect chance, and the LUK stat would be twice as influential in the effect chance), 'physical' would mean that the chance would be multiplied by the target's Physical damage rate, and 'true' would dictate that the chance would be increased if the skill ended up being critical.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,493
Reaction score
14,823
First Language
English
Primarily Uses
RMMV
I haven't tested this and am just making the suggestion based on something I THINK I had working in my game at some point, but if you try the following, does it give you want you want?

Code:
regex = /<secondary effects:\s*(\.*)>/i
  
module RPG
  class UsableItem < BaseItem
    def load_notetag_armor_secondary_effects
      res = self.note.match(regex)
      @secondary_effects = res ? exec(res[1]) : nil
    end
  end
end



I know a lot of people don't like using exec, but I've found it really handy for turning strings into the appropriate kinds of variables based on their contents.
 

Arsist

Veteran
Veteran
Joined
May 16, 2014
Messages
140
Reaction score
10
Primarily Uses
I tried pasting that script tidbit and then putting 


<secondary effect: [[1,2], [2,1]]>


in the basic attack's notebox and made the damage formula 


puts "#{a.current_action.secondary_effects}"; 10


to test it out, but it just made the damage nil out, saying it dealt no damage and displaying no text on the console beforehand. I know there's nothing wrong with the current_action process, because


puts "#{a.current_action}"; 10


works as intended.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,493
Reaction score
14,823
First Language
English
Primarily Uses
RMMV
you've spelled the word incorrectly in the note tag.
 

Arsist

Veteran
Veteran
Joined
May 16, 2014
Messages
140
Reaction score
10
Primarily Uses
Sorry, I just quoted my own notetag wrong, hehe. In my test, I did spell it 'effects' and not 'effect'.


But even when spelled correctly, it doesn't work for me.
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

Come join us while we play Pocket Mirror by Astral Shift! :LZSjoy: Starting at 2PM ET today!
Tried changing profile icon but...It just felt weird, you know? Who would even want to talk to me if I didn't have this fat yellow rodent thing....Or whatever it is as a mascot....No one, that's who! I am nothing without it. NOTHING!!..
I am having such a good hair day but because it's thunderstorms all day I don't go out and as such nobody will see my hair >.< It's not often my hair cooperates!
Pretty much stopped posting in the progress thread cuz it feels like talking to the void, lol, so I've just been posting on IG instead. But someone finally liked my post there, lol. Dunno if I'll continue tho. Probably not xD

My game's progressing quite well. Just kinda stuck on mapping right now. Decided to go the side, slightly top down view route. I'm drawing everything from scratch for a personal touch uwu
Stomach isn't feeling too good last time. Perhaps something I ate

Forum statistics

Threads
112,337
Messages
1,067,535
Members
145,979
Latest member
Sebasti4n2
Top