I have a script in my project which adds new parameters to actors. This script basically makes it so that Actors can equip weapons/armor and these new parameters will be changed accordingly.
Yet, the problem I'm having is that I want some ENEMIES to have these same values.
So, I need a script which can add a new table of variables to the enemies. Preferably, these new variables could be strings or integers. But one with just integers would work, as well. I don't have to be able to use RegExp in order to attain these new stat variables, as long as I can adjust them through a script call in the editor.
Thanks
For what maker is this request? XP, VX, or VXA?
Also, I am confused. How do these additional stats affect gameplay? The player can't see enemy stats and so whether these enemies have the stats or not won't make any difference unless they modify some other aspect of gameplay. If they do modify gameplay, I think the scripter would need to know how in order to write the script. In other words, a scripter needs to see the script you're using.
MA,
First off. Sorry it was put in the wrong forum.
This is the script I'm using, written by ZETU:
[spoiler]# ==============================================================================
# Z26 : XParameters Zetu Engine X
# ------------------------------------------------------------------------------
# To use this script, edit the STATS array to include all new parameters
# needed. These stats can hold strings (If edited in an Event) as long as
# that stat is NOT listed in 'actor_level_formulas'.
# ==============================================================================
# =========================================================================
# Syntax:
# (Game_Battler).xstats.(STAT) => Stat of the Actor
# Regexp (In equipment note)
# <stat var: X Y> => Increases stat X by Y amount.
# =========================================================================
# =========================================================================
# Examples
# $game_party.members[0].xstats.char #=> Party leader's char
# $game_actors[3].xstats.dex += 3 #=> Adds 3 to Actor ID 3's dex
# =========================================================================
#==============================================================================#
# ZETU'S XSTAT PARAMETERS #
# By: Zetu #
#==============================================================================#
module Z26
STATS = ['age', 'tx', 'rng', 'str', 'spd', 'prof', 'save', 'skl', 'ac', 'char',
'kick', 'punch', 'physbon', 'attsplbon', 'healsplbon', 'mglv', 'sklv', 'mgu',
'sku', 'mcred', 'mxwgt', 'curwgt', 'physr', 'mr', 'fr', 'er', 'war', 'wir',
'stmr', 'dr', 'lr', 'bldr', 'hvyr', 'projr', 'pr', 'imbind', 'imcom',
'imcond', 'imsub', 'imshape', 'imfire', 'imearth', 'imwater', 'imwind',
'imstorm', 'imdark', 'imlight', 'impoison', 'imhvy', 'imbld', 'improj', 'imconf',
'imburn', 'imshock', 'imdrown', 'climb', 'swim', 'crush', 'jump', 'pkup', 'canmove',
'canatt', 'twa', 'ta', 'thra', 'tm', 'hassummon', 'hascomm', 'isbind',
'iscond', 'iscom', 'istrap', 'issub', 'isshape', 'ispoison', 'isconf',
'isdrown', 'isshock', 'isburn', 'poisonrds', 'shaperds', 'condrds',
'summonrds', 'hascommandrds', 'commandrds', 'bindrds', 'traprds', 'subrds',
'burnrds' 'drownrds', 'shockrds', 'traprds', 'trapisdeath', 'subisdeath',
'poisonisdeath', 'shapeisdeath', 'commandisdeath', 'condisdeath', 'confisdeath',
'confrds', 'bindisdeath', 'conddam', 'poisdam', 'comdam', 'binddam',
'trapdam', 'confdam', 'shapedam', 'burndam', 'shockdam', 'drowndam',
'traphascond', 'subhascond', 'confhascond', 'poishascond', 'shockhascond',
'burnhascond', 'drownhascond', 'comhascond', 'bindhascond', 'haseffect', 'effid',
'effrds', 'travdamr', 'travdam', 'deadrds', 'lasttownmap', 'condid', 'deaths',
'slantwalk', 'pointflight', 'score', 'battlekills', 'secretsfound', 'youthelixir',
'totaldamagedealt', 'totaldamagetaken', 'isobscure', 'morphlevel', 'chhgt', 'chwgt',
'size', 'sizerds', 'issize', 'sizeisdeath', 'sizehascond', 'sizedam', 'oldage',
'isold', 'isreading', 'cantransfer', 'canmenu', 'canclimb', 'canswim', 'canjump',
'teleporting', 'flying', 'digging', 'canmoveonland'] #All Lowercase. No Symbols or Spaces
REGEXP = /<stat[ ]*var[: ]+(.*)[ ]+(\d+)>/i
#==================do not edit below==========================================
SYMBOLS = []
for stat in STATS
SYMBOLS.push(eval(':'+stat))
end
Xstats = Struct.new(*SYMBOLS)
end
class Game_Actor < Game_Battler
attr_accessor :xstats
alias z26_s setup unless $@
def setup(actor_id)
z26_s(actor_id)
@xstats = Z26::Xstats.new(*([0]*Z26::STATS.size))
for item in equips.compact
z26variate_equip(item)
end
for stat in Z26::STATS
z26variate_stats(stat, @level)
end
end
alias z26_change_equip change_equip
def change_equip(equip_type, item, test = false)
last_item = equips[equip_type]
z26_change_equip(equip_type, item, test)
z26variate_equip(item)
z26variate_equip(last_item, false)
end
def z26variate_equip(item, adding = true)
return if item.nil?
for line in item.note.split(/[\r\n]+/).each{ |a|
case a
when /<weapon[ ]var:[ ](.*)[ ](\d+)>/i
if Z26::STATS.include?($1)
if adding
eval("@xstats.#{$1} += #{$2}")
else
eval("@xstats.#{$1} -= #{$2}")
end
end
end
}
end
end
end[/spoiler]
Anyway, yes, the new enemy variables will affect gameplay in a variety of different ways. It's all part of a system I'm trying to event wherein the player fights battles from the map scene and can use other skills that require looking at these new enemy parameters. I tried to copy/paste/edit the script here to affect enemies, but the script allows for the player to equip items and the given equipment affects their new variables/stats. Since the enemy doesn't have this power, the script needs to be a little different.
All I'm really asking for is some sort of new Enemy Array of variables which can be modified with script calls using the editor. When needed, I can then load these values into $game_variables. I.E: $game_variable[2] = enemy_stats.newstat
Something like that. When I tried to do the copy/paste/edit from the original actor-based script, I also deleted the level-up part and the equip parts. (Because enemies can't do that.) I was then left with just the array STATS. At that point, I received an error saying that the array needed to be filled with actual variables and not strings, which made sense, since I wasn't going to be using it in any sort of RegExp. However, when I converted them over to variables, it said they hadn't been initialized. This also made sense. That's where I got kind of stumped. I was going to just add the variables and initialize them at the same time, for instance: STATS='newstat=0', but as they are part of a constant in the module, I believe that will make it so I can't access and change them later. Another problem arose when I tried to link them to the enemy itself. Without coming up with a note tag system to scan for new parameters, I was unable to come up with the solution. So, as a last ditch effort, I tried to summon the expertise of the greater minds of RMVX.
Oh yeah, and VX is the system it's for.
And this is the botched attempt at converting the script to handle enemies:
[spoiler]#==============================================================================#
# IXFURU'S FSTAT PARAMETERS #
# By: Ixfuru/Zetu #
#==============================================================================#
module IX1
STATS = [tx, rng, str, spd, prof, save, skl, ac,
physr, mr, fr, er, war, wir, stmr, dr, lr, bldr, hvyr, projr, pr, imbind,
imcom, imcond, imsub, imshape, imfire, imearth, imwater, imwind, imstorm,
imdark, imlight, impoison, imhvy, imbld, improj, imconf, imburn, imshock,
imdrown, climb, swim, crush, jump, pkup, canmove, canattack, atx, mvx, hassummon,
hascomm, isbind, iscond, iscom, istrap, issub, isshape, ispoison, isconf, isdrown,
isshock, isburn, poisonrds, shaperds, condrds, summonrds, hascommandrds, commandrds,
bindrds, traprds, subrds, burnrds, drownrds, shockrds, traprds, trapisdeath,
subisdeath, poisonisdeath, shapeisdeath, commandisdeath, condisdeath, confisdeath,
confrds, bindisdeath, conddam, poisdam, comdam, binddam, trapdam, confdam, shapedam,
burndam, shockdam, drowndam, traphascond, subhascond, confhascond, poishascond,
shockhascond, burnhascond, drownhascond, comhascond, bindhascond, haseffect, effrds,
travdamr, travdam, deadrds, size, sizerds, issize, sizeisdeath, sizehascond,
sizedam, cantransfer, canmenu, canclimb, canswim, canjump, teleporting, flying,
digging, canmoveonland]
#All Lowercase. No Symbols or Spaces
#==================do not edit below==========================================
Fstats = Struct.new(*STATS)
class Nq_Foe < Game_Enemy
attr_accessor :fstats
alias ix_s setup unless $@
def setup(enemy_id)
ix1_s(enemy_id)
@fstats = IX1::Fstats.new(*([0]*IX1::STATS.size))
end
end
[/spoiler]