|
  |
[RMXP] Good VS Evil |
|
|
|
|
Jan 26 2008, 03:11 PM
|

Level 38

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed

|
Script Name: Good VS Evil --- RMXP Version Written by: Synthesize Version: 1.0.0 Released: January 26, 2008 What is it?This script allows you to have each actor have an alignment and alignment points. The alignment raises similar to Baldur's Gate 'reputation' system where if you accumulate x amount of Alignment Points, then your Alignment Level rises. Features: - Easily Add/Remove alignment points - Easily check the Alignment Level - Easily check the Alignment points - Easy to customize - Short DEMO:http://www.4shared.com/file/6oJ-kbms/GoodVSEvil.html<div style="margin:20px; margin-top:5px"><div style="margin-bottom:2px"> [Show/Hide] The Script</div><div style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display: none;"> CODE #=============================================================================== # Good VS Evil --- RMXP Version #=============================================================================== # Written by Synthesize # Version 1.0.0 # January 26, 2008 #=============================================================================== # * RMXP 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(330, 400, 120, 32, "Alignment:") self.contents.font.color = normal_color self.contents.draw_text(450, 400, 120, 32, @actor.alignment_value) end end #------------------------------------------------------------------------------- # Alignment Management #------------------------------------------------------------------------------- class Alignment_Management def add(value, member) $game_party.actors[member].alignment += value end def remove(value, member) $game_party.actors[member].alignment -= value end def checksum(amount, member) if $game_party.actors[member].alignment >= amount return true else return false end end def checkname(member, name) if $game_party.actors[member].alignment_name == name return true else return false end end end #------------------------------------------------------------------------------- # Scene_Title:: Create the Global Variable #------------------------------------------------------------------------------- class Scene_Title alias syn_gve_newgame command_new_game def command_new_game syn_gve_newgame $alignment = Alignment_Management.new end end #=============================================================================== # * This script will not work with RPG Maker VX * #=============================================================================== # Written by Synthesize # Version 1.0.0 # January 26, 2008 #=============================================================================== # Good VS Evil --- RMXP Version #=============================================================================== </div></div></div>
This post has been edited by Ty: Feb 28 2011, 07:47 AM
__________________________
|
|
|
|
|
|
|
|
|
Jan 27 2008, 12:58 AM
|

Level 7

Group: Member
Posts: 96
Type: Event Designer
RM Skill: Skilled

|
Error report. While the variable "$alignment" is created when you begin a new game, when you save, shutdown, and reload the save, it isn't created again. When you try to do anything involving $alignment (such as $alignment.add) on the loaded file, it crashes with a "no method for nil class" error (because $alignment wasn't created again). I'm looking for a solution for my own adaptation, as well. If it's anything like the VX one (and it appears that way), it may also affect the VX adaptation. EDIT: I'm not too sure how it works, but I modified both my own adaptation and this script, and both seem to save the variables and load the functions correctly. I changed: CODE #------------------------------------------------------------------------------- # Scene_Title:: Create the Global Variable #------------------------------------------------------------------------------- class Scene_Title alias syn_gve_newgame command_new_game def command_new_game syn_gve_newgame $alignment = Alignment_Management.new end end to CODE class Game_System def update $alignment = Alignment_Management.new end end And it saves and loads the alignment manager correctly. I don't know if all functions are still intact when you do this, but I did $alignment.add(20, 1), printed it and verified that it was 20 (I disabled the addition the script gives by default in the hash), saved the file, shutdown the RMXP game.exe, reloaded my save, executed $alignment.add(20, 1) again, and printed it. It gave me a 40. I hope this solves the problem.
This post has been edited by KiteDXX: Jan 27 2008, 01:28 AM
__________________________
|
|
|
|
|
|
|
|
|
Feb 10 2008, 09:35 AM
|

Level 38

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed

|
Well, thanks for pointing that out. If it helps, in order to re-create a variable you can use the Game_System update method. However, unless you alias the method, then you will erase the following code from Game_System.update. CODE if @timer_working and @timer > 0 @timer -= 1 end Which will make the timer not count down. So if you want to use Game_System.update, then you should alias that method. But the best way would be to alias the load_game method (or whatever it is called) from Scene_Title and then re-define the $alignment variable. So in this case, the best way would be to alias new_game and load_game. Now, let's say you have a global variable ($variable) that is storing information. If you use either of the two ways above to re-create it then you lose the value that the variable is storing. Since you are re-defining a new set of information. In this situation you would then have to go alias the Scene_Save save and Scene_Load load methods to save the information the global variable is storing when the player saves the game and then load the information when the player loads the game.
__________________________
|
|
|
|
|
|
|
|
|
Feb 18 2011, 07:56 AM
|

Level 18

Group: Revolutionary
Posts: 351
Type: Developer
RM Skill: Beginner

|
seems like it's all in the "alignment management" class. CODE class Alignment_Management def add(value, member) $game_party.actors[member].alignment += value end def remove(value, member) $game_party.actors[member].alignment -= value end def checksum(amount, member) if $game_party.actors[member].alignment >= amount return true else return false end end def checkname(member, name) if $game_party.actors[member].alignment_name == name return true else return false end end end From what I'm reading, it seems like if you want to say, increase alignment by 3 positive points to member 1, you would call it like this CODE $alignment.add(3, 1) this will add 3 points to member number 1. I like this, but from my own experience, a single alignment spectrum tends to be pretty boring and meaningless. If I were to use something like this, I would change out the generic terms of good vs evil, add another spectrum to cross with this, and give it a whole new layer to play with. i.e. good vs. evil? how about altruistic vs. self-interest? then throw in reasonable vs. disciplined and you can do D&D style alignments, but as philosophical approaches.
|
|
|
|
|
|
|
|
|
Feb 18 2011, 12:39 PM
|

IM THE BET MEMEBER ON RRR

Group: Revolutionary
Posts: 1,394
Type: Developer
RM Skill: Advanced

|
I am going to be using a very simple system that is not really based on good or evil, but more like three different choices (good, evil, neutral) that will ot be labeled ingame at all. The only purpose they serve will be to dynamically alter the game and offer up different choices to the player without the player knowing exactly how they're altering the game. As far as I can tell, I can subtract points and add them, and for the neutral setting, I just don't need to call the alignment script at all, or set it to not add or subtract. For my purposes, it's pretty easy. Thanks for the help mate  Edit: Wait, so this script only affects party members? What if I just want to influence one generalized bar and use that bar to influence the whole game? Read here for more info; http://www.shrineofseals.net/forum/index.p...opic,126.0.htmlJust read the section about the alignment function I want to use. It's not very long at all.
__________________________
|
|
|
|
|
|
|
|
|
Feb 18 2011, 09:07 PM
|

Level 18

Group: Revolutionary
Posts: 351
Type: Developer
RM Skill: Beginner

|
So here's the rough draft of the code. I haven't actually ported it over and tested it out yet, but that's the basics of it, I think. I don't have time to test it right now, but I'm pretty sure you can figure it out from there. CODE #=============================================================================== # Good VS Evil --- RMXP Version #=============================================================================== # Written by Synthesize # Version 1.0.0 # January 26, 2008 #=============================================================================== # * RMXP Version * #=============================================================================== module GoodVSEvil # 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_Party attr_accessor :alignment attr_accessor :alignment_name #----------------------------------------------------------------------------- # Setup Party Alignment #----------------------------------------------------------------------------- def initialize alignment = 0 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(330, 400, 120, 32, "Alignment:") self.contents.font.color = normal_color self.contents.draw_text(450, 400, 120, 32, $game_party.alignment_value) end end #------------------------------------------------------------------------------- # Alignment Management #------------------------------------------------------------------------------- class Alignment_Management def add(value) $game_party.alignment += value end def remove(value) $game_party.alignment -= value end def checksum(amount) if $game_party.alignment >= amount return true else return false end end def checkname(name) if $game_party.alignment_name == name return true else return false end end end #------------------------------------------------------------------------------- # Scene_Title:: Create the Global Variable #------------------------------------------------------------------------------- class Game_System def update $alignment = Alignment_Management.new end end #=============================================================================== # * This script will not work with RPG Maker VX * #=============================================================================== # Written by Synthesize # Version 1.0.0 # January 26, 2008 #=============================================================================== # Good VS Evil --- RMXP Version #===============================================================================
|
|
|
|
|
|
|
|
  |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
RPG RPG Revolution is an Privacy
Policy and Legal
|
|