[XP] Character Races

Started by G_G, January 28, 2010, 08:34:35 pm

Previous topic - Next topic

G_G

January 28, 2010, 08:34:35 pm Last Edit: January 28, 2010, 09:21:08 pm by game_guy
Character Races
Authors: game_guy
Version: 1.0
Type: Character Customization
Key Term: Actor Add-on



Introduction

Adds character races to your game. If you've played oblivion its a lot like that. Pretty much each race has its own stat bonuses, skill bonuses, and name.


Features


  • Have unlimited races
  • Have stat bonuses
  • Have skill bonuses



Screenshots

N/A


Demo

MediaFire


Script

Spoiler: ShowHide

#===============================================================================
# Character Races
# Author game_guy
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# Adds character races to your game. If you've played oblivion its a lot like
# that. Pretty much each race has its own stat bonuses, skill bonuses, and
# name.
#
# Features:
# Have unlimited races
# Have stat bonuses
# Have skill bonuses
#
# Instructions:
# Go down to Config. Follow the instructions there.
#
# To change a class of any actor use this.
# $game_actors[actor id].race = race id
#
# Credits:
# game_guy ~ for making it
# Bethesda ~ for making oblvion which this script is based from
#===============================================================================
module GameGuy
  #=========================================================
  # Config
  #=========================================================
  #==========================================
  # DefaultRace ~ The id of the race that
  # every actor starts with.
  #==========================================
  DefaultRace   = 1 # Default Race for every actor
  def self.racen(id) # Race Names
    case id
    #==========================================
    # Race Name
    # when race_id then return "Name of Race"
    # Example:
    # when 1 then return "Human"
    # Race 1 is called human now
    #==========================================
    when 1 then return "Human"
    when 2 then return "Orc"
    when 3 then return "Elf"
    end
    return "Human"
  end
  def self.raceb(id) # Race Bonus Attributes
    case id
    #==========================================
    # Race Stat Bonuses
    # when race_id then return [hp+, sp+, str+, dex+, agi+, int+]
    # Example:
    # when 1 then return [10, 0, 5, 0, 0, 0]
    # So 'Human' would have a 10 bonus hp and 5 bonus of strength.
    #==========================================
    when 1 then return [10, 0, 5, 0, 0, 0]
    when 2 then return [0, 0, 10, 5, 0, 0]
    when 3 then return [0, 20, 0, 0, 10, 5]
    end
    return [0, 0, 0, 0, 0, 0]
  end
  def self.races(id) # Race Bonus Skills
    case id
    #==========================================
    # Race Bonus Skills
    # when 1 then return [skill 1, skill 2, ect]
    # Example:
    # when 1 then return [1, 2]
    # So 'Human' would know the skills Heal and Greater Heal
    #==========================================
    when 1 then return [1, 2]
    when 2 then return [57, 58]
    when 3 then return [4, 5, 6, 7, 8, 9]
    end
    return []
  end
end
class Game_Actor
  attr_accessor :race_id
  attr_accessor :race_name
  alias gg_add_races_act_later setup
  def setup(actor_id)
    @race_id = 0
    gg_add_races_act_later(actor_id)
    setup_race(GameGuy::DefaultRace)
  end
  def setup_race(id = 0)
    old_id = @race_id
    stats = GameGuy.raceb(old_id)
    @maxhp_plus -= stats[0]
    @maxsp_plus -= stats[1]
    @str_plus -= stats[2]
    @dex_plus -= stats[3]
    @agi_plus -= stats[4]
    @int_plus -= stats[5]
    @race_id = id
    skills = GameGuy.races(old_id)
    skills2 = []
    for i in $data_classes[@class_id].learnings
      skills2.push(i.skill_id)
    end
    for i in skills
      unless skills2.include?(i)
        forget_skill(i)
      end
    end
    stats = GameGuy.raceb(@race_id)
    @maxhp_plus += stats[0]
    @maxsp_plus += stats[1]
    @str_plus += stats[2]
    @dex_plus += stats[3]
    @agi_plus += stats[4]
    @int_plus += stats[5]
    @race_name = GameGuy.racen(@race_id)
    skills = GameGuy.races(@race_id)
    @hp = maxhp
    @sp = maxsp
    for i in skills
      learn_skill(i)
    end
  end
  def race=(id)
    setup_race(id)
  end
end



Instructions

In the script.


Compatibility

Not tested with SDK.
Tested with Blizz-Abs and works. (It was actually made for Blizz-Abs but it works for most battle systems as well.)


Credits and Thanks


  • game_guy ~ for making it
  • Bethesda ~ for making oblvion which this script is based from



Author's Notes

Please do give proper credit for the maker. This script was made for a game I'm working on with a friend. I thought it'd be cool to release it though.
Enjoy!

ShinyToyGuns

January 28, 2010, 08:50:45 pm #1 Last Edit: January 28, 2010, 09:05:08 pm by ShinyToyGuns
I'm definitely gonna have to try this out :D

I personally LOVE the Elder Scrolls series, and this seems like it would be a great addition to my game :D

I'll let you know what I think ;)

One question...does this script go below all others?

Another question just came to mind...is there a way to show the race name in-game, and how do I assign each actor a different race? (i.e. Orc Fighter)
Days
I've missed so many days
In a world that has become an unfamiliar place
Now to you, I'm just an unfamiliar face

~Shiny Toy Guns, Blown Away (2008)

G_G

if you read the instructions you'd know to use this.
$game_actors[actor id] = race id


Place it above blizz's scripts and below all others.

and glad you like it :)

ShinyToyGuns

Apparently, there's some sort of syntax error on line 75...I didn't make any changes to the script either...Would the actors have to have skills assigned to them for this to work?
Days
I've missed so many days
In a world that has become an unfamiliar place
Now to you, I'm just an unfamiliar face

~Shiny Toy Guns, Blown Away (2008)

G_G


Blizzard

There's much sex in this young one. :V: *levels up*
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

WhiteRose

Just a suggestion for the next version, maybe you should make it so certain races have weaknesses to certain elements (Orcs and goblins are weak against fire, etc.) This would also allow the creation of weapons more effective against certain races, such as silver weapons being strong against demonic races. That's just an idea that you might want to implement if you update in the future, though; the script is already great.

Eternal

wait a second, couldn't you just give the actor the bonuses from the start...? and with the skill bonuses, wouldn't it just be a simple matter of assigning a unique class for every actor so that their skills could be unique or "with a bonus"?

lol, I'm most likely gonna use it, but to me it kinda seems as pointless as the existance of for example hannah montanna, or the thinking of the us government...

[Faint]

@Eternal : this script is great for orginization. Also it can be a pain  if you have a larger amount of classes in your game to sit there and and create another class for each race. Say for example you have 15 classes and 5 races, with this script you can easily setup the bonus for being a certain race, but using the method you suggest, you would have to make and configure 75 different classes. So which seems easier? :P
Scripts by me - State Requirement Skills
current project - Project: AURA

G_G

@faint: Thanks for backing me up!

Also for the custom version I have the stat multiplier done like STR * 1.5 but learning a skill at a different level isn't quite done. It will be though so just gotta wait.

[Faint]

ok no problem man but just wondering how did you go about doing the multipliers? Only wondering because I am trying to get better at scripting myself and was trying to figure it out myself. I managed to get it it partially working =p
Scripts by me - State Requirement Skills
current project - Project: AURA

G_G

Well in the setup_race method I changed all the minuses to /= and all the pluses to *=. It was very simple. :D So you could go ahead and add that yourself. I'm trying to find a fairly easy way to setup the skill level.

[Faint]

February 01, 2010, 05:05:14 pm #12 Last Edit: February 01, 2010, 05:07:55 pm by [Faint]
omg I actually got it right bwahahaha. I just hadn't tested it yet. I don't feel like such a noob anymore lol. For the skills I wonder if "skill_can_use?" would work? I am gonig to try and figure out my idea about elemental efficiencies for the races.
Scripts by me - State Requirement Skills
current project - Project: AURA

G_G

I already added that as well(element efficiancies) :S

I'm almost done with the levels hopefully I'll have it done tonight.

[Faint]

well then I do believe I love you :P
Scripts by me - State Requirement Skills
current project - Project: AURA

Eternal

@faint aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahhh. +@game_guy not too stupid actually...

[Faint]

Everything is easier when you break it down  8)
Scripts by me - State Requirement Skills
current project - Project: AURA

Godsigma

game_guy, you are my hero. you have made my job so much easier right now i could cry.... my game will pass though the troubled times of my lacking RGSS skills and shall become a blossoming sakura (Cherry) tree and shall bear fruit of wisdom and love for pain and suffering of gamers. truly this night has been blessed for me to return from my stupor and lack of internets... hail odin....

Eternal


phillip1756


ShinyToyGuns

Is there a way to make this so it doesn't just trigger one actor, but a set of actors with the same race? i.e. Player chooses Elf race, then before they get to the class selection, it automatically makes them an Elf? To make this more clear, my situation is this: Player chooses race, and then they can choose the class, and then they are assigned an actor based on the class and race they choose.

Let me know if you need more detail.
Days
I've missed so many days
In a world that has become an unfamiliar place
Now to you, I'm just an unfamiliar face

~Shiny Toy Guns, Blown Away (2008)

G_G

You could do this.
$game_actors.each{|i| i.race = race_id}
That turns all actors into the same race. I think that'd do what you need.

ShinyToyGuns

So would I use that in an event script call when they choose their race?
Days
I've missed so many days
In a world that has become an unfamiliar place
Now to you, I'm just an unfamiliar face

~Shiny Toy Guns, Blown Away (2008)

G_G

Yes. After they choose the race. Just call that script and change race_id.

ShinyToyGuns

What if there are no actors in the Initial Party until they choose a class? I'd prolly have to put it in for each class, aye?
Days
I've missed so many days
In a world that has become an unfamiliar place
Now to you, I'm just an unfamiliar face

~Shiny Toy Guns, Blown Away (2008)

The Niche

Game_Guy, I'd first like to declare that I adore you.

Second, I looked at the script and I'm guessing that it;d be possible to limit weapons to races by messing with a copy of the skills yoke.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

G_G

You can just limit weapons through classes.

The Niche

I could, but I could also do the same with skills.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Griver03

can you maybe help me with a equipment by race plugin?
like

if shield => [[1, 0], [2,1], [3,2]]
if helmet... and so on...
id1 can be equped by all races, id2 can be equiped by raceid1 only, id3 can be equiped by raceid2 only...

thx in advance
My most wanted games...



Griver03

My most wanted games...



PhoenixFire

To start with, I do apologize for a... well, like 2 year necro-post. I do have legitimate questions though, and I know the creator is still active lolz..

1) Am I correct in thinking that by just changing the way it calculates bonuses, I could make it use a "percentage" instead of numbers?such as:

   @temp_stat=@new_stat
   @new_stat=(@temp_stat*1.5)


2) Is this called every time that Game_Actor is called? As in, if the character levels up, is there a way to make it recalculate the bonuses?
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

G_G

You'd have to modify the script a bit. The script subtracts and adds bonuses. The bonuses are calculated only once when you setup the player's race. Bonuses aren't added at every level up.

Marauder93

Is there an easy way to have the race be displayed in the menu right after the class? There's definitely space for it, as much space as there is for the actor name and class. I'm just getting into scripting so I personally haven't a clue how to do this yet.

KK20

Stick this to the end of the script:

class Window_Base < Window
  def draw_actor_race(actor, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, 236, 32, actor.race_name)
  end
end

class Window_Status < Window_Base
  alias draw_actor_race_after_refresh refresh
  def refresh
    draw_actor_race_after_refresh
    draw_actor_race(@actor, 4 + 144 * 2, 0)
  end
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Marauder93

Right at the end of the races script? Didn't work for me, but like I said, still getting the hang of this so might be a tad confused...

KK20

Yes, just append the snippet to the end of G_G's script. Tested and works.

Did you put the script below Scene_Debug and above Main?

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Marauder93

Yep. There's a few other scripts installed however, guess it might be a conflict...

pics



where I want the race name (right after class above hp)



KK20

August 29, 2014, 03:22:32 pm #37 Last Edit: August 29, 2014, 03:25:26 pm by KK20
Ohhhhhhh, that status window. Let me whip that up quick-like.

Append this to the bottom of what I put before.

class Window_MenuStatus < Window_Selectable
  alias draw_races_after_refresh refresh
  def refresh
    draw_races_after_refresh
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 116
      actor = $game_party.actors[i]
      draw_actor_race(actor, x + 144 * 2, y)
    end
  end
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Marauder93

Worked! Much thanks ^_^ and made it look so easy. I really need to wrap my head around this stuff. Just got back into using rpg maker after quite a few years (making a 5th ed D&D inspired thing), so I'll be definitely be frequenting these parts.