ZSDF for Dummies

Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: ZSDF for Dummies

Re: ZSDF for Dummies

by ramon.dexter » Wed Jan 24, 2018 5:06 am

Look here: viewtopic.php?f=39&t=52710

Tutorial in the link describes like everything much better than this thread.

Also, for the last page - you have to learn how to do things in this script. Some things are hard to do, yet some things are easy to do.

You mentioned the :main page: of the dialogue. In ZSDF, all pages are equal. You cannot have a "main" page. But pages could have similar content and various links.

Re: ZSDF for Dummies

by Zan » Wed Jan 24, 2018 1:47 am

Neat tutorial, but is there any way you can make the dialogue more... normal? As in not being able to just flip it to the NPC with a permanent "Bye" option, as well as having a base page for the dialogue to start rather than having the NPC repeat the last page you've opened if you interact with them again.

Re: ZSDF for Dummies

by Murix » Wed Jan 24, 2018 1:11 am

Hey is it possible to set a WAD up in a PK3 or something in a way so that when the PK3 get's loaded up with other random map wads, an actor in the PK3 will still have it's dialogue?

For instance I want to make these mini shops that replace mega spheres, the player interacts with them through ZSDF. I want it so that my PK3 will have the code to do this by itself so it will work on any map the PK3 is used with.

Re: ZSDF for Dummies

by Nash » Wed Jul 09, 2014 10:31 am

I think SCRIPT00 is useful if you want to have repeating dialogue for the same NPC across several maps (for example, put all of your repeating dialogues in SCRIPT00, and every map will have the conversation as long as you include them. So you don't need to copy paste all of those blocks across so many maps)

Another additional tidbit: you can set your actor's name via the Tag actor propery in DECORATE, which would allow you to ommit the name property from the ZSDF completely. Of course if you wanted the same actor class to have different names, you'd be better off not using the Tag actor property and explicitly name your NPCs in the ZSDF.

Re: ZSDF for Dummies

by Enjay » Wed Jul 09, 2014 2:28 am

Thank you. Step-by-step and nice and clear (at least it initially seems so; I haven't worked right through it yet). The dialogue format is something that I simply haven't got my head around and this helps.

The Wiki has this to say about the script00 thing BTW, although it doesn't really give much information.
Although not directly used by USDC itself, the USDF standard requires that you include the following two lines in your script. If you are writing a replacement for SCRIPT00 you may remove the include line, but do note that the compiler will still print a warning.

Code: Select all

namespace = "Strife";
include = "SCRIPT00";

ZSDF for Dummies

by TheMightyHeracross » Tue Jul 08, 2014 9:45 pm

Hello! In this thread I will explain how to use the ZDoom Strife Dialogue Format, or ZSDF. I know it's documented on the wiki, but I wish to explain it in a way that makes it easy to understand.

First, add these top two lines in the file:

Code: Select all

namespace = "ZDoom";
include = "SCRIPT00";
The first line indicates that this is ZDoom's format. (USDF uses namespace = "Strife";, but don't worry about that. ZSDF is simpler than that.)
I forgot what SCRIPT00 does, but you need to put it or you'll get an error.

Now for the dialogues. Each one begins with a conversation block:

Code: Select all

namespace = "ZDoom";
include = "SCRIPT00";

conversation
{
//Code
}
Inside this block you can set which actor you will have this dialogue with:

Code: Select all

namespace = "ZDoom";
include = "SCRIPT00";

conversation
{
     actor = "ScriptedMarine";
}
To begin coding the actual conversation, you must create a page block. Each page is a paragraph of dialogue. The first page will show when you first talk to the actor. On each page, you must give your actor a name and then set what he/she will say. There are other settings as well, and I will try to describe them all using the comments in that code.

Code: Select all

namespace = "ZDoom";
include = "SCRIPT00";

conversation
{
    actor = "ScriptedMarine";
    page //The page block here marks the first page
    {
         name = "CDR. Keen"; //Name of the actor you are talking to (by that I mean the name that appears in the dialogue box, not the actor name)
         dialog = "What are you here for, marine?"; //The text that appears in the main dialogue box
         panel = "KEENPIC"; //This is the lump of the graphic used as a portrait (think Strife character portraits)
         voice = "KEENDIA1"; //The voice lump (like the Strife characters)
         drop = "Clip"; //Should the actor die while on this line of dialogue, this is what he/she will drop
         link = 4; //This will be explained later on
    }
}
From here you can make multiple choices. This is where your dialogues start to branch out more. Each choice is marked by a choice block. Inside said block you can set a couple of options.

Code: Select all

namespace = "ZDoom";
include = "SCRIPT00";

conversation
{
    actor = "ScriptedMarine";
    page //The page block here marks the first page
    {
         name = "CDR. Keen";
         dialog = "What are you here for, marine?";
         panel = "KEENPIC"; 
         voice = "KEENDIA1"; 
         drop = "Clip"; 
         link = 2;
         choice
         {
              text = "I want to buy a weapon"; //The text that represents the option
              nextpage = 2; //The page that comes next if you chose this option (represented by order in the conversation block)
         }
         choice
         {
              text = "I'd like to report a broken pipe in Sector 8.";
              nextpage = 3;
              giveitem = "Questitem1"; //You'll see why this is here later
         }
    }
}
From here you can make multiple page blocks for a branching dialogue script. Page 2 will be a weapon shop; page 3 will be reporting a broken pipe releasing hot steam in a sector, and will convince Keen to send men to fix it. In the shop, I will demonstrate the cost block, and the economic functions of the choice block.

Code: Select all

namespace = "ZDoom";
include = "SCRIPT00";

conversation
{
    actor = "ScriptedMarine";
    page //The page block here marks the first page
    {
         name = "CDR. Keen";
         dialog = "What are you here for, marine?";
         panel = "KEENPIC"; 
         voice = "KEENDIA1"; 
         drop = "Clip"; 
         link = 2;
         choice
         {
              text = "I want to buy a weapon"; //The text that represents the option
              nextpage = 2; //The page that comes next if you chose this option (represented by order in the conversation block)
         }
         choice
         {
              text = "I'd like to report a broken pipe in Sector 8.";
              nextpage = 3;
              giveitem = "Questitem1"; //You'll see what this is for
         }
    }
    page //This second page block counts as page 2
    {
         name = "CDR. Keen";
         dialog = "Here's what I got on in the inventory:";
         panel = "KEENPIC"; 
         voice = "KEENDIA2"; //A second voice lump
         drop = "Clip"; 
         choice //Each choice will now represent a shopping choice
         {
              text = "Shotgun";
              giveitem = "Shotgun"; //This is the inventory item given to the player if this choice is selected and can be afforded
              yesmessage = "Here you go!"; //This is a message printed on the screen separate from the dialogue box if you can afford it and the purchase is made
              nomessage = "Sorry, you cannot afford that"; //And this is shown if it fails, and you cannot afford it
              nextpage = 2; //Stay on this page
              displaycost = true; //Adds "for 20" after "Shotgun", showing the cost
              cost
              {
                   item = "Coin"; //The item you spend in (for the sake of the tutorial I'll use the stock Strife gold)
                   amount = 20; //How much of aforementioned item you need to spend
              }
         }
         choice
         {
              text = "Super Shotgun";
              giveitem = "SuperShotgun";
              yesmessage = "Here you go!";
              nomessage = "Sorry, you cannot afford that";
              nextpage = 2;
              displaycost = true;
              cost
              {
                   item = "Coin";
                   amount = 40;
              }
         }
         choice
         {
              text = "Chaingun";
              giveitem = "Chaingun";
              yesmessage = "Here you go!";
              nomessage = "Sorry, you cannot afford that";
              nextpage = 2;
              displaycost = true;
              cost
              {
                   item = "Coin";
                   amount = 20;
              }
         }
         choice
         {
              text = "That's all.";
              nextpage = 1;
              closedialog = true;
         }
    }
    page
    {
         name = "CDR. Keen";
         dialog = "Thank you for reporting that. I'll have a crew fix it in no time!";
         choice
         {
              text = "OK.";
              nextpage = 1;
              closedialog = true;
              special = 80; //Executes special 80, or ACS_Execute
              arg0 = 2; //Sets the first argument as 2, or script 2
         }
    }
}
OK, we're almost done. However, there's one more thing, Remember the "link = 2" from earlier and the giveitem = "QuestItem1"? Those were related. I want the dialogue to skip directly to the shop if the leak is already fixed. We can do this with an ifitem block.

Code: Select all

namespace = "ZDoom";
include = "SCRIPT00";

conversation
{
    actor = "ScriptedMarine";
    page //The page block here marks the first page
    {
         name = "CDR. Keen";
         dialog = "What are you here for, marine?";
         panel = "KEENPIC"; 
         voice = "KEENDIA1"; 
         drop = "Clip"; 
         link = 2; //This jumps to the page specified (in this case, 2) if the ifitem standards are met
         ifitem //This checks for the item specified below
         {
              item = "QuestItem1"; //And it's our dummy item from before!
         }
         choice
         {
              text = "I want to buy a weapon";
              nextpage = 2;
         }
         choice
         {
              text = "I'd like to report a broken pipe in Sector 8.";
              nextpage = 3;
              giveitem = "Questitem1";
         }
    }
    page //This second page block counts as page 2
    {
         name = "CDR. Keen";
         dialog = "Here's what I got on in the inventory:";
         panel = "KEENPIC"; 
         voice = "KEENDIA2";
         drop = "Clip"; 
         choice
         {
              text = "Shotgun";
              giveitem = "Shotgun";
              yesmessage = "Here you go!";
              nomessage = "Sorry, you cannot afford that";
              nextpage = 2; //Stay on this page
              displaycost = true; //Adds "for 20" after "Shotgun", showing the cost
              cost
              {
                   item = "Coin";
                   amount = 20;
              }
         }
         choice
         {
              text = "Super Shotgun";
              giveitem = "SuperShotgun";
              yesmessage = "Here you go!";
              nomessage = "Sorry, you cannot afford that";
              nextpage = 2;
              displaycost = true;
              cost
              {
                   item = "Coin";
                   amount = 40;
              }
         }
         choice
         {
              text = "Chaingun";
              giveitem = "Chaingun";
              yesmessage = "Here you go!";
              nomessage = "Sorry, you cannot afford that";
              nextpage = 2;
              displaycost = true;
              cost
              {
                   item = "Coin";
                   amount = 20;
              }
         }
         choice
         {
              text = "That's all.";
              nextpage = 1;
              closedialog = true;
         }
    }
    page
    {
         name = "CDR. Keen";
         dialog = "Thank you for reporting that. I'll have a crew fix it in no time!";
         panel = "KEENPIC"; 
         voice = "KEENDIA3";
         choice
         {
              text = "OK.";
              nextpage = 1;
              closedialog = true;
              special = 80;
              arg0 = 2;
         }
    }
}
That's all! Here's a demo map with the dialogue above (although, due to lack of resources, the panel and voice are omitted). You can withdraw money by using the computer. The room ahead has a gray fog affect for steam, and a pipe. The sector damages you, but once you talk to Keen, men show up, the steam is gone, and the sector no longer damages. Of course, all of the effects are low quality, and would most likely be more logical in a real map, but this is only a demonstration map.

https://www.dropbox.com/s/3952rrn2bfp6k ... uedemo.wad

Questions? Let me know below. If you read this whole thing, thank you! It means a lot to me, and I hope it helped. :)

Top