[Script] [ACE] [RGSS3] Dark's Relationship System
[align=center][/align]
[align=center][size=x-large]Dark's Relationship System[/size][/align]
[align=center][size=small]Author: Nhat Nguyen (Dark Sky)[/size][/align]
[align=center][size=small]Source: taotrochoi.com[/size][/align]
[align=center][size=x-small]----[/size][/align]
[align=center][size=xx-small]Script được viết riêng cho bạn MinhHoangDo.[/size][/align]
[align=left][chapter]1. Giới Thiệu[/chapter][/align]
[align=left] - Với script này bạn có thể tạo được một hệ thống thể hiện độ thân thiện của từng nhân vật trong game.[/align]
[align=left][chapter]2. Screenshots[/chapter][/align]
Main Window
[align=left][chapter]3. Download[/chapter][/align]
[align=left]Dropbox (Demo) [/align]
[align=left]Script: [/align]
[align=left]
[/align]
[align=left][chapter]4. Cách dùng[/chapter][/align]
- Xem trong demo hoặc script.
[chapter]5. Điều khoản sử dụng[/chapter]
- Credit Dark Sky. PM mình nếu muốn sử dụng cho dự án thương mại.
[align=center][size=x-large]Dark's Relationship System[/size][/align]
[align=center][size=small]Author: Nhat Nguyen (Dark Sky)[/size][/align]
[align=center][size=small]Source: taotrochoi.com[/size][/align]
[align=center][size=x-small]----[/size][/align]
[align=center][size=xx-small]Script được viết riêng cho bạn MinhHoangDo.[/size][/align]
[align=left][chapter]1. Giới Thiệu[/chapter][/align]
[align=left] - Với script này bạn có thể tạo được một hệ thống thể hiện độ thân thiện của từng nhân vật trong game.[/align]
[align=left][chapter]2. Screenshots[/chapter][/align]
Main Window
[align=left][chapter]3. Download[/chapter][/align]
[align=left]Dropbox (Demo) [/align]
[align=left]Script: [/align]
[align=left]
#==============================================================================
# ** Relationship System ( Hệ thống Thiện Cảm )
# Author: Dark Sky ( Nhat Nguyen )
# Release Date: Feb, 12th, 2016
# Version : 1.2
# Change log:
# - Ver 1.0: Release!
# - Ver 1.2: Add Hiding function.
#------------------------------------------------------------------------------
# Hướng dẫn
# - Để thêm sở thích và ghét của Actor vào Database -> notetag.
# <hobby:[Sở thích]> ( Vd: <hobby:Play League of Legends> )
# <dislike:[Ghét]> ( Vd: <dislike:Making Friend> )
# - Để lấy thông tin:
# $game_actors[id].relation_level -> Lấy ra Relationship LV hiện tại của Actor id
# $game_actors[id].cur_fp -> Lấy ra FP hiện tại của Actor id
# $game_actors[id].fp_to_lv -> Lấy ra FP để lên LV tiếp theo.
# - Ẩn một actor:
# $game_actors[id].hide_from_rela = true # Ẩn
# $game_actors[id].hide_from_rela = false # Bỏ Ẩn
# - Mở Scene
# Script Call: SceneManager.call(Scene_Relationship)
#------------------------------------------------------------------------------
# Script này làm theo yêu cầu của bạn MinhHoangDo.
#==============================================================================
#--------------------------------------------------------------------------
# * Relationship Module
#--------------------------------------------------------------------------
module Relationship
Regexp_hobby = /<hobby:(.+)>/i
Regexp_dislike = /<dislike:(.+)>/i
Menu_Option = false # Hiện option Relationship trong Menu.
end
class Scene_Relationship < Scene_MenuBase
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
create_help_window
create_status_window
end
#--------------------------------------------------------------------------
# * Create Status Window
#--------------------------------------------------------------------------
def create_status_window
@help_window.set_text("Độ thân thiện với mọi người")
@status_window = Window_Relationship.new(0, @help_window.height)
@status_window.height = Graphics.height - @help_window.height
@status_window.width = Graphics.width
@status_window.contents_width
@status_window.contents_height
@status_window.create_contents
@status_window.refresh
@status_window.select(0)
@status_window.activate
@status_window.set_handler(:cancel, method(:return_scene))
if $TEST
@status_window.set_handler(:ok, method(:test))
end
end
#--------------------------------------------------------------------------
# * Testing Method // For Debugging
#--------------------------------------------------------------------------
def test
$game_party.members[@status_window.index].increase_fp_point(10)
@status_window.refresh
@status_window.activate
end
end
if Relationship::Menu_Option == true
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# * For Adding Original Commands
#--------------------------------------------------------------------------
alias add_original_commands_darksky_rela add_original_commands
def add_original_commands
add_original_commands_darksky_rela
add_command("Relationship", :relationship, true)
end
end
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
create_command_window
create_gold_window
create_status_window
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
alias create_command_window_dark_rela create_command_window
def create_command_window
create_command_window_dark_rela
@command_window.set_handler(:relationship, method(:on_relationship_ok))
end
def on_relationship_ok
SceneManager.call(Scene_Relationship)
end
end
end
#--------------------------------------------------------------------------
# * Game Interpreter
#--------------------------------------------------------------------------
class Game_Interpreter
#--------------------------------------------------------------------------
# * Tăng FP của Actor
#--------------------------------------------------------------------------
def increase_fp(actor_id,point)
$game_actors[actor_id].increase_fp_point(point)
end
#--------------------------------------------------------------------------
# * Tăng Relationship Level của Actor
#--------------------------------------------------------------------------
def increase_relationship_lv(actor_id,lv)
$game_actors[actor_id].relation_level += lv
$game_actors[actor_id].reset_fp_status
end
#--------------------------------------------------------------------------
# * Đặt Relationship Level của Actor
#--------------------------------------------------------------------------
def set_relationship_lv(actor_id,lv)
$game_actors[actor_id].relation_level = lv
$game_actors[actor_id].reset_fp_status
end
end
class Game_Actor
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :relation_level
attr_accessor :cur_fp
attr_accessor :fp_to_lv
attr_accessor :hobby
attr_accessor :dislike
attr_accessor :cur_fp_to_lv
attr_accessor :hide_from_rela
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias init_dark_rela initialize
def initialize(actor_id)
init_dark_rela(actor_id)
@relation_level = 0
@cur_fp = 0
@cur_fp_to_lv = 0
@fp_to_lv = 0
get_fp_to_lv()
@hide_from_rela = false
get_next_lv_fp()
$data_actors[actor_id].note.split(/[\r\n]+/).each do |line|
case line
when Relationship::Regexp_hobby
@hobby = $1.to_s
when Relationship::Regexp_dislike
@dislike = $1.to_s
end
end
end
def increase_fp_point(point)
point2 = point
while point2 > 0
@cur_fp += 1
point2 -= 1
if @cur_fp >= @cur_fp_to_lv
@relation_level += 1
@cur_fp = 0
get_fp_to_lv()
@cur_fp_to_lv = @fp_to_lv
end
end
end
def reset_fp_status
get_fp_to_lv
get_next_lv_fp
end
#--------------------------------------------------------------------------
# * Get FP to next LV
#--------------------------------------------------------------------------
def get_fp_to_lv
@fp_to_lv = (@relation_level+1)*10
return @fp_to_lv
end
#--------------------------------------------------------------------------
# * Get current FP to LV
#--------------------------------------------------------------------------
def get_next_lv_fp
@cur_fp_to_lv = @fp_to_lv - @cur_fp
return @cur_fp_to_lv
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_Relationship < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 0, 0)
create_actor_list
refresh
end
def create_actor_list
@data = $game_party.members.select {|actor| !actor.hide_from_rela }
p @data
end
#--------------------------------------------------------------------------
# * Get Number of Items
#--------------------------------------------------------------------------
def item_max
@data.size
end
#--------------------------------------------------------------------------
# * Get Item Height
#--------------------------------------------------------------------------
def item_height
101
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
actor = @data[index]
rect = item_rect(index)
draw_actor_face(actor, rect.x + 1, rect.y + 1, true)
draw_actor_relationship(actor, rect.x + 108, rect.y + line_height / 2)
end
#--------------------------------------------------------------------------
# * Draw Simple Status
#--------------------------------------------------------------------------
def draw_actor_relationship(actor, x, y)
maxfp = actor.get_fp_to_lv
cur_fp = actor.cur_fp
rate = 0
rate = (cur_fp.to_f / maxfp.to_f)
color1 = tp_gauge_color1
color2 = tp_gauge_color2
draw_actor_name(actor, x, y)
draw_gauge(x, y+20, 290, rate, color1, color2)
change_color(system_color)
draw_text(x+100,y,300,line_height,"Mức thiện cảm LV ")
change_color(normal_color)
draw_text(x+270,y,300,line_height,sprintf("%2d", actor.relation_level))
change_color(system_color)
draw_text(x+300,y,300,line_height,"FP Hiện tại")
change_color(normal_color)
draw_text(x+370,y+25,300,line_height,sprintf("%4d", actor.cur_fp))
change_color(system_color)
draw_text(x+315,y+45,120,line_height,"FP để lên Lv")
change_color(normal_color)
draw_text(x+370,y+65,300,line_height,sprintf("%4d", actor.cur_fp_to_lv))
change_color(tp_gauge_color2)
if actor.hobby != nil
draw_text(x,y + 45,64,line_height,"Thích:")
change_color(normal_color)
draw_text(x+64,y + 45,300 - 64,line_height,"#{actor.hobby}")
else
draw_text(x,y + 45,64,line_height,"Thích:")
change_color(normal_color)
draw_text(x+64,y + 45,300 - 64,line_height,"Không có!")
end
change_color(knockout_color)
if actor.dislike != nil
draw_text(x,y + 65,64,line_height,"Ghét:")
change_color(normal_color)
draw_text(x+64,y + 65,300 - 64,line_height,"#{actor.dislike}")
else
draw_text(x,y + 65,300,line_height,"Ghét:")
change_color(normal_color)
draw_text(x+64,y + 65,300 - 64,line_height,"Không có!")
end
end
end
[/align]
[align=left][chapter]4. Cách dùng[/chapter][/align]
- Xem trong demo hoặc script.
[chapter]5. Điều khoản sử dụng[/chapter]
- Credit Dark Sky. PM mình nếu muốn sử dụng cho dự án thương mại.
Comments
Đang tải về thì phần mềm phát hiện virus xóa luôn file
Nếu là xóa cái Game.exe thì copy file Game.exe từ project khác bỏ vào.
Cái này phải chỉnh lại nữa script nữa đây =]]
Cái đó dùng để Debug thôi. ( Chỉ khi Test mới có ) Người chơi khác không ấn được cái đó đâu :D. Mình update script ở trên rồi nhé. Bạn copy script vào PJ rồi dùng lệnh:
Bạn sử dụng Script call sau để tăng độ thiện cảm cho Actor
increase_fp(ID_của_actor,điểm)
$game_actors[id].hobby = "Some thing" # ID của actor nào thì bạn xem trong Database ấy.