The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on February 03, 2009, 11:10:43 PM

Title: Actor Prefixes
Post by: modern algebra on February 03, 2009, 11:10:43 PM
Actor Prefixes
Version: 1.0
Author: modern algebra
Date: February 3, 2009

Version History



Description


This allows you to set prefixes to your classes that are based on actor level. Perfect if you want your classes to be rank based. For instance, with this script, your warrior can be Squire Philip between levels 1 and 10, Sir Philip between levels 11 and 30, Lord Philip between levels 31 and 60, and King Philip after level 60.

Features


Instructions

Please see inside the script for instructions.

Script


Code: [Select]
#==============================================================================
#  Actor Prefixes (based on class)
#  Version: 1.0
#  Author: modern algebra (rmrk.net)
#  Date: February 3, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#    This allows you to set prefixes to your classes that are based on actor
#   level. Perfect if you want your classes to be rank based. For instance,
#   with this script, your warrior can be Squire Philip between levels 1 and
#   10, Sir Philip between levels 11 and 30, Lord Philip between levels 31 and
#   60, and King Philip after level 60.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#    Place this script in the Script Editor (F11) in a slot above Main and
#   below Materials
#
#    For instructions on configuring this script, please see the Editable
#   Region starting at line 35.
#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - name
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Name
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalge_nevious_chr_prefx_nm_83y5n name
  def name
    prefix = ""
    case @class_id
    #----------------------------------------------------------------------
    # EDITABLE REGION
    #``````````````````````````````````````````````````````````````````````
    #  Instructions:
    #    Set each class as below:
    #
    #      when <class ID>
    #        prefix = case @level
    #        when p1 .. p2 then "<original prefix>"
    #        when p2 + 1 .. p3 then "<second prefix>"
    #        when p3 + 1 .. p4 then "<third prefix>"
    #          ................................
    #        else "<last prefix>"
    #        end
    #
    #   where p1, p2, p3, ..., pn are the levels at which the prefix ought
    #  to change. class ID is the ID of the class, and the prefixes are all
    #  the prefixes for that level range. If you leave any levels out, then
    #  there will be no prefix for that level or, if you have set an else
    #  branch, then it will take that prefix.
    #
    #    EXAMPLES:
    #    
    #      when 1 # Class ID = 1 : Paladin
    #        prefix = case @level
    #        when 1 .. 10 then "Squire "  # Squire between levels 1 and 10
    #        when 11 .. 30 then "Sir "    # Sir between levels 11 and 30
    #        when 31 .. 60 then "Lord "   # Lord between levels 31 and 60
    #        else "King "                 # King after level 60
    #        end
    #      when 3 # Class ID = 3 : Priest
    #        prefix = case @level
    #        when 1 .. 15 then "Br. "  # Squire between levels 1 and 15
    #        when 16 .. 35 then "Fr. "    # Sir between levels 16 and 35
    #        when 36 .. 69 then "Bishop "   # Lord between levels 36 and 69
    #        else "Cardinal "                 # King after level 70
    #        end
    #----------------------------------------------------------------------
    when 1 # Class ID = 1 : Paladin
      prefix = case @level
      when 1 .. 10 then "Squire "  # Squire between levels 1 and 10
      when 11 .. 30 then "Sir "    # Sir between levels 11 and 30
      when 31 .. 60 then "Lord "   # Lord between levels 31 and 60
      else "King "                 # King after level 60
      end
    when 3 # Class ID = 3 : Priest
      prefix = case @level
      when 1 .. 15 then "Br. "     # Brother between levels 1 and 15
      when 16 .. 35 then "Fr. "    # Father between levels 16 and 35
      when 36 .. 69 then "Bishop " # Bishop between levels 36 and 69
      else "Cardinal "             # Cardinal after level 70
      end
    #----------------------------------------------------------------------
    # END EDITABLE REGION
    #----------------------------------------------------------------------
    end
    return prefix + modalge_nevious_chr_prefx_nm_83y5n
  end
end

Credit



Thanks


Support


Please post in this topic here at rmrk.net for support or requests


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
Title: Re: Actor Prefixes
Post by: Wolfram77 on February 04, 2009, 08:04:05 PM
Nifty script! You amaze me as always MA! :blizj:
Title: Re: Actor Prefixes
Post by: Chase_Leader on February 05, 2009, 12:52:36 PM
I am getting more used to this scripting system...
This script is pretty cool...and has sparked an idea of my own.

I don't normally like using classes, however I think
I might be able to use it for something else like a caption
or something as you progress during the game.
For instance at Level 1...(beginning of game)
Have a caption or thought of the character
and at lets say Level 10...
Have a caption or thought that progresses the story in a small
but unique way.
Its a work in progress though...
Title: Re: Actor Prefixes
Post by: nevious on February 13, 2009, 05:38:54 AM
hay nevious here! love the script works perfectly with all of my scripts tottaly plug and play! (and i have alot of scripts.... lol alot....)

also i was wondering is there a way to implament a piece in here that when certian level is reached and prefix is obtained it changes the actor graphic?

for example i have a class set up right now that if your a necromancer youll have a undead pet. but i want that pet to be set up to if lvl 1-10 prefix skeleton (with skeleton graphic). if 10-20 prefix ghost (where i would like the graphic to change to a ghost graphic...) i tried this with a common event but it didnt work...

if you could do this tho it would be super great!! ill worship you forever lol
Title: Re: Actor Prefixes
Post by: modern algebra on February 13, 2009, 02:38:26 PM
I'm glad it works for you.

For the request, that would be a different script altogether. It's also something you can do with an event if you wish. Parallel process, and you can set a variable to actor level (it's one of the options under level). Then you can check that variable against level and use the command Change. I might make an event system for you actually.
Title: Re: Actor Prefixes
Post by: nevious on February 13, 2009, 09:51:23 PM
actualy i tried to set that up as such i have it

control variable [0001 characters lvl] = [undead]'s lvl
conditional branch: variable [0001 character lvl] >= 16
     change actor graphic: [undead], 'monster', 0, (none)
else
control variable [0001 characters lvl] = [undead]'s lvl
conditional branch: variable [0001 character lvl] >= 36
     change actor graphic: [undead], 'monster', 6, (none)

so on and so forth
and my undead is a lvl 19 and graphic didnt change... and thats from starting a new game...
the event is set up under a common event as a parrallell process only triggered if the [001:job] switch is activated...

did i do somehting wrong? or is there another way to do it? i woulld put it on the map itself but i dont want to clutter up my map ya kno what i mean.
Title: Re: Actor Prefixes
Post by: modern algebra on February 16, 2009, 04:10:14 AM
Well, have you turned the switch on?

There is a problem with your event system, in that you put them into the else branches where the smallest numbers come first. Because a level 38 pet will return true that the level is greater than or equal to 16, everything in the else branch would never run. A better way would be to put the higher level ones first, so that it will actually go to the else branches and do it correctly. You also don't need to continually set the variable to the level of the monster. Once is enough.

But, neither of those should have stopped the monster from changing once he hit level 16. The only other thing I can think of is that you haven't fixed the glitch that comes with the program. Have you implemented the variable fix (http://rmrk.net/index.php/topic,25243.0.html) yet?
Title: Re: Actor Prefixes
Post by: nevious on February 17, 2009, 03:51:54 PM
yes i activated the switch and thank you for the only once tip and the else tip i didnt think about that... tho i should have..... and no i havnt fixed that yet... didtn kno there was a problem.... ill check that out once i get home... thank you again! your a great person!!! lol