I do not normally post my scripts, but on request of Siletrea, I have modified my Morality script from my old game, Code MORA.
In short, this script gives actors a native alignment of "Neutral", "Bad", or "Good" based on points labeled as dharma.
Features
Assign Alignment
Change actor sprite based on Alignment
More Features coming...
Screenshots
No screenshots needed.
Demo
Coming Soon. Possibly after Next update.
Script
"The Script be`th Inside"
[code ]
#=============================================================================
# Code Mora : Morality Engine V-1.01
# Free for Use is Any Project Commercial or Otherwise. DO NOT REMOVE CREDITS
# Created By: B.E. Jeremiah
# ---------------------------------------------
# Basic Feature:
# Give actors a native alignment of "Neutral", "Bad", or "Good"
#
# Advanced Features: Version 1.01
# Active: Turn it ON or OFF
# LIMITS: Set the amount of points. Make larger for longer games
# Modifier: Set Range for Alignment changes
# Gender: For purpose of Mora Form give each actor gender
# MORA_FORM_ENABLED: Turn Mora Form ON / OFF
# Mora Form: Assign a form specific to your Alignment
# (Look Evil if you want to, be Evil if you have to.)
# Customize Gains: Increase or decrease "dharma" with actions, items, etc
#
# Instructions:
# Place this script above main, and below any other scripts.
# For this to work with your Battle Script it requires editing.
# Add the method "gain_exp()" to replace "actor.exp += value"
# This will allow you to gain or loose "dharma" by monster id
# ATTENTION: You have to set monster IDs under Monster Alignments
# or gain_exp does ... absolutely nothing...heh
# To Modify Align:
# In Battle Script: Add gain_exp(enemy, exp) to replace actor.exp += value.
# In Events: Use direct_flow(value) replace value with the amount
# To Show Aligment Name: $game_party.actors[party_id].code.name
#
def medium
return (Code_Mora::LIMITS) / (Code_Mora::MODIFIER)
end
def update
# Set code name
if @dharma < -(medium)
@name = $mora.code_names[0]
elsif @dharma > -(medium) and @dharma < medium
@name = $mora.code_names[1]
elsif @dharma > medium
@name = $mora.code_names[2]
end
end
end
# Flow Game Play, uses current flow to direct through a precreate Route
class Route
end
end
class Game_Actor < Game_Battler
attr_accessor :code
attr_accessor :gender
alias_method :mora_setup, :setup
def setup(actor_id)
mora_setup(actor_id)
init_codes
end
def init_codes
@code = Code_Mora::Code.new
@gender = 0
end
def direct_flow(value)
@code.direct_flow(value)
update_mora if Code_Mora::ACTIVE
end
# MORA Functions
def update_mora
flow_form if Code_Mora::MORA_FORM_ENABLED
$game_player.update
end
# EXP
def gain_exp(monster, value)
exp += value
if Code_Mora::GOOD_MONSTER_IDS.include?(monster.enemy_id)
direct_flow(value*Code_Mora::GMDG)
end
if Code_Mora::BAD_MONSTER_IDS.include?(monster.enemy_id)
direct_flow(-(value*Code_Mora::GMDG))
end
end
# Learning Good VS Bad skills
alias_method :mora_learning, :learn_skill
def learn_skill(skill_id)
mora_learning(skill_id)
end
# Equipping Good VS Bad Equipment
alias_method :mora_equip, :equip
def equip(equip_type, id)
mora_equip
end
# Mora Form
def change_gender(gender_id)
@gender = gender_id
flow_form
end
def flow_form
form = ""
# Modify MORA Form Default
default = @gender == 0 ? "001-Fighter01" : "002-Fighter02"
if @gender == 0
# Male Mora Form Bad vs Good
form = @code.name == $mora.code_names[0] ? "034-Mage02" : @code.name == $mora.code_names[2] ? "126-Noble01" : default
else
# Female Mora Form Bad vs Good
form = @code.name == $mora.code_names[0] ? "033-Mage01" : @code.name == $mora.code_names[2] ? "131-Noble06" : default
end
@character_name = form; $game_player.refresh
end
end
# FUNCTIONS
class Interpreter
# When SET mora, form does not change
def set_mora(number, value)
$game_party.actors[number].code.dharma = value
end
# Modify Current actor gender
def change_gender(number, gender_id)
$game_party.actors[number].change_gender(gender_id)
end
# Direct Flow of Mora, things happen
def direct_mora(number, value)
$game_party.actors[number].direct_flow(value)
end
end
$mora = Code_Mora::Mora.new
[/code ]
Instructions
Instructions:
Place this script above main, and below any other scripts.
For this to work with your Battle Script it requires editing.
Add the method "actor.gain_exp()" to replace "actor.exp += value"
This will allow you to gain or loose "dharma" by monster id
ATTENTION: You have to set monster IDs under Monster Alignments
or gain_exp does ... absolutely nothing...heh
To Modify Align:
In Battle Script: Add actor.gain_exp(enemy, exp) to replace actor.exp += value.
In Events: Use direct_flow(value) replace value with the amount
To Show Alignment Name: $game_party.actors[party_id].code.name.to_s
FAQ
Hmmm, not yet.
Compatibility
An RPGMaker XP script. Compatability with other systems not tested.
Credits and Thanks
Credits to me...and Siletrea for requesting it.
Author's Notes
Scripts tend to be buggy at first, and this may not work with all other systems.
Terms and Conditions
Free for Use (Commercial or Otherwise). DO NOT REMOVE CREDITS