Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> [RMXP] Good VS Evil
Ty
post Jan 26 2008, 03:11 PM
Post #1


Level 38
Group Icon

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


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
KiteDXX
post Jan 27 2008, 12:58 AM
Post #2


Level 7
Group Icon

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


__________________________
Go to the top of the page
 
+Quote Post
   
Ty
post Feb 10 2008, 09:35 AM
Post #3


Level 38
Group Icon

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.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
blakerowe
post Jul 22 2008, 10:26 PM
Post #4


Level 3
Group Icon

Group: Member
Posts: 40
Type: Developer
RM Skill: Masterful




IT's great thank you!


__________________________
*working*
Go to the top of the page
 
+Quote Post
   
Klokinator
post Feb 15 2011, 06:55 PM
Post #5


IM THE BET MEMEBER ON RRR
Group Icon

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




This is a necropost, yes, but the demo is outdated and I need a RMXP alignment system and this one is perfect. If I could DL the demo I'd be sitting hapy and figuring it out right now, but I can't.

Does anyone have the demo OR a way to explain to me how it works? What do I have to do to add to a characters alignment (via an event for example) or to subtract? If I have an event where an NPC is killed off and I want the alignment to go down, how do I do so?


__________________________
Want to be a part of the biggest new Fandom Game? Check out the already popular....
Fire Emblem: The Medallion of Hope
(Based on the semi-popular Ragefest 3 submission, Generic War!)

(Sorry, this game is currently on hiatus and possibly discontinued.)
Go to the top of the page
 
+Quote Post
   
elliott20
post Feb 18 2011, 07:56 AM
Post #6


Level 18
Group Icon

Group: Revolutionary
Posts: 364
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.
Go to the top of the page
 
+Quote Post
   
Klokinator
post Feb 18 2011, 12:39 PM
Post #7


IM THE BET MEMEBER ON RRR
Group Icon

Group: Revolutionary
Posts: 1,395
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 smile.gif

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.html

Just read the section about the alignment function I want to use. It's not very long at all.


__________________________
Want to be a part of the biggest new Fandom Game? Check out the already popular....
Fire Emblem: The Medallion of Hope
(Based on the semi-popular Ragefest 3 submission, Generic War!)

(Sorry, this game is currently on hiatus and possibly discontinued.)
Go to the top of the page
 
+Quote Post
   
elliott20
post Feb 18 2011, 08:02 PM
Post #8


Level 18
Group Icon

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




well, it seems like this thing was built to be appended to a particular party member.

the good news it doesn't look like it would be too onerous to change that so it's a party attribute. Just change it so that the attribute is initialized in the game_party class instead of the game_actor class. Then you have to modify the methods so that it just takes one argument, modifying the party's alignment attribute.

You can do it that way, or you can just tie the alignment to a single party member if there is a single party member who is constant throughout the entire game. Or if you're really keen, add in a dummy character in the party who has this attribute. (Though to be honest, that seems like more work than just changing this script here)
Go to the top of the page
 
+Quote Post
   
Klokinator
post Feb 18 2011, 08:30 PM
Post #9


IM THE BET MEMEBER ON RRR
Group Icon

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




Except I'm not much of a scripter sad.gif

I guess I could try to figure it out... IDK


__________________________
Want to be a part of the biggest new Fandom Game? Check out the already popular....
Fire Emblem: The Medallion of Hope
(Based on the semi-popular Ragefest 3 submission, Generic War!)

(Sorry, this game is currently on hiatus and possibly discontinued.)
Go to the top of the page
 
+Quote Post
   
elliott20
post Feb 18 2011, 08:47 PM
Post #10


Level 18
Group Icon

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




alright, you know what, I'll have some time maybe next tuesday. If you haven't gotten it figured out by then, I'll see if I can take a look at it to make it work. I'll need this for one of my later projects anyway.
Go to the top of the page
 
+Quote Post
   
elliott20
post Feb 18 2011, 09:07 PM
Post #11


Level 18
Group Icon

Group: Revolutionary
Posts: 364
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
#===============================================================================
Go to the top of the page
 
+Quote Post
   
Ty
post Feb 28 2011, 07:49 AM
Post #12


Level 38
Group Icon

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




Updated the Demo link in the first post. I'll post it here as well

http://www.4shared.com/file/6oJ-kbms/GoodVSEvil.html


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
dannyg
post Jul 6 2011, 02:52 AM
Post #13


Level 1
Group Icon

Group: Member
Posts: 5
Type: None
RM Skill: Beginner




hey, how would i show this in a window on a cms?
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th June 2013 - 01:13 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker