ShiroĒsu

Liczba postów: 42
Dołączył: 19-02-15
Pomógł: 6

|
RE: Pomoc ze skryptem głodu
Mateusz SSJ8 napisał(a):BŁĄD AUTORA SKRYPTU!!!!
Jet10985 popełnił błąd przy funkcjach odpowiedzialnych za ruch gracza (jump) i naliczanie kroków (increase_steps). Zamiast zdefiniować je w "Game_Player", nadpisał je w "Game_Character".
Faktycznie, hyba żem oślepł że tego nie zauważyłem. XD
#===============================================================================
# Hunger/Thirst Factor
# By Jet10985 (Jet)
#===============================================================================
# This script will add a hunger and/or thirst factor to every actor. These
# can effect a lot of things, such as stats in battle, disabling dashing, or
# even life or death.
# This script has: 32 customization option.
#===============================================================================
# Overwritten Methods:
# None
#-------------------------------------------------------------------------------
# Aliased methods:
# Game_Actor: initialize
# Game_Character: jump, increase_steps
# Game_Player: dash?
# Scene_Battle: execute_action_attack, execute_action_skill, execute_action_item,
# execute_action_guard, execute_action_wait, execute_action_escape
# Game_Battler: item_effect, apply_state_changes, atk, def, agi, spi
# Window_Status: refresh
# Scene_Base: update
#===============================================================================
=begin
Komendy do wstawienia w zdarzeniach:
change_hunger(actor, amount)
change_thirst(actor, amount)
actor = członek drużyny, któremu chcecie zmienić daną wartość
amount = o ile chcecie ją zmienić
Ta metoda ODEJMUJE od paska głodu/pragnienia. Jeśli chcecie DODAĆ wprowadźcie wartość ujemną (np. -100)
Aby sprawić, że dany przedmiot redukuje głód/pragnienie wprowadźcie w notatkach co następuje:
<hunger ##>
<thirst ##>
## = o ile chcecie zmniajszyć głód/pragnienie.
To check hunger/thirst, you much use slightly more scripting method such as:
(Aby sprawdzić głód/pragnienie musisz użyć nieco więcej skryptów takich jak:)
Równe:
$game_party.members[actor].hunger == amount
Większe lub równe:
$game_party.members[actor].hunger >= amount
Mniejsze lub równe:
$game_party.members[actor].hunger <= amount
Większe:
$game_party.members[actor].hunger > amount
Mniejsze:
$game_party.members[actor].hunger < amount
UWAGA: Aby sprawdzić pragnienie po prostu zamień "hunger" na "thirst".
actor = ID aktora, któremu chcece sprawdzić głód/pragnienie.
amount = z jaką ilością głodu/pragnienia chcesz porównywać
=end
module HungerThirst
# Chcesz używać współczynnika głodu?
USE_HUNGER = true
# Chcesz używać współczynnika pragnienia?
USE_THIRST = true
# Jaki jest maksymalny głód?
MAX_HUNGER = 2000
# Jakie jest maksymalne pragnienie?
MAX_THIRST = 2000
# Czy postać, której głód/pragnienie przekroczy maksa umiera?
DIE_ON_MAX_HUNGER_OR_THIRST = false
# If the above is set to true, when the dead character is revived
# (jeśli powyższe jest true, to kiedy martwa postać zmartwychwstanie,)
# how much hunger/thirst will be taken away?
# (Ile głodu/pragnienia będzie ujęte?)
REVIVED_HUNGER_LOWER = 2000
REVIVED_THIRST_LOWER = 2000
# Ile głodu będzie dodawane co krok?
STEP_HUNGER_ADDED = 2
# Ile pragnienia będzie dodawane co krok?
STEP_THIRST_ADDED = 5
# Czy dodawać graczowi pragnienie/głód gdy skacze?
JUMP_SYSTEM_COMPATABILITY = true
# Ile głodu dodawać co skok?
JUMP_HUNGER_ADDED = 2
# Ile pragnienia dodawać co skok?
JUMP_THIRST_ADDED = 2
# Ile musi wynosić głód, by postać nie mogła biegać?
# Uwaga: I tak nie będą w stanie biegać, jeśli wyłączyłeś tę opcję.
NO_DASH_HUNGER = 1000
# Jak wyżej, tyle, ze dla pragnienia.
NO_DASH_THIRST = 750
# Czy chcesz, by pragnienie/głód zmniejszał statystyki?
AFFECT_STATS = false
# Ile musi wynosić głód, by spadały statystyki?
LOWER_STATS_HUNGER = 500
# Ile musi wynosić pragnienie, by spadały statystyki?
LOWER_STATS_THIRST = 400
# Mnożnik statystyk, jeśli postać jest zbyt głodna.
# ATK DEF SPI AGI
HUNGER_LOWERED_STATS = [0.8, 0.8, 0.8, 0.8]
# Mnożnik statystyk, jeśli jest zbyt spragniona.
# ATK DEF SPI AGI
THIRST_LOWERED_STATS = [0.9, 0.9, 0.9, 0.9]
# Czy chcesz by walka podnosiła poziom głodu/pragnienia?
BATTLE_ACTIONS_AFFECT = true
# O ile wzrasta głód/pragnienie podczas ataku.
ATTACK_HUNGER_RAISE = 2
ATTACK_THIRST_RAISE = 2
# O ile wzrasta głód/pragnienie przy użyciu umiejętności.
SKILL_HUNGER_RAISE = 2
SKILL_THIRST_RAISE = 2
# O ile wzrasta przy obronie.
GUARD_HUNGER_RAISE = 2
GUARD_THIRST_RAISE = 2
# How much using an item will affect hunger/thirst.
ITEM_HUNGER_RAISE = 2
ITEM_THIRST_RAISE = 1
# I o ile wzrasta przy próbie ucieczki.
ESCAPE_HUNGER_RAISE = 2
ESCAPE_THIRST_RAISE = 2
# A także o ile wzrasta przy czekaniu.
WAIT_HUNGER_RAISE = 2
WAIT_THIRST_RAISE = 2
end
#===============================================================================
# NIE EDYTUJ PONIŻEJ, CHYBA, ZE WIESZ, CO ROBISZ.
#===============================================================================
class Game_Actor
attr_accessor :hunger
attr_accessor :thirst
alias jet5482_initialize initialize unless $@
def initialize(*args)
jet5482_initialize(*args)
@hunger = 0
@thirst = 0
end
end
class Game_Interpreter
include HungerThirst
def change_hunger(actor, amount)
$game_party.members[actor].hunger -= amount
if $game_party.members[actor].hunger > MAX_HUNGER
$game_party.members[actor].hunger = MAX_HUNGER
elsif $game_party.members[actor].hunger < 0
$game_party.members[actor].hunger = 0
end
end
def change_thirst(actor, amount)
$game_party.members[actor].thirst -= amount
if $game_party.members[actor].thirst > MAX_THIRST
$game_party.members[actor].thirst = MAX_THIRST
elsif $game_party.members[actor].thirst < 0
$game_party.members[actor].thirst = 0
end
end
end
module Jet
def self.check_tag_number(obj, tag)
obj.note.split(/[\r\n]+/).each { |notetag|
case notetag
when tag
@result = $1.to_i
end }
return @result
end
end
module RPG
class UsableItem
def lower_hunger
if @hunger.nil?
txt = Jet.check_tag_number(self, /<(?:hunger)[ ]*(\d+)>/i)
@hunger = txt.nil? ? :unhunger : txt.to_i
end
return @hunger
end
def lower_thirst
if @thirst.nil?
txt = Jet.check_tag_number(self, /<(?:thirst)[ ]*(\d+)>/i)
@thirst = txt.nil? ? :unthirst : txt.to_i
end
return @thirst
end
end
end
class Game_Player
include HungerThirst
if JUMP_SYSTEM_COMPATABILITY
alias jet5903_jump jump unless $@
def jump(*args)
for i in 0...$game_party.members.size
$game_party.members[i].hunger += JUMP_HUNGER_ADDED if USE_HUNGER
$game_party.members[i].thirst += JUMP_THIRST_ADDED if USE_THIRST
if $game_party.members[i].hunger > MAX_HUNGER
$game_party.members[i].hunger = MAX_HUNGER
elsif $game_party.members[i].hunger < 0
$game_party.members[i].hunger = 0
end
if $game_party.members[i].thirst > MAX_THIRST
$game_party.members[i].thirst = MAX_THIRST
elsif $game_party.members[i].thirst < 0
$game_party.members[i].thirst = 0
end
end
jet5903_jump(*args)
end
end
alias jet2211_increase_steps increase_steps unless $@
def increase_steps(*args)
for i in 0...$game_party.members.size
$game_party.members[i].hunger += STEP_HUNGER_ADDED if USE_HUNGER
$game_party.members[i].thirst += STEP_THIRST_ADDED if USE_THIRST
if $game_party.members[i].hunger > MAX_HUNGER
$game_party.members[i].hunger = MAX_HUNGER
elsif $game_party.members[i].hunger < 0
$game_party.members[i].hunger = 0
end
if $game_party.members[i].thirst > MAX_THIRST
$game_party.members[i].thirst = MAX_THIRST
elsif $game_party.members[i].thirst < 0
$game_party.members[i].thirst = 0
end
end
jet2211_increase_steps(*args)
end
end
class Game_Player
include HungerThirst
alias jet6901_dash? dash? unless $@
def dash?
for i in 0...$game_party.members.size
if USE_HUNGER
if $game_party.members[i].hunger >= NO_DASH_HUNGER
return false
end
end
if USE_THIRST
if $game_party.members[i].thirst >= NO_DASH_THIRST
return false
end
end
end
jet6901_dash?
end
end
class Scene_Battle
include HungerThirst
if BATTLE_ACTIONS_AFFECT
alias jet0134_execute_action_attack execute_action_attack unless $@
def execute_action_attack
if @active_battler.actor?
@active_battler.hunger += ATTACK_HUNGER_RAISE if USE_HUNGER
@active_battler.thirst += ATTACK_THIRST_RAISE if USE_THIRST
if @active_battler.hunger > MAX_HUNGER
@active_battler.hunger = MAX_HUNGER
elsif @active_battler.hunger < 0
@active_battler.hunger = 0
end
if @active_battler.thirst > MAX_THIRST
@active_battler.thirst = MAX_THIRST
elsif @active_battler.thirst < 0
@active_battler.thirst = 0
end
end
jet0134_execute_action_attack
end
alias jet0135_execute_action_guard execute_action_guard unless $@
def execute_action_guard
if @active_battler.actor?
@active_battler.hunger += GUARD_HUNGER_RAISE if USE_HUNGER
@active_battler.thirst += GUARD_THIRST_RAISE if USE_THIRST
if @active_battler.hunger > MAX_HUNGER
@active_battler.hunger = MAX_HUNGER
elsif @active_battler.hunger < 0
@active_battler.hunger = 0
end
if @active_battler.thirst > MAX_THIRST
@active_battler.thirst = MAX_THIRST
elsif @active_battler.thirst < 0
@active_battler.thirst = 0
end
end
jet0135_execute_action_guard
end
alias jet0136_execute_action_escape execute_action_escape unless $@
def execute_action_escape
if @active_battler.actor?
@active_battler.hunger += ESCAPE_HUNGER_RAISE if USE_HUNGER
@active_battler.thirst += ESCAPE_THIRST_RAISE if USE_THIRST
if @active_battler.hunger > MAX_HUNGER
@active_battler.hunger = MAX_HUNGER
elsif @active_battler.hunger < 0
@active_battler.hunger = 0
end
if @active_battler.thirst > MAX_THIRST
@active_battler.thirst = MAX_THIRST
elsif @active_battler.thirst < 0
@active_battler.thirst = 0
end
end
jet0136_execute_action_escape
end
alias jet0137_execute_action_wait execute_action_wait unless $@
def execute_action_wait
if @active_battler.actor?
@active_battler.hunger += WAIT_HUNGER_RAISE if USE_HUNGER
@active_battler.thirst += WAIT_THIRST_RAISE if USE_THIRST
if @active_battler.hunger > MAX_HUNGER
@active_battler.hunger = MAX_HUNGER
elsif @active_battler.hunger < 0
@active_battler.hunger = 0
end
if @active_battler.thirst > MAX_THIRST
@active_battler.thirst = MAX_THIRST
elsif @active_battler.thirst < 0
@active_battler.thirst = 0
end
end
jet0137_execute_action_wait
end
alias jet0138_execute_action_skill execute_action_skill unless $@
def execute_action_skill
if @active_battler.actor?
@active_battler.hunger += SKILL_HUNGER_RAISE if USE_HUNGER
@active_battler.thirst += SKILL_THIRST_RAISE if USE_THIRST
if @active_battler.hunger > MAX_HUNGER
@active_battler.hunger = MAX_HUNGER
elsif @active_battler.hunger < 0
@active_battler.hunger = 0
end
if @active_battler.thirst > MAX_THIRST
@active_battler.thirst = MAX_THIRST
elsif @active_battler.thirst < 0
@active_battler.thirst = 0
end
end
jet0138_execute_action_skill
end
alias jet0139_execute_action_item execute_action_item unless $@
def execute_action_item
if @active_battler.actor?
@active_battler.hunger += ITEM_HUNGER_RAISE if USE_HUNGER
@active_battler.thirst += ITEM_THIRST_RAISE if USE_THIRST
if @active_battler.hunger > MAX_HUNGER
@active_battler.hunger = MAX_HUNGER
elsif @active_battler.hunger < 0
@active_battler.hunger = 0
end
if @active_battler.thirst > MAX_THIRST
@active_battler.thirst = MAX_THIRST
elsif @active_battler.thirst < 0
@active_battler.thirst = 0
end
end
jet0139_execute_action_item
end
end
end
class Game_Battler
include HungerThirst
alias jet5823_item_effect item_effect unless $@
def item_effect(user, item)
jet5823_item_effect(user, item)
unless @skipped
user.hunger -= item.lower_hunger unless item.lower_hunger == :unhunger
user.thirst -= item.lower_thirst unless item.lower_thirst == :unthirst
if user.hunger > MAX_HUNGER
user.hunger = MAX_HUNGER
elsif user.hunger < 0
user.hunger = 0
end
if user.thirst > MAX_THIRST
user.thirst = MAX_THIRST
elsif user.thirst < 0
user.thirst = 0
end
end
end
alias jet9243_apply_state_changes apply_state_changes unless $@
def apply_state_changes(obj)
if obj.minus_state_set.include?(1) && DIE_ON_MAX_HUNGER_OR_THIRST && self.actor?
self.hunger -= REVIVED_HUNGER_LOWER
self.thirst -= REVIVED_THIRST_LOWER
if self.hunger > MAX_HUNGER
self.hunger = MAX_HUNGER
elsif self.hunger < 0
self.hunger = 0
end
if self.thirst > MAX_THIRST
self.thirst = MAX_THIRST
elsif self.thirst < 0
self.thirst = 0
end
end
self.jet9243_apply_state_changes(obj)
end
if AFFECT_STATS
alias jet0132_atk atk unless $@
def atk
n = jet0132_atk
if self.actor?
if self.hunger >= LOWER_STATS_HUNGER
n *= HUNGER_LOWERED_STATS[0]
end
if self.thirst >= LOWER_STATS_THIRST
n *= THIRST_LOWERED_STATS[0]
end
end
return n
end
alias jet8921_def def unless $@
def def
n = jet8921_def
if self.actor?
if self.hunger >= LOWER_STATS_HUNGER
n *= HUNGER_LOWERED_STATS[1]
end
if self.thirst >= LOWER_STATS_THIRST
n *= THIRST_LOWERED_STATS[1]
end
end
return n
end
alias jet9021_spi spi unless $@
def spi
n = jet9021_spi
if self.actor?
if self.hunger >= LOWER_STATS_HUNGER
n *= HUNGER_LOWERED_STATS[2]
end
if self.thirst >= LOWER_STATS_THIRST
n *= THIRST_LOWERED_STATS[2]
end
end
return n
end
alias jet0213_agi agi unless $@
def agi
n = jet0213_agi
if self.actor?
if self.hunger >= LOWER_STATS_HUNGER
n *= HUNGER_LOWERED_STATS[3]
end
if self.thirst >= LOWER_STATS_THIRST
n *= THIRST_LOWERED_STATS[3]
end
end
return n
end
end
end
class Window_Status
alias jet5840_refresh refresh unless $@
def refresh
jet5840_refresh
self.contents.font.color = system_color
self.contents.draw_text(50, 310, 100, 24, "Hunger: ")
self.contents.font.color = normal_color
self.contents.draw_text(150, 310, 100, 24, @actor.hunger)
self.contents.font.color = system_color
self.contents.draw_text(50, 334, 100, 24, "Thirst: ")
self.contents.font.color = normal_color
self.contents.draw_text(150, 334, 100, 24, @actor.thirst)
end
end
class Scene_Base
include HungerThirst
alias jet2034_update update unless $@
def update
jet2034_update
unless $scene.is_a?(Scene_Title)
for actor in $game_party.members
if actor.hunger == MAX_HUNGER && DIE_ON_MAX_HUNGER_OR_THIRST && actor.hp != nil
actor.hp = 0
if $game_party.all_dead?
@window = Window_Help.new
@window.y = 152
@window.set_text("Your last party member has died of hunger.", 1)
loop do
if Input.trigger?(Input::C)
@window.dispose
$scene = Scene_Gameover.new
break
end
end
end
elsif actor.thirst == MAX_THIRST && DIE_ON_MAX_HUNGER_OR_THIRST && actor.hp != nil
actor.hp = 0
if $game_party.all_dead?
@window = Window_Help.new
@window.y = 152
@window.set_text("Your last party member has died of Thirst.", 1)
loop do
if Input.trigger?(Input::C)
@window.dispose
$scene = Scene_Gameover.new
break
end
end
end
end
end
end
end
end
unless $engine_scripts.nil?
JetEngine.active("Hunger/Thirst", 1.2)
end
Teraz powinno działać. ;)
Jeżeli myślisz że czegoś nie osiągniesz, masz rację niczego nie osiągniesz tak myśląc.
|
|