[VXA] Composite Graphics / Visual Equipment

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Hello modern algebra,

I have taken a long time to respond, sorry.

The 864 line error: undefined method `empty? 'for nil: NilClass, it's weird, because it happens sometimes.

I've been trying to do that I mentioned in the post above and I have questions about your code.

When the game is running, load all composite weapons and armors in cache? I guess this is where reading the notebox of weapons and armors:

Code: [Select]
    def self.interpret_composite_graphic_string(string, cg = MA_Composite_Graphic.new("", 0, 0, 255, 0, 0))
      if cg.is_a?(Hash)
        string.sub!(/["'](.+)["']/) { cg[:filename] = $1;    "" } # Filename: ""
        string.sub!(/[Zz](-?\d+)/) { cg[:z] = $1.to_i;       "" } # Z:         0
        string.sub!(/[Hh](\d+)/)   { cg[:hue] = $1.to_i;     "" } # Hue:       0
        string.sub!(/[Oo](\d+)/)   { cg[:opacity] = $1.to_i; "" } # Opacity: 255
        string.sub!(/[Rr](\d+)/)   { cg[:rcode] = $1.to_i;   "" } # R-Code:    0
        string.sub!(/[Ii]?(\d+)/)  { cg[:index] = $1.to_i;   "" } # Index:     0
      elsif cg.is_a?(MA_Composite_Graphic)
        string.sub!(/["'](.+)["']/) { cg.filename = $1;     "" }  # Filename: ""
        string.sub!(/[Zz](-?\d+)/)  { cg.z = $1.to_i;       "" }  # Z:         0
        string.sub!(/[Hh](\d+)/)    { cg.hue = $1.to_i;     "" }  # Hue:       0
        string.sub!(/[Oo](\d+)/)    { cg.opacity = $1.to_i; "" }  # Opacity: 255
        string.sub!(/[Rr](\d+)/)    { cg.rcode = $1.to_i;   "" }  # R-Code:    0
        string.sub!(/[Ii]?(\d+)/)   { cg.index = $1.to_i;   "" }  # Index:     0
      end
      cg
    end

If when running the game reads the notebox and is cached, it will be very difficult to modify the code to change equipped items when you change the sprite of the character or event.

Another question. I added several msgbox_p in the code to try understand how it works and also know where I could read the character_name the actor or event. (To do what I said in the post above).

I thought that could do it here:

Code: [Select]
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Add Composite Character/Face
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def macgve_add_cg(type, arg = {})
    case arg
    when String then cg = RPG::MACGVE_Data_CompositeGraphic.interpret_composite_graphic_string(arg)
    when Hash
      cg = MA_Composite_Graphic.new("", 0, 0, 255, 0, 0)
      arg.each_pair(key, value) { cg.send(:"#{key}=", value) }
    when MA_Composite_Graphic then cg = arg
    else
      return
    end
    send(:"base_composite_#{type}") << cg
    $game_player.refresh
  end

Here you call the function that reads the notebox, and as you are in Game_Actor, you can pass as an argument the character_name the actor or event and then use it when you read the filename of weapon or armor notebox. To know what must load.

I do not know if I have explained well.

Thanks for your help. :)

Sorry that I've been gone for so long.

I'm not sure that I understand the question. You're right that the script just draws the actor and loads it into the cache. The cache looks (basically like this:

Code: [Select]
@macgve_name_cache = {
  :face => {
    ["filename1", i1, h1, o1, "filename2", i2, h2, o2, etc...] => "$macgve_blablabla",
  },
  :character => {
    ["filename1", i1, h1, o1, "filename2", i2, h2, o2, etc...] => "$macgve_blablabla",
  }
}

The key lists all the graphics used to create the character, and $macgve_blablabla is the name of the composed graphic. If you know the composite's name, you can retrieve that key with the code:

[code]
Cache.macgve_cgary_from_name("$macgve_blablabla")

You could then modify the filenames in that key and recache the graphic with the code:

Code: [Select]
Cache.recache_cg_from_key(:character, "$macgve_blablabla", key)

I don't understand your second question. Could you rephrase it?

Also, thanks for helping out Octavia in my absence.

**
Rep: +0/-0Level 38
RMRK Junior
Look at this:

Code: [Select]
#  Adding & Removing Composite Graphics:
#
#    Firstly, I will note that the regular event command of Change Actor
#   Graphic does work, but it will only change the basic sprite - it will not
#   remove any of the composite graphics you set up through the notebox.
#
#    To add or remove composite graphics from events, you use the following
#   code in a comment (NOT a script call!), wherever you want it to happen in
#   the sequence of events:
#
#     \add_e1_cc["filename", i0, h0, o255, z0, r0]
#     \remove_e1_cc["filename", i0, h0, o255, z0, r0]
#
#    As you can see, the arguments ("filename", etc.) are all identical to
#   those with which you should now be familiar. The biggest difference is that
#   you need to put remove_e1 or add_e1 before that stuff. Note, the 1 after e
#   is the ID of the event. So, it can be any integer and the graphic will be
#   added to or removed from the event with that ID. If you don't provide any
#   ID, then it will go to the event from which it is called.
#
#    It is important to note that when you use a remove code, you do not need
#   to specify every aspect of the code - what the script will do is simply get
#   rid of every graphic that shares the parameters you do set in. So all you
#   need to do is be specific enough with the arguments that you don't
#   accidentally delete more than you want to delete.
#     
#    The codes for actors are similar:
#
#     \add_a1_cc["filename", i0, h0, o255, z0, r0]
#     \remove_a1_cc["filename", i0, h0, o255, z0, r0]
#     \add_a1_cf["filename", i0, h0, o255, z0, r0]
#     \remove_a1_cf["filename", i0, h0, o255, z0, r0]
#
#   Again, replace the 1 after the a with the ID of the actor whose composite
#   graphic you want to change.
#
#    Finally, you can also use the commands:
#
#     \add_p1_cc["filename", i0, h0, o255, z0, r0]
#     \remove_p1_cc["filename", i0, h0, o255, z0, r0]
#     \add_p1_cf["filename", i0, h0, o255, z0, r0]
#     \remove_p1_cf["filename", i0, h0, o255, z0, r0]
#
#    That will change the composite graphic selected for the party member in
#   that order. So, p1 would be the leader of the party, p2 the second actor
#   in the party, etc...

Ok, now, is it possible to use \add_a1_cc["filename", i0, h0, o255, z0, r0] in a script and not in a comment box? I don't mean a script call of event.

Because I could make a script that works with this call, so that add and remove composite graphics when events or actors change their position.

You know what I mean? :/

EDIT:

I have it.

Code: [Select]
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Interpret Composite Graphic Comment
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def macgve_interpret_cg_comment(comment)
    comment.scan(/\\(add|remove)_([eap])(-?\d*)_c([cf])\[(.+?)\]/i) { |oper, char, id, type, args|
      case char.upcase
      when 'A' then actor = $game_actors[id.empty? ? 1 : id.to_i]
      when 'P' then actor = $game_party.members[id.empty? ? 0 : id.to_i - 1]
      when 'E' then id.to_i < 0 ? actor = $game_player.actor : event = get_character(id.to_i)
      end
      type = type.upcase == 'C' ? :character : :face
      actor.send(:"macgve_#{oper.downcase}_cg", type, args) unless actor.nil?
      event.send(:"macgve_#{oper.downcase}_cc", args) unless event.nil?
    }
  end

I create another script that calls methods "macgve_add_cg", "macgve_remove_cg", "macgve_add_cc" and "macgve_remove_cc" manually when I need it. And thanks to this script I learned the method #send. :)

Thanks for your help and so magnificent script. I hope haven't more problems.
« Last Edit: October 10, 2013, 09:25:33 PM by Duende »

*
Rep: +0/-0Level 36
RMRK Junior
Hello! Thanks for the script! It's really useful!

I been a lurker in this forum for a while, but I'm writing this message because I found myself reaching a wall here.

The situation is this: I have different body types and I'd want to make use of the "\ct[X]" codes, that are usually set on the actors notebox. But making a different actor for each body type will make a mess in the long run. Having different clothes of the same type, for each body, is not the best solution, but it would be my last resort.

So I tried (and failed) two solutions:
-If I could read the "\ct[X]" code out of the Class notebox (instead of the Actor notebox), the whole thing could be solved (Since different body types have different classes). But making that change in the script was too much over my level.
-If I can "write" the notebox ingame so I can change the \ct codes through script calls, I can solve it without much problems. Did some research on that but it seems it doesn't work.

I really hope to get some help. I tried to work around it, but failed so far. Any pointer is wellcome!

Thanks for reading!

*
Rep: +0/-0Level 36
RMRK Junior
Sorry to double post, but I been testing on more things.

It seems like I can set a variable in the actor notebox (\ct[$game_variables[X]]) and it manages to read the number inside. The problem is that it doesn't refresh ingame, and it sticks with the first reading of that variable (meaning, zero). So, is it possible to call the notebox reading process again?

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
MA, Is there any relatively simple way to get Face Options working with Composite Graphics? At the moment, I have each animated face graphic which is processed through Composite Graphics re-marked for animation. Face Options then kicks in, but I am having difficulty grabbing the graphic which has been altered by Composite Graphics. Is it as easy as finding a way to pass the processed bitmap, or is this going to require some heavy modification? The code is like a maze, and I feel a bit lost, so I thought I would ask. I think it would be really neat for the two scripts to co-exist and function correctly.

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

**
Rep: +0/-0Level 32
RMRK Junior
Thanks for the awesome script! I am sorry in advance if posting here is considered breaking the rules, but I just had one question.

Is it possible to have a message code that applies the composite components of an actor's face onto a face graphic that is set in the Show Text option?

I am just thinking it would be sort of neat to be able to apply any changes to a face yet still being able to retain the ability to choose between different emotions in the messages.

I've tried my best to look at and analyse the script but sadly it's beyond my ability to comprehend it.

If it's too much trouble or not doable then no worries at all. Having this script is already a huge boon to my project. Thanks a lot!

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
I think there is something like that built in to the script. Whether it works or not is another question. Anyway, here are the instructions:

Code: [Select]
#  Messages:
#
#    This script introduces two new codes which can be used in messages to show
#   actor faces, since otherwise you would be unable to show composite faces in
#   messages. The codes are:
#
#      \af[x] - this will show the face of the actor with ID x
#      \pf[x] - this will show the face of the party member in xth place. It
#              starts at 1, so \pf[1] would show the face of the party leader,
#              \pf[2] would show the second member's face, etc.

****
Rep:
Level 41
Somewhat got a project? (\ô/)
GIAW 14: ParticipantParticipant - GIAW 11
I tried to use it with my project, but I can't load save games, because it ignores the "enter" button.
And if I try to start a new game, I get a error message: "Stack level too deep."
The only 3 scripts that affects the character are:
Modern Algebra => Extra Movement Frame
GALV => Superman Ability
GALv => Character Animations

I hope it's a problem that can be fixed, thank you, would be nice. :) (\s/)

Here is my momentary project to be found:
http://steamcommunity.com/sharedfiles/filedetails/?id=289815558&searchtext=

If that would help. :) /)

*
The Hero of Rhyme
Rep:
Level 82
( ͡° ͜ʖ ͡°)
2014 Best RPG Maker User - StoryProject of the Year 20142014 Queen of RMRK2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
Ignores the enter button...? As if you aren't pressing it at all? Are you sure it was this script? o.o I know that sometimes you have to delete saved files (and start with a new one) to get certain scripts to work properly.

"Stack level too deep" usually only shows up when two scripts are occupying the same class or something along those lines, I think. Usually, I get that issue when I move them around and accidentally have two of the same script. But looking at the ones you're using, it may be likely that Galv's Character Animations and possibly even the extra movement frames script wouldn't be compatible with this. (I think?)

Note: I don't know how to script.
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


****
Rep:
Level 41
Somewhat got a project? (\ô/)
GIAW 14: ParticipantParticipant - GIAW 11
For the first question, if I place it as the first script I can't load my saved games and it makes a sound like you can't chose it.
So it accept the Enter button, but don't do the command. ;)

If I put it on the last place of my scripts, I get this error message in the spoiler. :) (\s/)

Spoiler for:

Thank you for your fast answer, I thought the same, that the Extra Movement and Character Animations are the problem, because the other don't affect the Actors. /)

It would be great, if there could anyone make a compatibility patch for it. Because I plan to add an character editor and with images you need around 2000 pics or more.

*
The Hero of Rhyme
Rep:
Level 82
( ͡° ͜ʖ ͡°)
2014 Best RPG Maker User - StoryProject of the Year 20142014 Queen of RMRK2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
Ohh, I've had the issue where it makes the sound but won't load before, only with different scripts. Yeah, I think that usually does fix if you replace the save files. But in this case, you can't because of the error message.

I don't really know scripting, so that was all just a guess! Good luck, though. That's a lot of character graphics to handle. O.O
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


**
Rep: +0/-0Level 32
RMRK Junior
I've been doing a lot of testing on the scripts that I am currently using and I am finding there to be a rather peculiar compatibility issue between your Composite Graphics script and other scripts that uses Instance Items, such as the one found here http://himeworks.com/redirect.php?type=script&name=Instance_Items

This error seems to spread across various kind of instance scripts, as the same error also occurs when I use SES's instance script as well.

The error is quite simple and easily reproducible. Whenever I save and load a game, when I finish loading, all my equipments would be unequipped, and the equipped items would vanish from the inventory.

I can create a debug demo if you want, and if you're busy with other commitments then don't worry too much about this :P Thanks!

****
Rep:
Level 41
Somewhat got a project? (\ô/)
GIAW 14: ParticipantParticipant - GIAW 11
I will try, if this script will help with my problem. ;)
Thank you for your answer. If you want to make a debug demo, it would be really nice and help me a lot. :) (\s/)

*
Rep: +0/-0Level 30
RMRK Junior
hello,
thank you for the script!
but i have a question.. how do i choose the position to an added picture?
i change the face with a aprox full body pic and i need to place clothes in different positions.
PS: Sorry for my english!

*
Rep:
Level 29
RMRK Junior
Super script.
I've created a small demo.
« Last Edit: January 17, 2015, 12:05:47 PM by Leonsoft »

****
Rep:
Level 41
Somewhat got a project? (\ô/)
GIAW 14: ParticipantParticipant - GIAW 11
Nice demo, it will help a lot using this script, thank you so much. *hugs* :D (\s/)

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Cool. Thanks Leonsoft

*
Rep: +0/-0Level 23
RMRK Junior
I'm having an issue where my body armor, \cc["armor1",0] isn't drawing over the Actor sprite Graphic at times. It happened when I decided to make a cape accessory, \cc["cape1",0,z1], \cc["cape1",4,z-1]. I have two different scenarios. In one, if I take off the helmet, \cc["helm",7,z2], the body armor is drawn under the Actor sprite Graphic - the character in her underwear. In another scenerio, the composite is drawn correctly, but I put ON the helmet, and the body armor disappears again leaving a half naked sprite wearing a cape and helmet. With the cape off completely, in both scenarios, everything equipped draws correctly.

I've checked all my (z) priorities multiple times, and everything looks great. I've tried changing the order of priorities in the notebox. I've even re-sorted all my (z) priorities so that the body armor is \cc["armor1",1,z1], \cc["armor1",1,z-1], so it displays before and after the Actor sprite Graphic which is z0 at default, and when I put the cape on again, the Actor Graphic STILL draws over the armor despite it being 1 layer above.

In the first scenario, with ALL armor equipped, everything draws correctly - until the helmet is taken off. Is this a bug with accessories, or am I doing something wrong?

I've created 45 character files so far, which makes over 4000 individual weapons and armors. I was really looking forward to adding capes to the mix.