Creating a quest with XV2 Quest Creator/XV2 Quest Importer
Jun 28, 2018 11:03:32 GMT
atsuraelu likes this
Post by eternity on Jun 28, 2018 11:03:32 GMT
Creating a quest is a bit different to all other mod types. You may notice when you start XV2 Quest Creator, that the gui is quite simple and has only two tabs. This is because the quest development is done in a text editor (it is advised to use Notepad++) using a simple language created for this, called X2QS.
X2QS language is pretty much a data language, not a programming language, so you don't really need to have programming skills to create quests. Only part that resembles a primitive programming is the script part of the quest, but these are still quite more simple than regular programming.
Usually you will be using one of the decompiled vanilla quests as base (or one of the sample quests), and start modifying from there. But creating a quest from scratch is certainly possible, as some of the example quests were almost created from scratch (except for things like the Quest object).
Differences between the XV2 Quest Creator+XV2 Mods Installer and the XV2 Quest Importer.
You may have also noticed that there are two programs, the XV2 Quest Creator and the XV2 Quest Importer. You will be using both during development, but users will usually just use the XV2 Mods Installer (unless your quest is not of paralell/expert types, then they will need the XV2 Quest Importer).
- The XV2 Quest Creator+XV2 Mods Installer can create+install new quests, without overwriting any vanilla quest. But it is (currently) limited to parallel (TMQ) and expert (HLQ) quests. The XV2 Quest Creator will reject a quest whose identifier matches the one of a vanilla quest, so it cannot be used to replace vanilla content.
- The XV2 Quest Importer can replace any quest that exists in the game (wether it was vanilla or was added by installer or other means). The XV2 Quest Importer requires the identifier of the quest to match the one of the quest being replaced.
- The XV2 Quest Importer uses directly the x2qs files. They get installed by using the import function in the context menu of the XV2 Quest Importer.
- The XV2 Quest Creator uses the x2m format. Quest are internally in x2qs aswell, but they get wrapped inside a .x2m file, which is what the user will be installing using the XV2 Mods Installer.
- Both of them support referencing X2M mods (chars, stages, skills, costumes), but only the XV2 Quest Creator can have them, optionally, attached inside the x2m, so that they get installed before. (For a matter of fact, if the user is missing a referenced mod, the Installer or the Importer will just show an error and the installation gets canceled).
- Both of them support custom audio. The difference is that in the .x2m quests, they go inside a dedicated directory for it (that you set using the Files tab in the Quest Creator), while for the loose x2qs for the XV2 Quest Importer, the .hca files must be in the same directory.
Other than these differences, they are pretty much the same thing. You will usually use x2m to deploy Parallel and Expert quests, and loose x2qs if you need to create a quest of other type.
First Time Preparations
These are steps that you only need to do the first time.
Get all tools and resources
- The XV2 Quest Creator is included with all the other creators inside the XV2 Mods Installer download.
- The XV2 Quest Importer has its own download in my Tools thread. It has inside the decompiled vanilla quests, as well as extracted dialogue (only text) and titles (these are all in the .zip file "Vanilla quests"). It also contains inside the Notepad++ syntax hightlight xml for x2qs (see a bit below)
- The sample quests have a download in my Tools thread. These are a collections of 6 quests (3 expert, and 3 parallel) that were created for educative purposes, as well as for testing and hunting bugs. These sample quests have some comments that may help you in quest development.
Setting Notepad++ syntax highlithing
While this step is not strictly mandatory, you will probably want to do it anyway, because it makes the x2qs files more readable and you can quickly catch some syntax errors like bad spelling of object types.
Open Notepad++. Go to the "Language->Define your own language" menu. Click on import. Select the X2QS.xml file included in the XV2 Quest Importer (inside the Syntax Hightlight for Notepad++ folder). And that's it. Verify that .x2qs files get colouring like these:
And that should be all first-time preparations needed.
Generic procedure for creating a quest
This section shows a proposed generic aproach on how developing quests. In this concrete case, it would be for a x2m quest.
1) Choosing the base.
You will likely want to have a vanilla or a sample quest as base. Even if you later ditch most of it, you will at least want to reuse things like parts of the Quest object. So copy the quest to anywhere in your pc (you probably want to use an empty folder)
Choose a quest that is of the same type that the one you are creating. And if possible, one that is closer to it, or that uses the same features. For example, if you are going to do a expert quest that uses Mind Control attack, the desired base would be a vanilla quest that uses Mind Control attack.
If you already have a custom quest built in other ways, you can convert it to x2qs with the "export" functionality of the XV2 Quest Importer (select the quest, right click, export).
2) Change the identifier of the Quest object and nothing else (the quest object is located in quest.x2qs). Eg. change TMQ_3000 to for example TMQ_AAA_BBB. As proposal, replace AAA with a shortening of your modder name, and BBB with a shortening of quest title or soemthing alike). However that is not mandatory, the only mandatory part is that the quest must start with quest type (like TMQ_) and that it must be different to a vanilla quest.
3) Start the creator. Fill the Info tab. In the files tab, just set the quest directory to the directory where you copied the base quest. Save the mod.
4) Install the mod with the Xv2 Mods Installer. Once this is done, your new quest should appear in game. Of course, it is currently nothing but a clone of the base quest.
5) Now that the quest exists in the game, the quest can be re-imported with the XV2 Quest Importer as many times as needed while developing the quest. You may wonder, why to use the XV2 Quest Importer if creating a x2m quest? Because importing a quest with the XV2 Quest Importer is a lot faster than continually saving the mod as x2m+installing it. This is only for developing, at the very end you will have to use the creator again (see step 7)
So, with the XV2 Quest Importer locate your quest. Right click on it, select import. Select the directory with the x2qs files. You will be doing this lot of times when developing the quest. But don't worry, the Quest Importer remembers the last directory.
6) Keep doing all necessary changes to the x2qs files and re-importing it with the XV2 Quest Importer until the quest is complete.
7) Once the quest development is complete, you have to update the x2m with the new x2qs data. So, don't forget to set the Quest directory again in the Files tab. If your quest used custom audio, don't forget to set the files in the Audio directory. If your quest needs additional files, use the Additional files. Optionally, your quest can have x2m attachments, these are set in the attachments directory.
About mods attaching: if you attach a mod inside a quest x2m, you need permission of the author. But if you only reference them in the x2qs files, there is no need for permission, as the user would still need to get the mod by themselves. In the later case, if the referenced mod wasn't found in the installation, the quest installation would fail, so make sure to inform the users about any external requirement.
Changes that require game reboot and changes that only require to restart the quest.
This section is actually very important, so don't skip it.
Some objects require a game reboot to notice the chances (or even for the quest to work), while some others only require to restart the quest (which you can do with the pause menu in game).
Luckily, the thing you will be changin more, the Script, only requires a quest restart.
- Changes that require game reboot: any change in the Quest object, in any ItemCollection or in a QxdChar. If the change is in QxdChar, the quest won't work at all until you reboot the game (due to technical reasons)
- Changes that only require a quest restart: changes to QmlChar, Dialogue, InteractiveDialogue, EventDialogue, CharPosition, InteractiveCharPosition, ItemPosition, Script and anything that usually goes inside the scripts.x2qs files.
- About changes in dialogue texts, audio and in titles (that includes quest outline, failure conditions, etc). These usually only needed a quest restart (or going back to Conton in case of titles).
However, if a change makes the importer or the installer to write a file to the data folder for first time (for example, let's say that qe_ep01_en.msg is written for first time), in that case, a reboot of the game is needed. This is actually due to a limitation of the xv2patcher, it is unrelated to the game or the tools.
General advices
Some advices that may save you from headaches.
- Take a look at least to one of the sample quests code. There you will understand how to do basic things like using custom title, failure conditions, etc. You need TextEntry objects to have custom title, failure conditions, etc. In the case of decompiled vanilla quests, because they use vanilla resources, you won't see things like TextEntry or TextAudioEntry objects being used, which is why the sample quests are a better example for things like this.
- If the "stage" field in the Player QmlChar doesn't match the "start_stage" in the Quest object, the CharaSpawn actions will not work. I made a mistake like this while developing one of the example quests, and it took me a while to figure out where the error was. So, learn from my mistakes.
- I know that I already wrote it in the sample quests comments, but I guess it can be repeated here aswell: the "battle_index" field in the QmlChar objects, is of crucial importance when designing your quest. Not realizing this will make you suffer when attempting chara spawns.
Basically, the game can only have 7 chars loaded at once. These are battle_index from 0-6. This means, that two chars that have the same battle_index cannot co-exist at the same time in the same stage. It is fine if two or more characters that are on different stages have same battle_index. It is also fine if they are on same stage, but they are set to spawn after the first one gets removed.
- In most contexts, CharaSpawn actions requires you to previously load a character with LoadChara or SetReplaceCharaLoad (please read documentation of SetReplaceCharaLoad, you may want to set the third param to false to avoid it from being shown until Charaspawn happens).
Anyway, all the sample quests have several example of chara spawns. Take a look at them.
- By default, characters other than Players that get killed, get auto removed when they get ko. To prevent that, use the Action DontRemoveOnKo on them at the beginning of quest.
- Some quest functionality like having Dragon Balls, mind control attack, or scatter attack require the "sub_type" quest in the Quest field to have the proper value. Please read the comments in the sample quests for that. In the case of Dragon Balls quests, you should also consider that not all stages have support for dragon ball positions, in fact, it is only a few of them.
- Quest that can fail by script (by calling QuestFinishState(FAIL) and then QuestClear). These ones should have the proper "QxdUnks". Just copy the ones of a quest that can fail by script (the example quest "Towa's Servant" is an example of this).
If you don't do this, failing the quest by script will cause the quest to actually be cleared even if the fail word appears before in screen.
- Use "FOF" code in CharPortrait in quest object, to make a question mark to appear instead of a char portrait. Use "flags: 0x200" to make the quest time to appear as unknown in the quest description.
- The "update_requirement" other than ANY in a parallel quest will make your quest go in the "New missions" section. If it is ANY, the "difficulty" parameter will determine the submenu where it will appear.
- Avoid having more than 5 stages in a parallel quest. If you get over it, you will get the same minor bug that the sample quest "A world full of challenges" has: the last stage won't display the green/gray icon.
- ModelChange functions: these functions allow a qml char to transform into another. However, they must have different battle_index or the action will fail.
Some considerations about the language
- The ";" is used for comments. Anything after the ";" is ignored by the compiler (except if ";" is inside a string, this is, inside some quotes)
- The language is not case sensitive. Quest and quest are the same thing for the compiler.
- The identifiers names can be anything that contains the letters A-Z,a-z, numbers 0-9 and the symbol "_". Any other symbol or letter is rejected for an identifier name. Also, although numbers are allowed, they cannot be the first character of the identifier. Additionally, the language has few reserved words. For example if you put "TextAudioEntry Dialogue", that will give an error, because Dialogue is a reserved keyword that is used for Dialogue object.
- The compiler compiles the files in the following order: quest.x2qs, chars.x2qs, dialogue.x2qs, positions.x2qs, script.x2qs (those are mandatory files). After that it checks if script1.x2qs exists, and it will compile it too if it does. If script1.x2qs existed, then script2.x2qs is also checked, and so on until script3.x2qs. This is important to know because if the compiler finds something that is not defined yet, it cannot use it.
- The compiler understands the decimal and hexadecimal systems for numbers, and nothing else. If a number has the 0x prefix, it is considered hexadecimal, otherwise, decimal. Octal or binary numbers are not supported.
- The compiler automatically converts integer numbers into floats when a float is expected, but not the opposite. This means that if for example a certain field requires a float number, but you specify an integer number like "15", the compiler would automatically convert it to "15.0". But if a certain field expects an integer number, and you put a float number like "15.0", you will get an error.
Resources
Just some links to pages in the id list.