Introduction
This script creates new conditions for event pages. In other words, you can have pages that change based on things like gold amount, weapon equipped, even actor parameters.
Features
use event comments to create new page conditions
conditions based on party gold amount
conditions based on party member having weapon or armor equipped
conditions based on having member of a specific class in party
conditions based on a number of a specific item
conditions based on a member being in a given state
conditions based on Ixfuru's Time script hours
Screenshots
Script
"script"
Code:
################################################################################
# EVENT COMMENT CONDITIONALS
# By: Ixfuru
# Version 1.0
# Created 12/25/14
################################################################################
# This script adds new conditions to event pages. By rule, conditions of a
# page are limited to variables, switches, self-switches, actor in party and
# item in inventory. With this script, I have increased the number of
# conditions which will activate specific pages of an event. This is done
# by simply adding CommentConditional (CC) tags at the top of the commands
# on the given page.
#
# This system is compatible with Ixfuru's Time system and is able to base
# conditions on the hour of $time global object. However, it will also work
# without the time system, as long as you don't attempt to use a conditional
# based on $time hours.
#
# You can have multiple conditions on a page.
#
# Here is a list and explanations of the CC Tags you can use in your events:
#
#-------------------------------------------------------------------------------
# <cc_wpn weapon_id>
#
# By replacing 'weapon_id' with the ID of a database weapon, you can check to
# see if a party member has the weapon with that ID equipped.
#-------------------------------------------------------------------------------
# <cc_arm armor_id>
#
# By replacing 'armor_id' with the ID of a database armor, you can check to
# see if a party member has the armor with the given ID equipped.
#-------------------------------------------------------------------------------
# <cc_stt state_id>
#
# By replacing 'state_id' with the ID of a database state, you can check to
# see if a party member is currently effected by that state.
#-------------------------------------------------------------------------------
# <cc_par par_id, par_amount>
#
# In this tag, you replace the 'par_id' with one of the following parameter
# IDs:
#
# 0 : ATK
# 1 : DEF
# 2 : MAT
# 3 : MDF
# 4 : AGI
# 5 : LUK
# 6 : MHP
# 7 : MMP
# 8 : EXP
#
# Using this tag, you are checking to see if the LEADER of the party has the
# parameter with the given ID greater than the 'par_amount' value. Keep in
# mind that you MUST place the comma (,) between the two values. Here is
# an example:
#
# <cc_par 5, 18>
#
# In that example, the '5' points to the LEADER's 'LUK' parameter. If the
# LEADER has a LUK parameter at or above 18, then the condition is true.
#-------------------------------------------------------------------------------
# <cc_g amount>
#
# This tag will allow you to check if the party has the same or more gold than
# that which is found in your replacement value for 'amount'. So, in the tag
# '<cc_g 77>' the condition would only be true if the party currrently had
# 77 or more gold.
#-------------------------------------------------------------------------------
# <cc_in item_id, item_amount>
#
# Here, you will replace the 'item_id' with the ID of a database item. Then,
# replace the 'item_amount' with the amount of the given item you want to
# check for. This differs from the default condition check of 'item in party'.
# Because with that one, as long as you have one (1) of that item in your
# inventory, then the condition is true. Here, you have to have the amount
# passed in the tag. Don't forget the comma (,).
#-------------------------------------------------------------------------------
# <cc_cid class_id>
#
# By replacing the 'class_id' part with the ID of a database class, you can
# test whether or not you have a party member with the given class in your
# party.
#-------------------------------------------------------------------------------
#*******************************************************************************
# The following two CC Tags can only be used if you are currently using Ixfuru's
# time system:
#*******************************************************************************
#-------------------------------------------------------------------------------
# <cc_hr before_after, hour>
#
# This checks to see if the $time.hour variable is either before or after the
# 'hour' value. Replace 'before_after' with either 0 for before, or 1 for after.
# So placing:
#
# <cc_hr 1, 8>
#
# would only return as condition true, if the $time.hour variable was currently
# greater than or equal to 8.
#-------------------------------------------------------------------------------
# <cc_sch lo_hour, hi_hour>
#
# This is like the previous conditional tag, except it checks to see if the
# $time.hour value is between 'lo_hour' and 'hi_hour'.
#-------------------------------------------------------------------------------
################################################################################
#******************************IMPORTANT****************************************
#
# As of Version 1.0, there are no settings to speak of. This script is plug
# and play, as long as you set up the events you intend to use the tags in.
################################################################################
# DONT EDIT BELOW DONT EDIT BELOW DONT EDIT BELOW DONT EDIT BELOW
################################################################################
module IxfuruAce
module CommentConditionals
#===============================================================================
# Game Event
#===============================================================================
class Game_Event < Game_Character
#-----------------------------------------------------------------------------
# Comment Conditionals
#-----------------------------------------------------------------------------
def comment_conditionals(page)
comments = []
page.list.each { |i| i.code == 108 ? comments.push(i) : break }
return comments if comments.empty?
conditionals = []
comparitor = IxfuruAce::CcTags
for comment in comments
# Time, greater than or less than hour
if comparitor::TIME_HOUR =~ comment.parameters[0]
conditionals.push([0, $1.to_i, $2.to_i])
# Time, between two hours
elsif comparitor::TIME_SCHEDULE =~ comment.parameters[0]
conditionals.push([1, $1.to_i, $2.to_i])
# Weapon Equipped
elsif comparitor::WEAPON_EQUIPPED =~ comment.parameters[0]
conditionals.push([2, $1.to_i])
#Armor Equipped
elsif comparitor::ARMOR_EQUIPPED =~ comment.parameters[0]
conditionals.push([3, $1.to_i])
# State Applied
elsif comparitor::STATE_APPLIED =~ comment.parameters[0]
conditonals.push([4, $1.to_i])
# Item Number
elsif comparitor::ITEM_NUMBER =~ comment.parameters[0]
conditoinals.push([5, $1.to_i, $2.to_i])
# Parameter Value
elsif comparitor::PARAMETER_VALUE =~ comment.parameters[0]
conditionals.push([6, $1.to_i, $2.to_i])
# Gold Value
elsif comparitor::GOLD_VALUE =~ comment.parameters[0]
conditionals.push([7, $1.to_i])
# Class ID
elsif comparitor::CLASS_ID =~ comment.parameters[0]
conditionals.push([8, $1.to_i])
end
end
return conditionals
end
#-----------------------------------------------------------------------------
# Parameter Of Value?
#-----------------------------------------------------------------------------
def parameter_of_value?(par_id, val)
actor = $game_party.members[0]
case par_id
when 0
v = actor.atk
when 1
v = actor.def
when 2
v = actor.mat
when 3
v = actor.mdf
when 4
v = actor.agi
when 5
v = actor.luk
when 6
v = actor.mhp
when 7
v = actor.mmp
when 8
v = actor.level
when 9
v = actor.exp
end
return true if v >= val
return false
end
#-----------------------------------------------------------------------------
# Time of Hour?
#-----------------------------------------------------------------------------
def time_of_hour?(comp, hr)
case comp
when 0 # before
return true if $time.hour < hr
when 1 # after
return true if $time.hour > hr
end
return false
end
#------------------------------------------------------------------------------
# Time Between?
#-----------------------------------------------------------------------------
def time_between?(t1, t2)
return $time.hour.between?(t1, t2)
end
#-----------------------------------------------------------------------------
# Weapon Equipped?
#-----------------------------------------------------------------------------
def weapon_equipped?(weapon_id)
for member in $game_party.members
if member.weapons.include?($data_weapons[weapon_id])
return true
end
end
return false
end
#-----------------------------------------------------------------------------
# Armor Equipped?
#------------------------------------------------------------------------------
def armor_equipped?(armor_id)
for member in $game_party.members
if member.armors.include?($data_armors[armor_id])
return true
end
end
return false
end
#-----------------------------------------------------------------------------
# State Applied?
#-----------------------------------------------------------------------------
def state_applied?(state_id)
for member in $game_party.members
if member.states.include?($data_states[state_id])
return true
end
end
return false
end
#-----------------------------------------------------------------------------
# Class ID?
#-----------------------------------------------------------------------------
def class_id?(check_id)
for member in $game_party.members
if member.class_id == check_id
return true
end
end
return false
end
#--------------------------------------------------------------------------
# * Determine if Event Page Conditions Are Met (Aliased)
#--------------------------------------------------------------------------
alias ixaeccgmevconmet conditions_met? unless $@
def conditions_met?(page)
cc = comment_conditionals(page)
if cc.empty?
ixaeccgmevconmet(page)
else
c = page.condition
if c.switch1_valid
return false unless $game_switches[c.switch1_id]
end
if c.switch2_valid
return false unless $game_switches[c.switch2_id]
end
if c.variable_valid
return false if $game_variables[c.variable_id] < c.variable_value
end
if c.self_switch_valid
key = [@map_id, @event.id, c.self_switch_ch]
return false if $game_self_switches[key] != true
end
if c.item_valid
item = $data_items[c.item_id]
return false unless $game_party.has_item?(item)
end
if c.actor_valid
actor = $game_actors[c.actor_id]
return false unless $game_party.members.include?(actor)
end
return comment_conditions_met?(cc)
end
end
#-----------------------------------------------------------------------------
# Comment Conditions Met?
#-----------------------------------------------------------------------------
def comment_conditions_met?(conditionals)
for condition in conditionals
t = condition[0]
p1 = condition[1]
p2 = condition[2]
case t
when 0 # Time Of Hour
return false if !time_of_hour?(p1, p2)
when 1 # Time Between
return false if !time_between?(p1, p2)
when 2 # Weapon Equipped
return false if !weapon_equipped?(p1)
when 3 # Armor Equipped
return false if !armor_equipped?(p1)
when 4 # State Applied
return false if !state_applied?(p1)
when 5 # Item Number
return false if !item_number?(p1, p2)
when 6 # Parameter Value
return false if !parameter_value?(p1, p2)
when 7 # Gold Amount
return false if !gold_amount?(p1)
when 8 # Class ID
return false if !class_id(p1)
end
end
return true
end
end
Instructions
Plenty of instructions inside the script! But basically, you have to use an event's 'Comment' option on a new page and then use one of the following tags inside the comment in order to set the page's condition:
(Make sure you include the '<>' arrows in the comment tag!)
Tags
Code:
<cc_wpn weapon_id>
replace the 'weapon_id' with the ID of the weapon someone in the party requires
Code:
<cc_arm armor_id>
replace the 'armor_id' with the ID of the armor someone in the party requires
Code:
<cc_stt state_id>
replace the 'state_id' with the ID of the state someone in the party must be under
Code:
<cc_par par_id, par_amount>
In this tag, it will only check the leader of the party!
Simply, replace the 'par_id' with one of the following values to determine which parameter you want to base the condition from:
Then, replace 'par_amount' with the value the given parameter should be equal to or above in order to activate the condition.
Code:
<cc_g gold_amount>
replace the 'gold_amount' with the amount of gold the party should have in order to activate the page
Code:
<cc_in item_id, item_number>
replace the 'item_id' with the ID of the item the party must have; replace the 'item_number' with the amount of the given item the party should have
Code:
<cc_cid class_id>
replace the 'class_id' with the ID of the class that a party member must be
The following two only work with Ixfuru's Time System!
[code<cc_hr before_after, hour>
Here, you can set the 'before_after' with either a one or a zero. One signifies that the hour must be after the 'hour' value. While zero signifies that the hour must be fore the 'hour' value.
Replace the 'hour' with the hour it must be before or after.
Code:
<cc_sch lo_hour, hi_hour>
In this tag, you are able to activate an event's page based on whether or not the hour of the $time system is between the
value you place at 'lo_hour' and the value you place at 'hi_hour'.
Compatibility
This script only aliases one method, so it should be compatible with just about anything. If you find something that it doesn't work with, let me know.
Author's Notes
This is another one of those, 'I needed it, so I scripted it' script. I set out to just script a comment conditional based on my time system for a project I was making, but ended up adding a bunch of stuff to it just for fun.
Terms and Conditions
You must credit me if you use this script even if it is modified by you or someone else.
In non-commercial games, it's free to use. For commercial projects, I would just like a free copy and the credit!
Don't claim this is your script because it isn't!
And lastly, if you want to post the script on another site, you must have my permission first.
I think there are "new" conditions that are quite old indeed unless they disappear in VX Ace like the ones for gold or equipped weapon or armor or the actor being affected by a specific state.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
Well, I'm not exactly sure what you mean, Fox. In VX Ace, (and VX for that matter), as you can see in the screenshot, there are no page conditions for these things. Only for switches, variables, self-switches, actor in party and item in inventory. You can create a 'conditional branch' with some of this stuff, or a combination of variable set for item number and such. But it will not activate the page on its own. That's what this script does. I should probably add to it one day and add more conditions.
I was just digging around in the RM-friendly scripts I wrote to see which ones I could share with the community and came across this one. The truth is, I haven't worked on a true Rpg in quite some time. I was just going through the scripts I've written and wanted to share some from Ace, (even though most of what I do is in VX). Most of the time, I just script game-specific stuff. :) When I do that, the scripts I write are of little use to most folks because they run off each other and often bypass the RM default scripts completely.
I think what kyonides was saying was that was that a page could be a parallel event that has a conditional branch that would activate the steps in the event if certain conditions were met, and otherwise be a 'lifeless event'
All in all though, I like the idea of not being able to action event an event unless STR is above X amount... Can't move a boulder if you've got the upperbody strength of a 4th grade P.E. dropout.
ITCH: jayray.itch.io
Currently working on Goblin Gulch (MV)
Currently working on JayVinci Resurrection
Currently working on Bakin ABS (BAKIN)