Recent Posts

Pages: [1] 2 3 ... 10
Editor Discussion / Re: Simple quest and dialogue in Hammerwatch 2
« Last post by MuffinH8er on Today at 02:45:40 AM »
You've put a lot of flexibility in the dialog system. I look forward to what you will do with it. Plenty of different states for the NPC's and I'm interested on how complex you can get the quest. I look forward to seeing the integration in-game and how they play with the editor worldscripts.
Editor Discussion / Simple quest and dialogue in Hammerwatch 2
« Last post by Hipshot on August 18, 2022, 04:16:42 PM »
The dialogue system can be very advanced and call on various features and systems in the game, it's almost impossible to give examples of everything one can do with it, it's one of those things where you just have to experiment and see if you can do "just that".
But at least a basic dialogue and quest is simple to set up and manage, this text will explain how you do that.

(The phrase called mymod, this should be replaced with the name of the mod or something else to make it easier to identify the mod later on.)

To start with you need to create an NPC to talk to, one that can give you the quest and where you will hand it in for a reward.
In the extracted resources, go into the folder, actors/npcs/quest and copy the file named npc_halvard.unit into your modfolder and change the filename to "npc_michael.unit'.
Open the new npc and find where it says:
Code: [Select]
%defblock Dialog

%defblock Schedule
Change it so it looks like this:
Code: [Select]
%defblock Dialog

%defblock Schedule
This changes so the dialogue Michael uses are directed to a file in your modfolder and that he will be able to talk to you all hours of the day instead of just from 06 to 22 and he won't go to sleep either, he will just stand in one place whatever happens around him, you can also change where it says NPCNAME from Halvard to Michael to make it simpler to detect the npc in the game when debugging if needed.

Now you have an npc you can place in a mod level, you will have to restart the editor to see this new unit.
You will notice that when you walk up to Michael, you can't interact with him or anything like that. It's because he's missing his dialogue.

Let's add a dialogue and at the same time, add a quest to that.
We need another file to do this, a .mas file that will handle all dialogue and quests for NPCs in your mod. In the extracted resources, go into the folder tweak/quests and copy the file called world.mas into your mod folder.
Rename the file to mymod.mas. this file should contain all dialogue and quests for your mod, you can make more file if you feel it's easier or include like we have done in the base game, but in most cases you should be fine with only one file as in this example. Open the file.

To make it easier upon yourself, erase everything inside it and paste the following:
Code: [Select]
%include "scripts/Quests/"
%include "tweak/quests/"
void Execute()
GenerateFiles("mymod_world.sval", "mymod_dialog.sval");

Now you have a clean basic structure where you can add dialogue trees and quests.

Let's give Michael a dialogue that will give you a quest that you can complete.
In the .mas file, copy what's below, either the entire thing or just what's missing from the clean one you just made.
Code: [Select]
%include "scripts/Quests/"
%include "tweak/quests/"
void Execute()

CreateDialog("npc_michael", "Michael Douglas");

SetText("Hi, I'm looking for a few carrots, can you help me find these?");
SetActiveText("Did you ever find any carrots?");
SetFinishedText("Great, nom nom!");
SetAfterText("I just love carrots. I hope these lasts long!");

CreateQuest("quest-michaelsquest", "The Carrot Lover", "I love carrots, I can eat them all day if I had enough. You know, if you can bring me a hefty load, I will give you these rare boots? How about it?");
AddMissionCollectItem("carrot", 15, true);
AddRewardEquipment("feet", "epic", "expert");

GenerateFiles("mymod_world.sval", "mymod_dialog.sval");

If we break down what we see here a bit. The first line, where it says CreateDialog is what defines a dialogue for an npc here we also have the name that will be displayed on the speech bubble, more or less the name of the NPC how it's shown to players in the game. After we have that defined, we can give the npc various different types of dialogue types like, TimedPrompt, DetailPrompt, QueryPrompt etc, but now we will use the QuestPrompt.

This is a break down of the quest prompt, the most basic usage of it:

AddQuestPrompt -> This must be the corrent ID of the quest you want attached to this dialogue.
SetText -> This is the speech bubble dialogue of the npc, the one that will lure the player to take the quest.
SetActiveText -> This is the speech bubble dialogue displayed while the quest is active (not finished).
SetFinishedText -> Short speech bubble text shown when you complete the quest, usually something like "thanks".
SetAfterText -> When the quest is complete, the npc will say this.

Then after that we will add the quest itself, the one that will show up in the quest log and give us a reward when we complete it, in this case, find 15 carrots and hand them to Michael. A quest can have a plethora of variables, too many to list now, this is just a simple quest so.

CreateQuest -> The first segment is the quest ID, this is the one you call from the QuestPrompt, then you have the quest name and last the quest description, these two are displayed when you push the button for more info and can also be seen in the quest log later on.
AddMissionCollectItem -> This one defines what item to find and how many of them, the true value is set if you also want to have these items removed from your inventory, in 99% of the cases you want this.
AddRewardEquipment -> These are the boots that you get as reward when you complete the quest.
AddRewardExperience -> And this is how much experience you gain.

If you want to make another npc with another quest, duplicate this entire text and rename the CreateDialog to something else, like npc_karen or so and then play around with different quest requirements, like change the carrot to apple or dirt, you can also give money as reward or take money from the player when he completes the quest.
Editor Discussion / Re: Selling items in a custom shop (Trick??)
« Last post by Interstellar50 on August 09, 2021, 08:46:24 AM »
ธhis is cool!!! It's the best idea. I'm going to follow along.
Hammerwatch Discussion / Re: SpeedRunning
« Last post by Interstellar50 on August 09, 2021, 08:44:10 AM »
I'm waiting for an answer from someone who knows too.
Editor Discussion / Re: Original Campaigns
« Last post by pomphan on July 13, 2021, 09:19:07 AM »
How can i use different projectiles for the ranger?
i mean i want use arrow for normal attack ... but i want use another type of projectile for the spread attack but in the ranger.xml i cant apply another type of projectile on that.....
Editor Discussion / Re: Different projectiles question
« Last post by pomphan on July 13, 2021, 09:18:30 AM »
I want to know more about this. It will make me get more and more back.
Technical Support / Nintendo switch: Cannot find games
« Last post by itskando on May 17, 2021, 11:56:08 PM »
2 switches, same home
Friends on Nintendo account

If one hosts game in:
Online public
Online private

Other never sees game appear in server list
Hammerwatch Discussion / Re: HammerWatch on Mobile ?
« Last post by wdb2021 on April 08, 2021, 08:35:42 AM »
It would be great if I had a mobile version. I didn't have screen time all day. I would like to play it anywhere.
Technical Support / Re: Everything is red?
« Last post by wdb2021 on April 08, 2021, 08:33:53 AM »
็Hey friend, you have to change your computer. Your computer is already in serious trouble.
Hammerwatch Discussion / SpeedRunning
« Last post by PuppetPonguin on March 25, 2021, 06:22:40 AM »
I've been wanting to speedrun Hammerwatch, but I cant find any guides, so I decided I'd make my own, the only problem is I can't draw any routes on maps as I can't find any full map screenshots. (i already have floors 1,2,3,6 and a bad 11 screenshots)

if anyone knows how to make these screenshots or if anyone has some others it'd be appreciated.
Pages: [1] 2 3 ... 10