pokecath - Wto 05 Lip, 2011 19:53 Temat postu: Zużywalność przedmiotówPotrzebuję skrypt który zrobi ,że np. miecz po 400 uderzeniach rozwala się ,a mocny miecz po 600.Prosiłbym ,aby paski zniszczenia pojawiały się w HUD-zie (http://www.ultimateam.pl/viewtopic.php?t=2452) na ekwipunek i w ekwipunku . Używam skryptu na wyświetlanie ekwipunku(skrypt poniżej) i proszę aby był z nim zgodny.
Spoiler:
Kod:
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
# Khai's Window Helper 1.4
# For suggestion/comment/updates visit the following link
# http://www.rpgrevolution.com/forums/?showtopic=16941
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
module KCWH
# Config BEGIN
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
K_Equip = true # Extra Info [Equip_Scene]
K_Skill = true # Extra Info [Skill_Scene]
K_Item = true # Extra Info [Item_Scene]
K_Item_S = true # Extra Info [Shop_Scene]
K_SimpleItem = true # Simplified Icons
K_Sitem_col = 7 # <=7 if your window width is 544x416
K_MP_ON = true # Disable 0 MP Display
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
# Help Frame SETTING/TEXT ALIGNMENT
K_WH_ON = true # Help ON/OFF
Frame_s = false # Custom Help window frame ON/OFF
K_frame = "Window2" # Custom Help window frame FILE NAME
K_Opacity = 255 # Help window frame opacity (0-255)
K_WH_X = 544 # Help window frame width X (Default: 544)
K_WH_Y = 32 # Help window frame height Y (Default: 32)
K_WH_Z = 0 # Help window frame Z
K_POSX = 0 # Help window X
K_POSY = 0 # Help window X
K_ALIGN = 0 # Help text alignment [0 = left, 1 = center, 2 = right]
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
# Help Backdrop SETTING/LOCATION/STYLE
K_WH = true # Help Backdrop ON/OFF
K_WH_BG = 2 # 0 = default, 1 = image 2 = gradient
# ■■■■■■■ ▼
K_WH_BX = 0 # Background Bar X-Displacement Default 0
K_WH_BY = 0 # Background Bar Y-Displacement Default 0 (12 For style)
# ▼ CONFIGURE for setting = 0 ▼ ■■■
K_WHC = Color.new(255, 0, 0, 255) # Helper backdrop color
# ▼ CONFIGURE for setting = 1 ▼ ■■■
BG = "" # Background Image File
# ▼ CONFIGURE for setting = 2 ▼ ■■■
K_GBC1 = 15 # Left Gradient Color
K_GBC2 = 40 # Right Gradient Color
BG_W = 544 # Width of Gradient Backdrop
BG_H = 32 # Height of Gradient Backdrop
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
# This handles the Helper's Font Color
K_BGC = false # TEXT Color, Config below if = true, else leave alone
K_R = 255 # Red (0-255) 255 being pure red 0 = no red
K_G = 0 # Blue (0-255) 255 being pure blue 0 = no blue
K_B = 0 # Green (0-255) 255 being pure green 0 = no green
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
# Font Setup ▼
Enable_Text = true # Simple Font ON/OFF
Font_Name = 'Arial' # Font Name [Arial,Constantia]
Font_Size = 14 # Font Size
Font_Bold = true # Font Bold
Font_Italic = false # Font Italic
Font_Shadow = true # Font Shadow
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
# Config END
end
class Window_Help < Window_Base
def initialize
super(KCWH::K_POSX, KCWH::K_POSY, KCWH::K_WH_X, WLH + KCWH::K_WH_Y)
self.opacity = KCWH::K_Opacity
self.visible = KCWH::K_WH_ON
if KCWH::Frame_s
self.windowskin = Cache.system(KCWH::K_frame)
end
end
def set_text(text, align = KCWH::K_ALIGN)
if text != @text or align != @align
self.contents.clear
self.z = KCWH::K_WH_Z
def b_color1
return text_color(KCWH::K_GBC1)
end
def b_color2
return text_color(KCWH::K_GBC2)
end
gc1 = b_color1
gc2 = b_color2
if KCWH::K_BGC
self.contents.font.color.set(KCWH::K_R,KCWH::K_G,KCWH::K_B)
else
self.contents.font.color = normal_color
end
if KCWH::K_WH
if KCWH::K_WH_BG == 0
self.contents.fill_rect(KCWH::K_WH_BX, y=KCWH::K_WH_BY, contents.width, WLH - y, KCWH::K_WHC )
elsif KCWH::K_WH_BG == 1
bg_bitmap = Cache.system(KCWH::BG)
self.contents.blt(KCWH::K_WH_BX, KCWH::K_WH_BY, bg_bitmap, bg_bitmap.rect)
elsif KCWH::K_WH_BG == 2
self.contents.gradient_fill_rect(KCWH::K_WH_BX, KCWH::K_WH_BY, KCWH::BG_W, KCWH::BG_H, gc1, gc2)
end
end
@text = text
@align = align
self.contents.draw_text(20, 0, self.width - 72, WLH, text, align)
end
end
end
class Window_Item < Window_Selectable
if KCWH::K_SimpleItem
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = KCWH::K_Sitem_col
self.index = 0
refresh
end
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_icon(item.icon_index, rect.x, rect.y, enabled)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
end
def update_help
if KCWH::K_Item
@help_window.set_text(item == nil ? "" : item.name+": "+item.description)
else
@help_window.set_text(item == nil ? "" : item.description)
end
end
end
if KCWH::Enable_Text
class Font
@@default_name = [KCWH::Font_Name]
@@default_size = KCWH::Font_Size
@@default_bold = KCWH::Font_Bold
@@default_italic = KCWH::Font_Italic
@@default_shadow = KCWH::Font_Shadow
end
end
if KCWH::K_Equip
class Window_Equip < Window_Selectable
def update_help
@help_window.set_text(item == nil ? "" : item.name+": "+item.description)
end
end
end
if KCWH::K_Skill
class Window_Skill < Window_Selectable
def update_help
@help_window.set_text(skill == nil ? "" : skill.name+": "+skill.description)
end
end
end
if KCWH::K_Item_S
class Window_ShopBuy < Window_Selectable
def update_help
@help_window.set_text(item == nil ? "" : item.name+": "+item.description)
end
end
end
if KCWH::K_MP_ON
class Window_Skill < Window_Selectable
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.skill_can_use?(skill)
draw_item_name(skill, rect.x, rect.y, enabled)
if @data[index].mp_cost != 0
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
end
end
end
Angius - Wto 05 Lip, 2011 21:17
Spoiler:
Kod:
#==================================================
# Perishable Items v1.0.0
# By Mithos
#==================================================
# This script allows items that deteriorate, either all at once
# or gradually. Good for minigames (e.g. Zelda style trading quests)
# PERISHING
# in an item's notebox place the tag <perish x item y>
# after x minutes all of the party's items of that kind
# will become item ys
#
# E.g. in a potion's notbox the tag is <perish 5 item 006>
# (where item 6 in the database is poison)
# 5 minutes after recieving a potion, ALL of the party's
# potions will become poison.
#
# gaining more of the same item will reset the timer
# if item y also has a perish tag, it will perish after its
# specified time also. Be careful when giving items to avoid
# having two of the same type if using this
# added a deteriorate function. tag <det x item y> to make it
# work <- Improve this.
#==================================================
# SCRIPT
# Any changes made at users risk.
#==================================================
module Mithos
module REGEX
#notetag for perishing items
PERISH = /<perish\s(\d+)\sitem\s(\d+)>/
#/<perish\s(\d+)\sitem\s(\d+)>/ <- original value in case you want to play
#notetag for deteriorating items
DET = /<det\s(\d+)\sitem\s(\d+)>/
#/<det\s(\d+)\sitem\s(\d+)>/ <- original value in case you want to play
end
end
$imported = {} if !$imported
$imported["Perishable"] = 1.0
class Scene_Base
#alias update to check if item has perished
alias :perish_update :update unless $@
def update
$game_party.perish_items #check if items have perished
perish_update #call original update method
end
end
class Game_Party
alias :init_perish :initialize unless $@
def initialize
@perish_type = []
@perish_time = []
@perish_item = []
init_perish
end
#Find out how long the game has been running in minutes
def play_time
gametime = Graphics.frame_count / Graphics.frame_rate
minutes = gametime / 60 % 60
return minutes
end
#alias gain item to set item countdown
#Note efficient. works though
alias :perish_gain :gain_item unless $@
def gain_item(item, n, include_equip = false)
# Get perish tags
tag = item.note.scan(Mithos::REGEX::PERISH)
det_tag = item.note.scan(Mithos::REGEX::DET)
#set type for this item (det or perish)
@perish_type[item.id] = "perish" if tag[0]
@perish_time[item.id] = tag[0][0].to_i + play_time if tag[0]
@perish_item[item.id] = tag[0][1].to_i if tag[0]
@perish_type[item.id] = "det" if det_tag[0]
@perish_time[item.id] = det_tag[0][0].to_i + play_time if det_tag[0]
@perish_item[item.id] = det_tag[0][1].to_i if det_tag[0]
perish_gain(item, n, include_equip = false)
end
#redefine lose item to not reset counter
def lose_item(item, n, include_equip = false)
perish_gain(item, -n, include_equip)
end
def perish_items
for i in 1..(@perish_time.size - 1)
if @perish_time[i]
if play_time >= @perish_time[i]
if @perish_type[i] == "perish"
# all perish at once
number = $game_party.item_number($data_items[i])
$game_party.lose_item($data_items[i], number)
$game_party.gain_item($data_items[@perish_item[i]], number)
@perish_time[i] = nil
else
#one perishes then timer resets
$game_party.lose_item($data_items[i], 1)
$game_party.gain_item($data_items[@perish_item[i]], 1)
@perish_time[i] += $data_items[i].note.scan(/det\s(\d+)/)[0][0].to_i
end
end
end
end
end
end
Znalazłem tylko niszczenie po czasie. Ale spróbuj poszukać pod "perishable items"pokecath - Sro 06 Lip, 2011 10:24 Nic nie znalazłem. A ten skrypt który podałeś to nie ten co ja potrzebuję.Jeszcze bym zapomniał proszę aby skrypt był kompatybilny z walką w czasie rzeczywistym(chodzi mi o ten pierwszy który pojawił się na forum.)Aruka21 - Nie 10 Lip, 2011 12:53 Możesz to zrobić na zdarzeniach i zmiennych.
Ja osobiście używam walki w czasie rzeczywistym (ABS) i jeśli masz ustawione atak na przycisk np "A" to robisz wstaw warunek przycisk A został naciśnięty zmienna z używalność zwykłego miecza+1. Robisz drugi warunek zmienna Z używalność zwykłego miecza równa jest 400 zwykły miecz usuń z ekwipunku. Tak robisz do każdej broni. Gdzieś na forum jest skrypt, pokazywanie zmiennych w pasku. To razem skleisz i gotowe.
Pozdrawiam Aruka21
Mam nadzieję że pomogłem.Angius - Wto 12 Lip, 2011 15:02 Sposób niezły przyznam. Najlepiej zrobić to na typowych zdarzeniach ustawionych na równoległe. Jedyny mankament to to, że jeśli mamy np. 100 broni, to potrzebujemy 200 typowych zdarzeń (1 na liczenie, 2 na sprawdzanie). No i trzebaby jeszcze zmienić sposób naliczania - u ciebie jest A, jeśli to nie jest ABS trzeba by jakoś zliczać uderzenia... No, chyba, że od ilości zabitych potworów... Ogółem - sporo kombinacji, IMHO już lepiej poszukać/napisać skrypt...