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,101
Reaction score
14,635
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,101
Reaction score
14,635
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

That moment when you try to figure out a color scheme for an alien ship so that it's something other than "Grey on Grey".
It's up for viewing! See what happened when EquestriAlert got tested in 1997... or was it a test? Did somepony hack the system? Or did somepony push the wrong switch? Even Adagio Dazzle (the owner of the channel) has no clue.

Can you put the pieces together? Don't worry, the game isn't over yet! There's more pieces to add on!
Why parodies are always underrated on your opinion?

Forum statistics

Threads
111,117
Messages
1,058,442
Members
144,335
Latest member
notreeee
Top