Partagez
Aller en bas
Titou
Titou
Membre

Nombre de messages : 560
Age : 23
Localisation : Isère
Distinction : aucune
Date d'inscription : 22/04/2012

Un petit problème de tag  Empty Un petit problème de tag

le Sam 17 Oct 2015 - 23:14
Salut à toutes et à tous

Encore un problème avec un script oui je sais ^^' mais encore une fois je ne vois pas comment faire.
Alors j'utilise ce script :
Spoiler:
module Moon
module Auto_States
#---------------------------------------------------------------------------
# Dont touch here. These tags are hard coded in the game's scripts,
# if you change something here - it won't work.
#---------------------------------------------------------------------------
BASE_BATTLER_STATES = [ #Actor stats
"hp" , # Current Hit Point
"mhp", # Maximum Hit Point
"mp" , # Current Magic Point
"mmp", # Maximum Magic Point
"tp" , # Current TP
"atk", # ATtacK power
"def", # DEFense power
"mat", # Magic ATtack power
"mdf", # Magic DeFense power
"agi", # AGIlity
"luk", # LUcK
"hit", # HIT rate
"eva", # EVAsion rate
"cri", # CRItical rate
"cev", # Critical EVasion rate
"mev", # Magic EVasion rate
"mrf", # Magic ReFlection rate
"cnt", # CouNTer attack rate
"hrg", # Hp ReGeneration rate
"mrg", # Mp ReGeneration rate
"trg", # Tp ReGeneration rate
"tgr", # TarGet Rate
"grd", # GuaRD effect rate
"rec", # RECovery effect rate
"pha", # PHArmacology
"mcr", # Mp Cost Rate
"tcr", # Tp Charge Rate
"pdr", # Physical Damage Rate
"mdr", # Magical Damage Rate
"fdr", # Floor Damage Rate
"exr" # EXperience Rate
];

ACTOR = [ # Actor only stats
"name", # Name
"nickname", # Nickname
"exp", # Current XP
"class", # Class
"level" # Level
];


TAG_A = /=|=|<|>)\s*(\d*|['|"]\w+['|"])\s*>/i
TAG_R = /=|=|<|>)\s*(\d*|['|"]\w+['|"])\s*>/i
end
end


class RPG::State < RPG::BaseItem

def auto?

return false if get_auto.empty?
return true
end


def check_auto_state
@auto_state = Auto_States.new(@id)
return false if @note.nil?

note.each_line { |l|
if Moon::Auto_States::TAG_A =~ l
next if $1.nil? or $2.nil? or $3.nil?
@auto_state.add($1,$2,$3, true)
end
if Moon::Auto_States::TAG_R =~ l
next if $1.nil? or $2.nil? or $3.nil?
@auto_state.add($1,$2,$3, false)
end
}
return true if @auto_state.empty?
return false
end

def get_auto
check_auto_state if @auto_state.nil?

return @auto_state
end
end

class Auto_States
attr_reader :state_id
def initialize(state_id)
@state_id = state_id
@state_conds = []
@remove_conds = []
end

def empty?
state_empty? and remove_empty?
end

def state_empty?
@state_conds.empty?
end

def remove_empty?
@remove_conds.empty?
end

def add(type, cond, para, adding)
if adding
@state_conds.push( Auto_State_Cond.new(type, cond, para) )
else
@remove_conds.push( Auto_State_Cond.new(type, cond, para) )
end
end

def check(sub)
return [false, @state_id] if state_empty?

@state_conds.each { |sc| return [false, @state_id] unless sc.check(sub) }
return [true, @state_id]
end

def check_r(sub)
return [false, @state_id] if remove_empty?

@remove_conds.each { |rc| return [false, @state_id] unless rc.check(sub) }
return [true, @state_id]
end
end

class Auto_State_Cond
def initialize(type, cond, para)
@type = type
@cond = cond
@para = para
end

def corrections
@type = "class.name" if /^class$/i =~ @type
@cond = "==" if /^=$/ =~ @cond
end

def check(subject)
bbs = Moon::Auto_States::BASE_BATTLER_STATES
a = Moon::Auto_States::ACTOR
return false unless bbs.include?(@type) or a.include?(@type)
if a.include?(@type)
return false unless subject.is_a?(Game_Actor)
end
begin
corrections
sub = "$game_actors"
id = subject.id
return true if eval("#{sub}[#{id}].#{@type} #{@cond} #{@para}")
rescue
print "Auto State Error: #{$!}\t" if $TEST
end
return false
end
end

class Game_System
attr_reader :auto_states

alias game_sys_auto_states_initialize_moon initialize
def initialize
game_sys_auto_states_initialize_moon
@auto_states = []
for i in 0..$data_states.size
state = $data_states[i]
next if state.nil?
@auto_states.push(state.get_auto) if state.auto?
end
end
end

class Scene_Battle
alias auto_states_battle_process_event process_event
def process_event
auto_states_battle_process_event

$game_party.members.each { |battler| auto_states(battler) }
end
alias auto_states_execute_action_moon execute_action
def execute_action
auto_states_execute_action_moon

auto_states(@subject) if @subject.is_a?(Game_Actor)
end

def auto_states(sub)
$game_system.auto_states.each { |s|
next if s.nil?
sc = s.check(sub)
rc = s.check_r(sub)
sub.add_state(sc[1]) if sc[0] and !rc[0]
sub.remove_state(rc[1]) if sub.state?(rc[1]) and rc[0]
}
end
end

Et mon problème c'est que : Je voulais faire une capacité pour chacun de mes personnage, et le bourrin doit, dès qu'il à toute sa vie, gagner 15% de sa force. Alors ce script me sert déjà pas mal pour faire un statuts nommé Break (qui fait perdre des stats dès qu'un personnage à 15% de ces TP ou moins).
Alors il faudrai faire en sorte que le statuts ne sois appliqué que sur le personnage, et que dès qu'il à 100% de sa vie, le statuts soit infligé. C'est tout une histoire de tag, mais je n'arrive pas à déchiffré comment faire :/

Merci d'avance
Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum