Synthesize
Member
Script Name: Good VS Evil
Written by: Synthesize
Version: 1.0.0
Release Date: January 26, 2008
What is it?
This script allows the end user (you) to give each playable character an alignment and alignment points. The system works similar to the Baldur's Gate 'reputation system', where x amount of Upgrade points increase the actors alignment. The script automatically draws the alignment in the status screen.
DEMO:
www.4shared.com/file/37416989/279c8641/GoodVSEvil.html
Comments? Concerns? Post them.
Written by: Synthesize
Version: 1.0.0
Release Date: January 26, 2008
What is it?
This script allows the end user (you) to give each playable character an alignment and alignment points. The system works similar to the Baldur's Gate 'reputation system', where x amount of Upgrade points increase the actors alignment. The script automatically draws the alignment in the status screen.
Code:
#===============================================================================
# Good VS Evil --- RMVX Version
#===============================================================================
# Written by Synthesize
# Version 1.0.0
# January 26, 2008
#===============================================================================
# * RMVX Version *
#===============================================================================
module GoodVSEvil
# The initial Alignment for actors
Alignment_initial = {1 => 2, 2 => 3, 3 => -5}
Alignment_initial.default = 0
# The names of the alignments
Alignment_names = ["Very Good", "Good", "Neutral", "Evil", "Devil Child"]
# maximum amount of points
Maximum_alignment = 100
# Maximum amount of evil points
Maximum_evil_alignment = -100
# Format = {value => amount to check}
Rates = {0 => 50, 1 => 25, 3 => -25, 4 => 50}
# Rates configure how many Alignment points a character needs to have
# there alignment 'upgrade'
# $alignment commands:
# $alignment.add(value, member) # Adds value of alignment
# $alignment.remove(value, member) # Removes value from member
# $alignment.checksum(amount, member) # Check value of points then return
# $alignment.checkname(member, name) # Check if the alignment level is =name
end
#-------------------------------------------------------------------------------
# Create and set alignment points
#-------------------------------------------------------------------------------
class Game_Actor < Game_Battler
attr_accessor :alignment
attr_accessor :alignment_name
alias syn_gve_setup setup
#-----------------------------------------------------------------------------
# Setup Actor Alignment
#-----------------------------------------------------------------------------
def setup(actor_id)
syn_gve_setup(actor_id)
@alignment = GoodVSEvil::Alignment_initial[actor_id]
@alignment_name = "Neutral"
end
#-----------------------------------------------------------------------------
# Return Alignment Values
#-----------------------------------------------------------------------------
def alignment_value
@alignment = GoodVSEvil::Maximum_alignment if @alignment > GoodVSEvil::Maximum_alignment
@alignment = GoodVSEvil::Maximum_evil_alignment if @alignment < GoodVSEvil::Maximum_evil_alignment
if @alignment >= GoodVSEvil::Rates[1]
@alignment_name = GoodVSEvil::Alignment_names[1]
@alignment_name = GoodVSEvil::Alignment_names[0] if @alignment > GoodVSEvil::Rates[0]
return @alignment_name
elsif @alignment <= GoodVSEvil::Rates[3]
@alignment_name = GoodVSEvil::Alignment_names[3]
@alignment_name = GoodVSEvil::Alignment_names[4] if @alignment >= GoodVSEvil::Rates[4]
return @alignment_name
else
@alignment_name = GoodVSEvil::Alignment_names[2]
return @alignment_name
end
end
end
#-------------------------------------------------------------------------------
# Window_MenuStatus add-on
#-------------------------------------------------------------------------------
class Window_Status < Window_Base
alias syn_gve_refresh refresh
def refresh
syn_gve_refresh
self.contents.font.color = system_color
self.contents.draw_text(32, 350, 120, 32, "Alignment:")
self.contents.font.color = normal_color
self.contents.draw_text(156, 350, 120, 32, @actor.alignment_value)
end
end
#-------------------------------------------------------------------------------
# Alignment Management
#-------------------------------------------------------------------------------
class Alignment_Management
def add(value, member)
$game_party.members[member].alignment += value
end
def remove(value, member)
$game_party.members[member].alignment -= value
end
def checksum(amount, member)
if $game_party.members[member].alignment >= amount
return true
else
return false
end
end
def checkname(member, name)
if $game_party.members[member].alignment_name == name
return true
else
return false
end
end
end
#-------------------------------------------------------------------------------
# Scene_Title:: Create the Global Variable
#-------------------------------------------------------------------------------
class Scene_Title
alias syn_gve_game_object create_game_objects
def create_game_objects
syn_gve_game_object
$alignment = Alignment_Management.new
end
end
#===============================================================================
# * This script will not work with RPG Maker XP *
#===============================================================================
# Written by Synthesize
# Version 1.0.0
# January 26, 2008
#===============================================================================
# Good VS Evil --- RMVX Version
#===============================================================================
Code:
#===============================================================================
# Alignment Management Patch
#===============================================================================
# Written by Synthesize
# Version 1.0.0
# March 1, 2008
#===============================================================================
# GoodVSEvil is required for this to work
#===============================================================================
# What is it?
#-------------------------------------------------------------------------------
# This rewrites the Alignment Management class fixing a checksum bug and adding
# additional commands. I am doing it this way because I am much to lazy to make
# a new demo.
# $alignment.commands:
# $alignment.
# add_points(value, member, string)
# remove_points(value, member)
# check_points(amount, member, sign)
# check_name(member, name, sign)
# Where:
# Value = numerical value (0-9) OR "all"
# Member = Party member position -1
# Amount = Value to check
# Sign = ">", "<", "=", "!"
# Name = string of information to check (ie."This is a string")
#===============================================================================
class Alignment_Management
#-----------------------------------------------------------------------------
# Add_Points:: Add points to the specified member. Use "all" for all members
#-----------------------------------------------------------------------------
def add_points(value, member)
if member == "all"
for i in 0...$game_party.members.size
$game_party.members[i].alignment += value
end
else
$game_party.members[member].alignment += value
end
end
#-----------------------------------------------------------------------------
# Remove Points
#-----------------------------------------------------------------------------
def remove_points(value, member)
if member == "all"
for i in 0...$game_party.members.size
$game_party.members[i].alignmnt -= value
end
else
add_points(-value, member)
end
end
#-----------------------------------------------------------------------------
# Checksum:: Check the values and return the outcome
#-----------------------------------------------------------------------------
def check_points(amount, member, sign)
case sign
when "="
if $game_party.members[member].alignment == amount
return true
else
return false
end
when ">"
if $game_party.members[member].alignment >= amount
return true
else
return false
end
when "<"
if $game_party.members[member].alignment <= amount
return true
else
return false
end
when "!"
if $game_party.members[member].alignment != amount
return true
else
return false
end
end
end
#-----------------------------------------------------------------------------
# Check Name:: Check the alignment name
#-----------------------------------------------------------------------------
def check_name(member, name, sign)
if name.is_a(Numeral)
p "Please turn you numeral into a string ("")"
end
case sign
when "="
if $game_party.members[member].alignment_name == name
return true
else
return false
end
when "!"
if $game_party.memebrs[member].alignment_name != name
return true
else
return false
end
end
end
end
#===============================================================================
# This Alignment patch applies for RPG Maker VX
#===============================================================================
# Written by Synthesize
# Version 1.0.0
# March 1, 2008
#===============================================================================
# Alignment Management Patch
#===============================================================================
DEMO:
www.4shared.com/file/37416989/279c8641/GoodVSEvil.html
Comments? Concerns? Post them.