AGS Support > Modules, Plugins & Tools

MODULE: Character Accessories


I just released a module I'm using for adding accessories to characters, like hats, glasses, wigs, etc.
It's similar than Character::FollowCharacter but my module allows you to specify the z-index of each accessory. So if you have a wig, and over that you need a hat, you can specify the z-index of the wig as 1, and the z-index of the hat as 2.

If you later need to replace the hat with another hat, you can simply add the new hat as an accessory on the same z-index than the previous one.

// supose cJoe is a Character that is being used as the player character
// cHat is a Character that portays a hat
// cGlasses is a Character that portrays a pair of glasses
// cSunGlasses is Character that portrays a pair of sunglasses

cJoe.CL_AddAccessory(cHat,1); // adds the hat to the player
cJoe.CL_AddAccessory(cGlasses,2); // adds the glasses to the player

// later
cJoe.CL_RemoveAccessory(cHat); // removes the hat from the player, but not from the screen.
cJoe.CL_SetAccessoryOffsetZ(cGlasses, 20); // the glasses will be drawn 20 pixeles above the natural Y position
cJoe.CL_AddAccessory(cSunGlasses, 2); // replaces the regular glasses by the sunglasses. The regular glasses are not removed from the screen.
if (cJoe.CL_HasAccessory(cGlasses)) {
cJoe.Say("I'm still wearing my glasses");

By default the module allows to have 5 characters with accessories. If you need more, increase the constant MODULE_CL_ACCESSORIES_MAX_COUNT
By default, each character can have up to 5 accessories. If you need more, increase the constant MODULE_CL_ACCESSORIES_COUNT_PER_CHARACT ER

This sounds promising  8-) I have to give it a go later.  (nod) But can it animate aswell without additional code? That is follow the walkcycles, it recognises when the characters turns left, up, down, etc.
If not, that's something you should try and feature in it, i think. Like forexample if the player gets an medieval armor or something and walks around with it.


[0] Message Index

Go to full version