Krótki opis:
Widziałem na forum już wiele próśb o jakiś system głodu i pragnienia. W jednym z tematów zauważyłem linki, które podała Ayene i postanowiłem przetłumaczyć ów skrypt dla potrzeb szerszej publiki, również nieanglojęzycznej :)
Funkcje skryptu (jeśli postać zbyt głodna):
- Zmniejsza statystyki postaci
- Uniemożliwia bieganie
- Zabija
Pozostałe funkcje:
- Przedmioty redukujące głód/pragnienie
- Dodanie głodu/pragnienia przy ataku, użyciu umiejętności, obronie, skoku...
- Naliczanie wg. liczby kroków
- Ujmowanie poprzez zdarzenie (np. oazy, źródełka)
Autor skryptu:
Jet10985 (Jet)
Kompatybilność:
O ile się nie mylę, tylko VX. Ale nie sprawdzałem na XP
Skrypt:
Spoiler:
Kod:
#===============================================================================
# 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
#===============================================================================
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:)
# Jakie jest maksymalne pragnienie?
MAX_THIRST = 2000
# Czy postać, której głód/pragnienie przekroczy maksa umiera?
DIE_ON_MAX_HUNGER_OR_THIRST = true
# 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 = 500
REVIVED_THIRST_LOWER = 300
# Ile głodu będzie dodawane co krok?
STEP_HUNGER_ADDED = 50
# Ile pragnienia będzie dodawane co krok?
STEP_THIRST_ADDED = 1
# 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 = true
# 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 = 10
ATTACK_THIRST_RAISE = 7
# O ile wzrasta głód/pragnienie przy użyciu umiejętności.
SKILL_HUNGER_RAISE = 8
SKILL_THIRST_RAISE = 6
# O ile wzrasta przy obronie.
GUARD_HUNGER_RAISE = 5
GUARD_THIRST_RAISE = 4
# 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 = 5
ESCAPE_THIRST_RAISE = 6
# 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_Character
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
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
Demo:
Nie bardzo jest jak zobrazować całość...
Screenshot:
Nie ma za bardzo jak zrobić - musiałby być jakiś HUD...
Instrukcja:
Wklej nad main jak zwykle, a reszta jest w skrypcie.
Konfiguracja również opisana w skrypcie.
A co? Simsy tworzysz?
Na razie tłumaczę jeszcze skrypt wytrzymałości, też niedługo wrzucę go do tego działu.
A czystość i siku możesz zapewne stworzyć zwiększając ilość zmiennych w tym skrypcie. Nie pytaj mnie jak, to już bardziej pytanie do Ayene
________________________
"Na trolla pewne są tylko dwie pewne metody, jedna samopowtarzalna i druga, wymagająca przeładowania ręcznego."
Hmm... Spróbuj zmieniać wartość maksymalnej ilości pragnienia/głodu i zobacz, czy czas po jakim postać się blokuje jakoś od tego zależy.
Ew. wyłącz opcję, która zabija gracza po danej ilości głodu/pragnienia, możliwe, że to jest to.
________________________
"Na trolla pewne są tylko dwie pewne metody, jedna samopowtarzalna i druga, wymagająca przeładowania ręcznego."
Postacie się blokują po czterech krokach, bo max głód jest ustawiony 200 a zabiera nam 50 przy każdym kroku, proponuję zmienić głód na 2000 i jest gites
________________________ Obecny projekt - Chwilowo brak
Pomogła: 232 razy Dołączyła: 18 Wrz 2007 Posty: 2424
Wysłany: Sro 29 Cze, 2011 11:52
A próbowaliście za zmienną podstawić wartość głodu? Korzystając z polecenia 'Script' wpiszcie:
Kod:
var = $game_party.members[ACTOR].hunger
$game_variables[ID] = var
gdzie:
actor = indeks postaci w drużynie (od zera), której chcecie sprawdzić głód, czyli pierwsza postać w drużynie ma indeks 0, druga - 1, trzecia - 2 itd.
ID - to id zmiennej, która ma przetrzymywać wartość głodu dla tej postaci
Następnie w oknie wiadomości za pomocą polecenia \v[ID] wyświetlcie wartość zmiennej.
Czy na pewno masz takie coś(to tylko zarys)
Np.
<hunger 10>
<thirst 10>
[To trzeba wklejic w notatkach]
Jezeli wpiszesz 10 to będzie odejmować głód
A jezeli -10 (Czy cos takiego) będzie dodawać ze jakby coś ze postać coś zjadła
PS.fajny skrypt!
________________________ Lubie Placki
*Gram w Miencraft*
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum