Jump to content

Photo

Sprite Display During Conversations


  • Please log in to reply
12 replies to this topic

#1 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 07 July 2008 - 11:13 PM

One of the most annoying things about the limitations of ZC's string editor is the inability to point out who is talking without putting their name at the beginning of the string, which wastes valuable string space. Not anymore! With this script you're able to have a box that shows the current speaker in a 1 combo sprite.

Screens:
IPB Image IPB Image IPB Image IPB Image IPB Image

How do you work it? Well, it involves several things: A FFC, a list of combos for your characters, an array of integers for the sprite's cset, an item counter, a dummy item, and, of course, the script.

Don't worry, there's a step-by-step process to using it. Here's the code:

CODE

// Script to Manage Character Sprites During Cutscenes
// By LinktheMaster

import "std.zh"

// Int for the cset in which sprites use
int charCSet[50];

// Script to initialize the csets
global script init
{

    void run()
    {    
        // Sets the cset of the sprites
        charCSet[0] = 7;
        charCSet[1] = 8;
        charCSet[2] = 7;
        charCSet[3] = 2;
    }

}

// Script for manages string char sprites
ffc script manageString
{
    void run()
    {
        // Counter to be used to figure out which sprite should be displayed
        int charCounter = 7;

        // Item to be used to check whether a string is being displayed
        int ifStringItem = 123;

        // First combo in the character list
        int initCharCombo = 40000;

        // Top left combo for the background
        int initBGCombo = 39996;
        int initBGCSet = 8;

        // Position for the sprite
        int spriteX = 40;
        int spriteY = 120;

        // Position for the background
        int backX = 32;
        int backY = 112;

        while(true)
        {

            // If a String is being displayed
            if(Link->Item[ifStringItem])
            {

                // Create the character FFC and display it
                int character = Game->Counter[charCounter];
                ffc char = Screen->LoadFFC(31);
                char->Data = initCharCombo + character;
                char->CSet = charCSet[character];
                char->X = spriteX;
                char->Y = spriteY;    

                // Create the char background FFC
                ffc background = Screen->LoadFFC(32);
                background->Data = initBGCombo;
                background->CSet = initBGCSet;
                background->TileHeight = 2;
                background->TileWidth = 2;
                background->X = backX;
                background->Y = backY;

                // Set the three FFCs to be above all
                char->Flags[0] = true;
                background->Flags[0] = true;

            } // End of if(Link->Item[ifStringItem])
            else
            {
                // Load the background and char FFCs
                ffc char = Screen->LoadFFC(31);
                ffc background = Screen->LoadFFC(32);
                char->Data = 0;
                background->Data = 0;
            }

            Waitframe();

        } // End of while(true)
    } // End of void run()
} // End of ffc script manageString


Example quest: http://www.uploading...essage.zip.html

Note that the combos for the character sprites start on combo 40,000. Also worthy of note is that you will have to edit some stuff, mostly the stuff right under void run() and before while(true). This is where the first character combo is, the location of the sprite on the screen, etc.

To give a very brief description of how it works once you have everything setup, you'll use string formatting to give Link the ifString item as well as set the character counter to the number of the character sprite you want displayed. This script will check if Link has that ifString item. If he does, then it'll find the correct sprite of that character and display it. Once you get done with the strings, you then remove the ifString item, removing the sprite and the background. Though, this can sometimes look weird if you don't put spaces after the actual text. Like I said, in the zip file theres a txt file that should help.

Edit: Nope! XD Here's the txt file. Sorry about that. http://www.uploading...essage.txt.html

Anyway, enjoy. icon_biggrin.gif Any questions?

Edited by LinktheMaster, 07 July 2008 - 11:21 PM.


#2 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 08 July 2008 - 11:07 AM

This sounds awsome. I'll give it a shot when I get the chance. Thanks a whole bunch! icon_biggrin.gif

#3 Lemon

Lemon

    Legend

  • Members

Posted 08 July 2008 - 12:32 PM

I think the little box should be just barely overlapping the text. It would look nicely and not distract from the text.

#4 Mitchfork

Mitchfork

    no fun. not ever.

  • Members
  • Real Name:Mitch
  • Location:Alabama

Posted 08 July 2008 - 12:52 PM

I think you can edit that in the script itself- where it says "int SpriteX" and such, you can edit the values to have it display whenever.

It's good, but it looks as if you have to set up the script for each and every cutscene in the quest. icon_frown.gif That's... a lot of work.

#5 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 08 July 2008 - 01:35 PM

Hmm... come to think of it, if you set it to a global script, it should do the same thing. I can check, though.

#6 Zemious

Zemious

    Magicite: Bahamut

  • Members

Posted 08 July 2008 - 07:30 PM

Yay, we can now use portraits!

#7 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 09 July 2008 - 08:58 PM

I have a question. Could you upload it somewhere else? My internet security blocked the site. icon_smile.gif

Anyways, I'm still confused on how to use the script.

#8 Ricky of Kokiri

Ricky of Kokiri

    Apprentice

  • Members
  • Real Name:Ricky
  • Location:southern california

Posted 10 July 2008 - 07:50 PM

Wow, this looks really cool.

Is it possible to make it display a 4x4 set of combos (talking about IaN's portraits) instead of just one? If not, it's no big deal.

Edited by Ricky of Kokiri, 10 July 2008 - 07:51 PM.


#9 Xiion

Xiion

    Senior

  • Members

Posted 10 July 2008 - 08:41 PM

It looks good, but I have a couple questions.

Is there any particular reason why you chose to set it up to use/edit ffc data? It seems to me like you could condense half your script into a couple 'drawtile' functions. Granted, animated portraits would be a bit more difficult that way...

Also, what happens if your already using ffc's 31 and 32 for something else?

Just asking 'cause I'm curious.

#10 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 10 July 2008 - 10:15 PM

QUOTE(Xiion @ Jul 10 2008, 08:41 PM) View Post

It looks good, but I have a couple questions.

Is there any particular reason why you chose to set it up to use/edit ffc data? It seems to me like you could condense half your script into a couple 'drawtile' functions. Granted, animated portraits would be a bit more difficult that way...

Also, what happens if your already using ffc's 31 and 32 for something else?

Just asking 'cause I'm curious.

icon_shrug.gif I'm more familiar with FFC, and they're more flexible in situations like this. With a few small edits, this script could display 2x2 sprites instead of one. That would be more difficult with drawtile, and like you mentioned, animation would be more difficult. This also opens up to combo cycling and things like that if needed.

And really, in conversations, you're not going to be using that many FFCs.

It's something that comes down to that if you want to do it a different way, do it a different way. icon_razz.gif Each way is going to have its own advantages.

But, sorry it's taking a while to get the new update. I began to overhaul the script to add more functionality and to work better.

Edited by LinktheMaster, 10 July 2008 - 10:16 PM.


#11 Radien

Radien

    Courage

  • Members
  • Real Name:Steve
  • Location:Oregon

Posted 11 July 2008 - 03:04 AM

Hmm. Definitely a breakthrough, but still enough trouble that I think I'd rather stick to the simple practice of specifying the speaker in the string's text. icon_unsettled.gif

Example...

Serenia: Man, fitting a coherent piece of dialog into one string sure is a pain.

#12 ScaryBinary

ScaryBinary

    Newbie

  • Members
  • Location:Indiana USA

Posted 13 July 2008 - 08:27 AM

...yet another option, which I was toying with, was to simply use a different 2x2 frame for each character (set it in the String Editor). For instance, when Link talks, there's a little triforce at the upper left corner of the string frame, and when the other NPC is talking, I just use a "regular" 2x2 frame.

....still, your idea is pretty awesome. AND HOLY FRIGGIN' COW, that's brilliant, using string format codes to give Link an item so you know a string is displayed:
CODE
// If a String is being displayed
  if(Link->Item[ifStringItem]){
    // ...
  }


icon_eek.gif Well done!

This opens up some new possibilities with script-driven dialog.... icon_naughty.gif

Edited by ScaryBinary, 13 July 2008 - 08:32 AM.


#13 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 14 July 2008 - 10:31 AM

QUOTE(Ricky of Kokiri @ Jul 10 2008, 06:50 PM) View Post

Wow, this looks really cool.

Is it possible to make it display a 4x4 set of combos (talking about IaN's portraits) instead of just one? If not, it's no big deal.


Actually, this would be really easy to do. I edited the script so it displays a 2x2 portrait. Isn't much harder to have it show a 4x4. Just keep in mind you'd have to edit the background/border height and width as well to make it look good. Just add in a tile height and width modifying thingie, like this.

CODE
              
                 // Create the character FFC and display it
                int character = Game->Counter[charCounter];
                ffc char = Screen->LoadFFC(31);
                char->Data = initCharCombo + character;
                char->CSet = charCSet[character];
                char->TileHeight = INSERT HIGHT HERE;
                char->TileWidth = INSERT WIDTH HERE;
                char->X = spriteX;
                char->Y = spriteY;


The rest is the same, except for char->TileHeight/Width. Add those in, and you're good. (Bear in mind, you only need one combo, like with the background, just make sure that the tile set-up works for the face.)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users