Munomario777

Trummel Codec Guide

Nov 25th, 2019
1,415
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

What are codecs?

Codecs are a feature of Trummel & Alto activated via Down + Taunt while in Practice Mode. (Due to limitations, it also activates in matches with no time limit.) Here, Trummel, Alto, and Muno ("me," the mod's creator) converse and quip about the opponent that they're fighting. The name "codec" comes from the Metal Gear-style codec conversations that Snake can access in Smash Bros. Brawl, even though these are really more similar to Smash 4's Palutena's Guidance in tone.

Not only does Trummel include codec conversations for all 16 of the game's official characters, but mod creators can also write their own and include them in their own characters' code! It works similarly to Kirby's Copy Abilities - all of the required code is within the character itself, meaning that Trummel's files do not have to be modified. If you follow the steps below, Trummel will instantly be able to use the codec when facing your character in Practice Mode. Mollo, created by Giik, is the first character to implement this feature!

Here's how to add 'em in:

Code to paste in

Copy the following code into init.gml:

trummelcodecneeded = false;
trummelcodec_id = noone;

Copy the following code into update.gml, replacing all the X's as explained below:

if trummelcodecneeded{
    trummelcodec = 17;
    trummelcodecmax = X;
    trummelcodecsprite1 = sprite_get("X");
    trummelcodecsprite2 = sprite_get("X");
    var page = 0;

    //Page 0
    trummelcodecspeaker[page] = X;
    trummelcodecexpression[page] = X;

    trummelcodecline[page,1] = "X";
    trummelcodecline[page,2] = "X";
    trummelcodecline[page,3] = "X";
    trummelcodecline[page,4] = "X";
    page++; 

    //Page 1
    trummelcodecspeaker[page] = X;
    trummelcodecexpression[page] = X;

    trummelcodecline[page,1] = "X";
    trummelcodecline[page,2] = "X";
    trummelcodecline[page,3] = "X";
    trummelcodecline[page,4] = "X";
    page++; 

    //repeat...
}

Finally, in config.ini, the character's url field must not match that of Sandbert or Guadua. (Make it a blank string if you copied your character from them as a template)

This version of the code has the page number explicitly listed. To avoid tedium when making long codecs, please see the alternative version under the Edit-friendly codec format section.

Variables

trummelcodecneeded is the boolean trigger for whether or not Trummel has tried to access the character's codec. (Because of this, the code inside update.gml will not run until the codec is actually needed.)

For the ambitious, trummelcodec_id is a variable which gives the ID of the Trummel accessing the codec. You could use this to do special things during your character's codec. It serves no purpose by default. Read the end of this pastebin for more variables that make this more useful, if you want to manually code something.

page is a variable which tracks the current page in the codec, from 0. The page++; at the end of each page adds 1 to this variable, preparing for the next page to be set.

trummelcodec MUST be set to 17. (17 is the internal codec ID used for custom workshop codecs)

trummelcodecmax is the number of pages, starting at 0, included in the dialogue. Trummel's codec display code will stop once it has finished writing page (THIS NUMBER).

trummelcodecsprite1 and trummelcodecsprite2 are slots for arbitrary sprites that can be used as speakers in addition to Muno, Alto, and Trummel. These sprites will NOT change color according to your character's costume, due to limitations. If you do not plan on using these, set them to some "dummy" sprite still. The idle sprite will work.

Each page section corresponds to a page of dialogue. You can replace page in the code with the actual page number if you like; however, the inclusion of this variable here helps streamline the writing process and make rearranging easier.

trummelcodecspeaker[page] is the person whose portrait should appear to the left of the text. 0 is Muno, 1 is Alto, 2 is Trummel, 3 is trummelcodecsprite1, 4 is trummelcodecsprite2, and 5 is an empty image slot (used to reset the visual between codec uses).

trummelcodecexpression[page] is the expression index that the character should use while speaking. Alto is the only default character with separate expressions: 0 is default, 1 is happy, 2 is thoughtful, 3 is wink, 4 is angry, and 5 is frightened. Setting expressions for Muno or Trummel will have no effect. Learn how to set up expressions for your custom speakers in the section dedicated to speaker sprite setup.

trummelcodecline[page,LINE] is used to enter the text to be displayed. This is displayed in the standard debug_draw font. Note that there are no measures to automatically line-break or cut off the text if it goes beyond the borders of the text box. You should test ingame and trim where necessary. (Luckily, refreshing in Practice Mode works perfectly with codecs.) If you want a page to have only three or fewer lines, set the rest as empty strings.

Example code

Here is an example of a completed update.gml section:

if trummelcodecneeded{
    trummelcodec = 17;
    trummelcodecmax = 2;
    trummelcodecsprite1 = sprite_get("luigi");
    trummelcodecsprite2 = sprite_get("bowser");
    var page = 0;

    //Page 0
    trummelcodecspeaker[page] = 1; //Alto
    trummelcodecexpression[page] = 2; //Alto's "thoughtful" face

    trummelcodecline[page,1] = "Woah, it's Luigi!";
    trummelcodecline[page,2] = "He's so cool and";
    trummelcodecline[page,3] = "neat. He is also";
    trummelcodecline[page,4] = "green";
    page++;

    //Page 1
    trummelcodecspeaker[page] = 3; //Luigi
    trummelcodecexpression[page] = 0; //Luigi's default (or only!) emotion

    trummelcodecline[page,1] = "Idk where Mario is";
    trummelcodecline[page,2] = "and it's scaring me";
    trummelcodecline[page,3] = "aaaaaaaaaaaaa";
    trummelcodecline[page,4] = "help";
    page++;

    //Page 2
    trummelcodecspeaker[2] = 4; //Bowser
    trummelcodecexpression[2] = 2; //Bowser's second non-default emotion; I imagine it being a laugh

    trummelcodecline[page,1] = "BWAHAHAHA.";
    trummelcodecline[page,2] = "I kidnapped your";
    trummelcodecline[page,3] = "brother, Luigi!";
    trummelcodecline[page,4] = ""; //There's nothing in line 4
    page++;
}

Speaker image setup

Speaker images should be 32px by 32px (AFTER being upscaled 2x to fit the RoA pixel scale), in standard Rivals strip format. The background of the image can be transparent, which you should do if there's blank space. The offset for these sprites should be at 0,0 and so it does not need to be defined in load.gml. Note that there are no strict restrictions on the size of the sprite; it will overflow if it is too big. If you're feeling ambitious, do with that what you'd like.

The lip-flapping animation consists of 2 frames. The first frame is held when the speaker has finished speaking, so it should usually be the closed-mouth frame.

For expressions, each expression is a 2-frame lip-flap animation, and they are simply placed sequentially one after the other in the strip. If you have 4 expressions (numbered 0 to 3), there will be 8 frames in your strip.

Functionally, the expression variable is multiplied by 2 and then used to determine the "starting frame" for the lip flap animation. If the expression variable is set to 4, the lip flap will use the ninth and tenth frames rather than the first and second frames.

Below is an example of a speaking strip with 4 expressions, namely Alto's (an old version without all of the expressions, though):

http://u.cubeupload.com/Munomario_777/altospritestrip10.png

As stated earlier in this guide, the expressions are 0 default, 1 happy, 2 thoughtful, 3 wink, and 4 angry.

Writing style guide

Codecs are typically a mix of digressions, jokes, and actual useful advice. Alto, who is always the primary speaker, will typically give a brief overview of the character's background on the first page, then diverge into either salt or useful advice. Fourth-wall breaks are heavily encouraged. The standard length is 7 pages. You can deviate from any of this if you want to, but it'd be nice if you kept the 3 built-in speakers vaguely in-character and refrained from putting offensive stuff / etc in there.

Alto is a snarky, salty RoA player. I kind of based him on Goombella from Paper Mario: TTYD. It would be entirely in-character for Alto to complain about your character being broken or cheap. Still, he's pretty knowledgeable and insightful, so give him some actual advice to spout too.

Trummel speaks very rarely with only a few words at a time. No capitalization, no punctuation; just entirely deadpan.

It feels weird allowing people to write dialogue for, well, ME. I normally just go with the flow when writing these lines (since it's kind of a self-insert), so I'm afraid I don't have very specific guidelines here.

By all means, do get creative with the guest speakers! If you want, you can squeeze in more than two by exploiting the expression system, or you could even have custom sprites for Muno / Alto / Trummel this way.

Also, if you'd like me to write dialogue for Trummel / Alto / Myself to put in your character's codec, hit me up on Discord!

Big brain variable list

OK, so that's the basic cookie cutter stuff out of the way. Are you an ambitious modder who wants to code in custom behavior? Make your character taunt when a certain point in the codec is reached? Make Trummel take damage at a certain point? These are the tools you need to do that kinda stuff.

All of the following variables are stored by Trummel. If you need to reference em, use trummelcodec_id.variable in your char's code.

codec is a boolean which returns true if a text box is being displayed and false if it isn't.

textboxframe controls the text box enter / exit animation. It increments automatically unless its value is 8, which is the value for the fully opened text box.

codectimer is a timer which increments continually during a codec, once per frame. Every 6 times this increments, the textboxframe progresses.

codectimer2 is the timer for the text scrolling across the screen as well as the lip flap animation. It gets reset to 0 every time a new line within a page is begun.

currentcodecline is the current line within a codec, from 1 to 4. It increments when codectimer2 indicates that it has reached the end of the current line.

codecindex is the current page of the codec, starting at 0.

codecfile is the current codec being read; it is 17 for custom workshop codecs.

externalcodec is a number which stores the last codec ID read from an opponent. If the downward taunt is used, codecfile is assigned this value. (Again, this is always 17 for custom workshop codecs)

codecprint[LINE] is the current piece of text being displayed onscreen for that line, after the scrolling text effect is applied.

maxcodecindex, speaker, expression, storedtext[LINE], speakers[3], and speakers[4] correspond to your character's trummelcodecmax, trummelcodecspeaker, trummelcodecexpression, trummelcodecline[PAGE,LINE], trummelcodecsprite3, and trummelcodecsprite4, respectively.

RAW Paste Data