Jump to content

DoubleX RMVXA Random Cast

Recommended Posts

Script name

DoubleX RMVXA Random Cast





Terms of use

None other than not claiming this script as created by anyone except DoubleX or his alias



Lets users cast random skills on targetswhen the current skill hits them

Intended to mimic "FF's weapons' randomly casts skills" thing



#  * Notetag <random cast: id, cp, cr, cs, cc> for states(1), weapons(2),      |
#    armors(3), enemies(4), actors(4), classes(5) and skills(6):(the larger the|
#    number, the higher the priority)                                          |
#    To make a battler has cp% chance to cast skill with id id and cr% cost    |
#    to a target when the current skill of that battler hits that target, put  |
#    the above notetag into the related actor's, class's, skill's, equip's,    |
#    enemy's or state's notebox in the database.                               |
#    Setting cs as 0 and 1 makes cr negative and positive respectively         |
#    cc is the random cast condition explained in the below user editable zone |
#    Skills invoked via random cast only hit that target an only hit once      |
#    That target can't counter nor reflect those skills.                       |
#    If more than 1 such notetag is placed in the same actor's, class's,       |
#    skill's, equip's, nemy's or state's notebox, the 1st notetag meeting its  |
#    requirements will be used and all the others will be ignored. All those   |
#    noteboxes will be scanned from the 1st line to the last line.             |

#  ** You only need to edit this part as it's about what this script does      |

module DoubleX_RMVXA
  module Random_Cast

#  * Random Cast Condition(cc in random cast notetag):                         |
#    To make <random cast: id, cp, cr, cs, cc> work, the requirements in cc    |
#    must be met. These requirements are ruby scripts like those in events.    |
#    The below CCX are examples of writing such codes and abtracting them in   |
#    random cast notetags to aid users in understanding and using cc there.    |
#    To use CCX, set the value of cc in random cast notetag as CCX.            |
#    Users can set their own CCX(or whatever names they set) to be used by cc. |
#    CCX names must start with letters and only have alphanumeric characters.  |
#    CCX is evaluated in the new method random_cast under class Game_Battler.  |

    # CC1, default = "true"
    # cc is always true
    CC1 = "true"

    # CC2, default = "item.id != database.random_cast_id[index]"
    # cc is true if and only if the current skill id isn't equal to id
    CC2 = "item.id != database.random_cast_id[index]"

    # CC3, default = "!item.physical? && !item.magical?"
    # cc is true if and only if the current skill isn't physical nor magical
    CC3 = "!item.physical? && !item.magical?"

    # CC4, default = CC2 + " || " + CC3
    # cc is true if and only if CC2 or CC3 is true
    CC4 = CC2 + " || " + CC3

    # CC5, default = "actor? && [x, y, z].include?(id)"
    # cc is true if and only if the caster is an actor with id x, y or z
    CC5 = "actor? && [x, y, z].include?(id)"

    # CC6, default = "(" + CC4 + ") && " + CC5
    # cc is true if and only if CC4 and CC5 is true
    CC6 = "(" + CC4 + ") && " + CC5

    # CC7, default = "!" + CC6
    # cc is true if and only if CC6 is false
    CC7 = "!" + CC6

    # CC8, default = "enemy? && self.enemy_id == x"
    # cc is true if and only if the caster is an enemy with id x
    CC8 = "enemy? && self.enemy_id == x"

    # CC9, default =  "rand(999) < luk"
    # cc is true if and only if the random number(0 - 998) isn't small than luk
    CC9 = "rand(999) < luk"

  end # Random_Cast
end # DoubleX_RMVXA









Use of notetags(requires knowledge of notetag usage) to allow skill users to have a chance to randomly cast skills on targets when the current skill hits them if some conditions are met

Decent boolean logic and scripting knowledge is needed to use this script to its full potential



Open the script editor and put this script into an open slot between Materials and Main. Save to take effect.



Scripts aliasing or rewriting method:

- load_database under module DataManager
- apply_item_effects under class Scene_Battle

may have compatibility issues with this script

Place this script above those aliasing any of these methods if possible



Q1: How to setup my own CCX without any scripting knowledge?

A1: You can ask me here for ways to setup your specific CCX but I'm afraid I'm still not proficient enough to be a scripting teacher :)



v1.00a (GMT 0800 26-8-2014):
 - 1st version of this script finished


(DoubleX)Random Cast v1.00a.txt

Edited by DoubleX

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

Top ArrowTop Arrow Highlighted