Jump to content

Character maps in Construct 2


Shadowdawnz

Recommended Posts

Workng on a project and I notice there is a option to remove all character maps but there are no options to remove a character map. 

Will that option be available in the future?

Thank you!

 

Hopefully i'm not asking a question already answered. Did some searching and couldn't find anything to help me. I'm dreading having to do a workaround for my project.

Link to comment
Share on other sites

Hi Shadowdawnz,

 

Its a great question and I'm surprised no one else seems to have asked until now.  Yes, its definitely something Edgar will add eventually...but can't promise how soon because of our current overdue commitment to start focusing on helping to Get Spriter supported for as many authoring systems as possible.  He's currently working on a full, commented C++ implementation.  Until that is done his time is very limited.

 

So, if you need to use the char-map features with complex character map layering ASAP I guess the best bed is to write a little sub-routine in C2 that keeps track of all current character maps, then can remove one from the list, then clear all character maps, and then reinstate all the remaining character maps on the list.. I hope this makes sense.

 

cheers

Mike at BrashMonkey

Link to comment
Share on other sites

Hey Mike,

 

Thank you for replying. 

 

That's great to know it will be added. I manage to do another work around that was actually very simple. I made one character map that hid everything needing to be hidden. My game is slowly becoming more complex so, i'm not sure if this will still work but I i'm confident it will. If, by any chance it doesn't work, i'll for sure try your suggestion.

 

 

Back to work for me..

Link to comment
Share on other sites

  • 1 year later...

Alright.. I know this post is super old, but I've stumbled across it twice looking for the same thing. After digging through the plugin files, I realized that this was actually very easy to do. Here's what you need to do to get this working. I've tested it and everything is working perfectly as far as I can see. Anyone can use this with no credits (even Brashmonkey), because it was just a simple hack of code that was already in the plugin.

It might be a good idea to make backups of your scml plugin folder, but if anything goes wrong you can just delete the folder and redownload a fresh copy.

Open up "edittime.js" in your favorite text editor and search for "remove all". You'll be adding in middle block of text - the other blocks should already be present and are there so you can see where the stuff goes. See where it says AddAction(21 ? If the plugin ever gets updated after this post and this isn't added, make sure that this number isn't already taken. If you scroll down, you'll see that the number increases for each action. At the time of this writing there are 20 actions, so I used 21 for the new action.

AddAction(9, 0, "Remove all character maps", "Character Maps", "Remove all character maps", "Remove all character maps from the character", "removeAllCharMaps");

AddStringParam("Character Map","The character map to remove from this character.");
AddAction(21, 0, "Remove character map", "Character Maps", "Remove character map {0}", "Remove character map from this character", "removeCharMap");

AddStringParam("Character Map","The character map to append to this character.");
AddAction(10, 0, "Append character map", "Character Maps", "Append character map {0}", "Append character map to this character", "appendCharMap");

 

Next, open up "runtime.js" and search for "removeall" (no space this time). Add this function in after the removeAllCharMaps function and before the appendCharMap function.

	Acts.prototype.removeCharMap = function (mapName)
	{
		var c2Objs=this.c2ObjectArray;
		for(var c=0;c<c2Objs.length;c++)
		{
			var c2Obj=c2Objs[c];
			if(c2Obj)
			{
				if(c2Obj.obj)
				{
					var charMap=c2Obj.obj.charMaps[mapName];
					if(charMap)
					{
						for(var m=0;m<charMap.length;m++)
						{
							var map=charMap[m];
							if(map)
							{
								c2Obj.appliedMap=[];
							}
						}
					}
				}
			}
		}
		this.tick2(true);
	};

Restart Construct 2 and you should be good to go. Hope it helps someone!

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...