Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
imapro

good and evil

Recommended Posts

HEY im making a AWESOME script ..but im not dun with it

so for now here's a little script its cool and small

 

extra info:This script edits the original Window_Status script to add the good/evil.

 

 

how to use

 

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.

 

 

 

features

 

Gives an actor the "good", "Neutral" or "evil" alignment, based upon their actions.

 

 

 

 

script

 

#===================================

# 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

 

#===================================

# 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

 

 

 

 

credit

leon

Edited by imapro

Share this post


Link to post
Share on other sites

Wow, this sounds like it took you forever! I bet this will make loads of Online game makers really happy! :3

 

You should put the Script in a code within a spoiler :) Also, screenshots? :)

 

*I wish I knew RGSS, I would totally make scripts for the community T.T*

Share this post


Link to post
Share on other sites

For your image?

 

Well, you get the URL of your image and then place it between the brackets of:

 

{img]URLHERE{/img]

 

Replace "{" with "["

Edited by CrimsonInferno

Share this post


Link to post
Share on other sites

Just 2 questions. 1 is that I've seen something similar by someone on the forum called Leon and a second that there is an alias that refers to "Leon", too. Is this a script edit?

 

Btw; If Leon reads this, I decided to log on from a friends place.

Share this post


Link to post
Share on other sites

ya i just edited it lol i didnt even say i made it but ya its a edit

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...