The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: da good king on September 08, 2007, 10:41:01 PM

Title: EZ ?
Post by: da good king on September 08, 2007, 10:41:01 PM
how would i call a different array based on class? ( call array_1 if actor.class_id == 1, call array_2 if actor.class_id == 2)
Title: Re: EZ ?
Post by: Falcon on September 08, 2007, 10:47:58 PM
You need to be more specific, I'm not sure what you mean. Try this though.
if actor.class_id == 1
  arraycode
elsif actor.class_id == 2
  arraycode
end
Title: Re: EZ ?
Post by: da good king on September 11, 2007, 01:16:46 AM
umm sort of the way u can call bitmaps and files in the cache by saying 'bitmap_'+@actor_id'.bmp'
Title: Re: EZ ?
Post by: Shinami on September 11, 2007, 10:29:58 PM
Explain what you're trying to do and I'll be able to help. Anyways, here's how you would call a graphic from the cache.

RPG::Cache.cache_type(file name, picture hue)
cache_type is what folder you're trying to pull a graphic from.
file name is the name of the graphic you're trying to use.
picture hue is the hue of the graphic.
I.E If you want to use a battler, it'd be RPG::Cache.battler(file name, picture hue)
Title: Re: EZ ?
Post by: modern algebra on September 12, 2007, 02:45:07 AM
If what you are trying to do is change the identifier (possibly incorrect term, but the name of the array), then do what Falcon says. As far as I know there is no way to add on something like '_2' or '_1' to a variable name. Better to do it more or less like this:

case actor.class_id
when 1
  array = array_1
when 2
  array = array_2
when 3...
end

You can add things like that to Symbols, but to be honest I don't know much about Symbols, and I do not think they work in the same manner as Identifiers.
Title: Re: EZ ?
Post by: da good king on September 12, 2007, 04:03:23 AM
well thx ill try that