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
> GoodVSEvil by Leon
Ty
post Jul 2 2007, 07:52 PM
Post #1


Level 38
Group Icon

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




This is a Leon original, a good/evil script. You can use it to your advantage in many ways.

Using $game_party.actors[x].alignment += y (x being the actor's position in the party: 0 being 1st, 1 being 2nd, etc) you can add y to the actor's alignment number (100 being good.) and use - instead of + to subtract from the alignment number (-100 being full evil)

Using a conditional branch, and the command:
$game_party.actors[x].alignment > x
you can set x to 0 (or higher) for the actor to be that much good and have the event execute, or do the opposite for evil (using a negative number)

It may seem complex, but it is quite a nice addition ot the game. Please, give me credit for this script. Further, here are screen shots of the bars:





If used credit Leon for the script creation.
If used credit Leon for the script creation.
If used credit Leon for the script creation.
If used credit Leon for the script creation.


CODE
#===================================
#  Leon's Good and Evil script
#----------------------------------------------------------------------
#  Features:
#    Gives an actor the "good", "Neutral" or "evil" alignment, based
#    upon their actions.
#
#  Instructions:
#    Place above main, and below other scripts.
#    Use:  draw_alignment_bar(actor, x, y) in a script to draw the alignment bar.
#    Use: $game_party.actors[0].alignment  to update it immediately, if needed, in call_script
#             x and y being the position of the bar, and actor being the syntax for the actor's information.
#
#  Extra Information:
#    This script edits the original Window_Status script to add the good/evil.
#===================================

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Actor < Game_Battler

attr_accessor :alignment
attr_accessor :alignment_name

alias leon_alignment_bars_ga_setup setup

def setup(actor_id)
   @alignment = 0
   @alignment_name = "Neutral"
   leon_alignment_bars_ga_setup(actor_id)
end

def alignment
   if @alignment > 0
     if @alignment > 100
       @alignment = 100
     end
     @alignment_name = "Good"
     return @alignment
   end
   if @alignment < 0
     if @alignment < -100
       @alignment = -100
     end
     @alignment_name = "Evil"
     return @alignment
   end
   @alignment_name = "Neutral"
   return @alignment
end
  

end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Window_Base
def draw_bar(x, y, min, max, width = 152, height = 6,
     bar_color = Color.new(0, 75, 0, 255), end_color = Color.new(0, 255, 0, 255))
   for i in 0..height
     self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
   end
   for i in 1..(height - 1)
     r = 100 * (height - i) / height + 0 * i / height
     g = 100 * (height - i) / height + 0 * i / height
     b = 100 * (height - i) / height + 0 * i / height
     a = 255 * (height - i) / height + 255 * i / height
     self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
   end
   for i in 1..( (min.to_f / max.to_f) * width - 1)
     for j in 1..(height - 1)
       r = bar_color.red * (width - i) / width + end_color.red * i / width
       g = bar_color.green * (width - i) / width + end_color.green * i / width
       b = bar_color.blue * (width - i) / width + end_color.blue * i / width
       a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
       self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
     end
   end
end

def draw_backward_bar(x, y, min, max, width = 152, height = 6,
     bar_color = Color.new(75, 0, 0, 255), end_color = Color.new(255, 0, 0, 255))
   for i in 0..height
     self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
   end
   for i in 1..(height - 1)
     r = 100 * (height - i) / height + 0 * i / height
     g = 100 * (height - i) / height + 0 * i / height
     b = 100 * (height - i) / height + 0 * i / height
     a = 255 * (height - i) / height + 255 * i / height
     self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
   end
   for i in 1..( (min.to_f / max.to_f) * width - 1)
     for j in 1..(height - 1)
       r = bar_color.red * (width - i) / width + end_color.red * i / width
       g = bar_color.green * (width - i) / width + end_color.green * i / width
       b = bar_color.blue * (width - i) / width + end_color.blue * i / width
       a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
       self.contents.fill_rect(x - i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
     end
   end
end

def draw_alignment_bar(actor, x, y)
   #x = 320 y = 147
   draw_bar(x, y, 0, 200, 200, 6)
   if actor.alignment > 0
     draw_bar(x + 100, y, actor.alignment, 100, 100, 6)
     actor.alignment_name = "Good"
   elsif actor.alignment < 0
     draw_backward_bar(x + 100, y, -1 * actor.alignment, 100, 100, 6)
     actor.alignment_name = "Evil"
   elsif actor.alignment == 0
     draw_bar(x + 100, y, actor.alignment, 100, 100, 6)
     actor.alignment_name = "Neutral"
   end
   draw_bar(x + 97, y - 2, 2, 2, 2, 10, Color.new(255, 255, 255, 255), Color.new(255, 255, 255,255))
   self.contents.font.color = normal_color
   self.contents.draw_text(x + 5, y - 13, 120, 32, "E")
   self.contents.draw_text(x + 190, y - 13, 120, 32, "G")
end


end


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Window_Status
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Window_Status < Window_Base

alias leon_alignment_bars_ws_refresh refresh

def refresh
   leon_alignment_bars_ws_refresh
   if @actor.alignment > 100
     @actor.alignment = 100
   elsif @actor.alignment < -100
     @actor.alignment = -100
   end
   self.contents.font.color = system_color
   self.contents.draw_text(320, 112, 120, 32, "Alignment")
   draw_alignment_bar(@actor, 320, 147)
   self.contents.font.color = normal_color
   self.contents.draw_text(420, 112, 120, 32, @actor.alignment_name)
end
end


Usage:

Place above Main.

Change the alignment by calling
CODE
$game_party.actors[0].alignment += #
to add points for good
CODE
$game_party.actors[0].alignment -= #
to remove points. Alignment becomes a negative the actor leans more to the evil side (Come to the dark side,, we have cookies).

If used credit Leon for the script creation.

This post has been edited by Synthesize: Jul 2 2007, 07:53 PM


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
Sniper308
post Aug 1 2008, 03:01 PM
Post #2


Level 5
Group Icon

Group: Member
Posts: 71
Type: Artist
RM Skill: Advanced




Splendid! But might there be a demo of such?
Go to the top of the page
 
+Quote Post
   
jens009
post Aug 1 2008, 03:02 PM
Post #3


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




@TY:

Syn, don't forget to credit Sephiroth Spawn for the bars. =]


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
TonkRogerio
post Aug 16 2008, 08:37 PM
Post #4


Level 7
Group Icon

Group: Revolutionary
Posts: 108
Type: None
RM Skill: Undisclosed




i was actually using a good vs evil thingy in my game Reno but this lookslike a good script to use insted of waisting a variable..(wich would do the same really withou tthe bars tongue.gif) one thing i don't know though, how do i make it so the NPC acts diferently to you if you are evil or really good? how can i put that into my conditional forks? i have alot of things going on in my NPC interaction and they do react to everything you say depending on how evil you are, can you tell me if i can do that with this script?


__________________________

he will never get ahead in life, he will never be head chef because he keeps losing his head.

[Show/Hide] Title currently working on

DEMO COMING SOON!
Go to the top of the page
 
+Quote Post
   
Blizzard
post Aug 17 2008, 04:27 PM
Post #5


Where am I?
Group Icon

Group: Revolutionary
Posts: 613
Type: Scripter
RM Skill: Masterful




Seph's bars lag. >.<


__________________________


Please keep in mind that I have retired from RMXP and that I am not active here anymore! If you can't get any support for my scripts here, try at Chaos Project.
Go to the top of the page
 
+Quote Post
   
ahinside
post Aug 24 2008, 08:28 AM
Post #6


Level 1
Group Icon

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




Is it possible someone can edit this script for me to work with Blizzards Storm CMS?

Its important as I am making a game where choices affect the outcome

I have used Blizzards Storm CMS, hybrid edition

[Show/Hide] this one


and I just want it to display.
Go to the top of the page
 
+Quote Post
   
Zinx10
post Jan 16 2009, 03:48 PM
Post #7


Master of Darkness
Group Icon

Group: Revolutionary
Posts: 1,194
Type: Developer
RM Skill: Advanced
Rev Points: 5




Pretty nice script, but can be very buggy sometimes!


__________________________
My Games
Phelxyre: Time Unbound (Current Project)
Game Thread
A game where you start in the future, but you go to the past, to make things right, hopefully.

The Hidden World
Game Thread
An Arcade-style game where you must go through various puzzles to see if you go home.

Here are all the things I Support (They Include Links!)




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: 20th May 2013 - 11:14 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker