Jump to content

TP2 file coding questions


svj

Recommended Posts

9 hours ago, svj said:

add dialogue options to Bioware NPC like ribald?

would just this suffice?

EXTEND_BOTTOM ~ribald.dlg~ ~revan/d/rq2riba.d~

No, that's not how dialogue additions work. You need to specify inside the d-file what should happen to the existing dialogue (INTERJECT_COPY_TRANS? APPEND? BEGIN a new dlg? etc), then the d-file just gets compiled.

9 hours ago, svj said:

attach bcs to creature file

Most creatures (especially the ones with names and scriptnames) have a unique override script. You would patch new scriptblocks to this. If you want to patch a new script to a creature, make sure you do not overwrite existing ones and consider the Unified cre-Patching in Mods List unless it is a new cre from your mod, of course.

9 hours ago, svj said:

append dlg files to creature file in tp2

This depends on what creatures you are talking about, just a quest giver / merchant or a joinable NPC, and whether it's a new cre from your mod or an exisiting one.

For starting to make an own tp2, I'd recommend to have a look into the weidu readme and to look at other mods that do similar things than what your mod should do.

Since you seem to be new: make sure you register and use a modding prefix to make your mod content unique and do not overwrite other resources:

 

Link to comment
BEGIN rq2riba

IF ~("rqpentachbridgeambush2","GLOBAL",1)~ THEN BEGIN RibaldQuestionAboutRing
    IF ~~ THEN REPLY ~Do you have ring with Turquoise gem inlay that i could purchase?~ GOTO RibaldTheathre1
END

I have this in my file to be appended to dialogue file of Ribald is that sufficient?

Further i have three separate dialogues triggered by different GLOBALS in single D file would all of them need to be prefaced by BEGIN? All appended to Ribald.

I will not be overwriting anything all cre files are mine. I just need a method  to do it in TP2

 

My prefix is RQ = Revan registered here

http://www.blackwyrmlair.net/prefixes/index.php

Edited by svj
Link to comment

To quote the WeiDU documentation:

Quote
BEGIN filename [ nonPausing ] state list  BEGIN tells WeiDU that you are creating a new DLG file from scratch. Any existing DLG file with the same name will be overwritten. The new DLG file contains exactly the states in the list. If you set nonPausing to a non-zero integer, the game will not “stop time” while the conversation takes place. By default time stops during conversations.

Your snippet above creates a new dialogue file rq2riba.DLG. Which, if you want to insert stuff into Ribald's existing dialogue, is not what you want. Either you're assigning that new dialogue to Ribald and losing all his old dialogue, or you're not assigning the new dialogue and it might as well not be there. If you want to edit an existing dialogue file, you don't use (top-level) BEGIN at all. For example, here's a D file from my tweak mod:

Spoiler
ADD_TRANS_ACTION PETRIN BEGIN 1 END BEGIN END ~SetGlobal("J8#BherenNote","GLOBAL",1)~

ADD_TRANS_ACTION RINNIE BEGIN 1 END BEGIN END ~SetGlobal("J8#RinnieNote","GLOBAL",1)~

ADD_TRANS_ACTION FENTEN BEGIN 1 2 END BEGIN END ~SetGlobal("J8#FentenNote","GLOBAL",1)~

ADD_TRANS_ACTION NIKLOS BEGIN 8 END BEGIN END ~SetGlobal("J8#TalkedToNiklos","GLOBAL",1)~

ADD_TRANS_ACTION JOIA BEGIN 4 END BEGIN END ~SetGlobal("J8#JoiaNote","GLOBAL",1)~

ADD_TRANS_ACTION MIRIAN BEGIN 0 END BEGIN END ~SetGlobal("J8#MirianneNote","GLOBAL",1)~

ADD_TRANS_ACTION LANDRI BEGIN 0 1 2 END BEGIN END ~SetGlobal("J8#TalkedToLandrin","GLOBAL",1)~

 

No new states or replies there; I'm just editing existing transitions to add variable-setting actions. And editing a bunch of different dialogues in the same D file.

What you're doing here - new states and transitions from them - looks like work for the APPEND command:

Quote
APPEND [ IF_FILE_EXISTS ] filename state list END This tells WeiDU to place the given states at the end of the already-existing dialogue filename.DLG. If there is IF_FILE_EXISTS and the file doesn’t exists, this action is skipped.

No BEGIN there. You'd just do "APPEND RIBALD [your states] END"

Link to comment
12 minutes ago, svj said:

I would still like to know do you do i would i manipulate chitin.key / dialog.tlk ...

That's something you don't do. At least, not directly. Want a new string to be added to dialog.tlk? You use SAY or RESOLVE_STR_REF commands. And chitin.key isn't something you even think about. Even just dropping a file in override is enough to get it noticed by the game.

As for attaching that stuff to creature files? Most of those are basically just fields in the CRE. A creature's dialogue file is the eight-byte text field at offset 0x2CC (Weidu constant DIALOG), for example. You build that dialogue file, you set the field to your dialogue's filename, and there you are.

Items are a bit more complicated; a CRE has a list of items, complete with sub-fields for flags and charge/quantity numbers, and fields for each inventory/equipment slot that take a number referencing the list. If a number isn't used, the creature doesn't actually have the item. The list's length and placement in the file are defined by a couple of fixed-location fields in the file.

As an example, here's a generic hobgoblin archer HOBGOBA.CRE. Ten items, numbered 0 through 9. Item 0 is COMPB05, an undroppable shortbow clone. Item 1 is AROW01 with quantity 14; 14 normal arrows. Item 2 is RNDTRE03, a random treasure token that's not an actual item but instead rolls on a table when the creature is created. Item 3 is AROW12 with quantity 20; 20 arrows of biting. Item 4 is LEAT01, normal leather armor. Item 5 is COMPS01, an undroppable bastard sword clone. Item 6 is HELM01, a helmet. Item 7 is AROW01 with quantity 20; 20 normal arrows. Item 8 is BOW05 with the "not stealable" flag set; a normal shortbow. And finally, item 9 is SW1H01 with the "not stealable" flag set, a normal bastard sword.

Now we get to the fields for where the items go. Helmet slot? 6. The helmet. Armor slot? 4. The leather armor. Shield? -1. Nothing. Same for lots of other slots; I'll only list the slots that don't have -1 values from now on. Weapon slot 1 = 0, the undroppable shortbow. Weapon slot 2 = 5, the undroppable bastard sword. Quiver slot 1 = 7, the stack of 20 arrows. Quiver slot 2 = 1, the stack of 14 arrows. Quick item slot 1 = 2, the random treasure token. Inventory slot 1 = 8, the droppable shortbow. Inventory slot 2 = 9, the droppable bastard sword. What about the arrows of biting? Nope; this hobgoblin doesn't actually have them.

Fortunately, WeiDU has commands that let you automate a lot of the complicated parts. ADD_CRE_ITEM is particularly useful here, and has its own example section in the documentation. Add an item, set the flags/charges/quantity, put it in the slot you want.

Link to comment
5 hours ago, svj said:

dialog.tlk and attaching BCS,DV,DLG,ITM files to my NPCs

There is no short answer that is not "it depends on what you want to do". Is it a custom character you want to add dialogue and script to? Or a new area? Or an existing character? Do you want to add a whole new script (e.g. for tactics)? Or just add a script block to an existing character needed for your quest?

I can only repeat to go through other mods that do similar things than what you want to achieve, and to me,  the weidu readme was very helpful, too. There are tutorials here at G3 or at PPG. Some concerning NPC modding might be a little outdated but the principles are still the same.

Come back when you have more specific questions.

Link to comment
Quote
rq1cappr.d  rq3temm1.d   rq4hevgu.d   rqbael.d    rqjah2.d   rqrevia.d  rqwili.d
rq1marca.d  rq3temm2.d   rq4waukm.d   rqcowl.d    rqjah4.d   rqriba.d
rq2kamra.d  rq3temob1.d  rq5arcdr.d   rqdermin.d  rqmalch.d  rqrugos.d
rq2penbr.d  rq3temon1.d  rq5grune.d   rqgalvar.d  rqother.d  rqstde.d
rq2riba.d   rq4essli.d   rq5minti.d   rqhass1.d   rqrev25.d  rqtob1.d
rq3anaka.d  rq4grosh.d   rq5pauden.d  rqjah1.d    rqrev.d    rqtob2.d

 

I have these rq*.d files attach them to respective cre files?

copy to override

compile to dlg?

then?

Edited by svj
Link to comment

Same goes for my baf scripts i need to compile them and attach them to my cre files

None of my cre files have Death Variables i dont think i need them that much but still i would like to have them.

I have some custom questing items which i will have to attach to cre files in way so they cannot be stolen

Link to comment
5 hours ago, svj said:

Same goes for my baf scripts i need to compile them and attach them to my cre files

None of my cre files have Death Variables i dont think i need them that much but still i would like to have them.

I have some custom questing items which i will have to attach to cre files in way so they cannot be stolen

The scripts? You just compile them (COMPILE), then fill in the appropriate field on the CRE file. Death variable/script name? That's another field in the CRE file to fill in. Items that can't be stolen? Add them to the character and set the UNSTEALABLE flag. As in

COPY ~%My_Creature%~ ~override~
	ADD_CRE_ITEM ~%My_Item%~ #0 #0 #0 ~UNSTEALABLE~ ~INV~

That's "put the item somewhere in the inventory (with no charges), make it unstealable".

For your .D files which will convert into individual .DLG files for your new creatures, you compile those and fill in the appropriate field in the CRE files.

Filling in the various fields on the CRE files is something you can do in WeiDU (WRITE_ASCII), or it's something you can just do in Near Infinity (or a similar tool) before you ever distribute anything.

Let's see, a creature with custom scripts and dialogue files ... I have one of those in my mod I can show you as an example. From my "Noober's Game" component, an "Unfinished Business"-style rescue of some unused material in the Black Pits 2 files:

	COMPILE ~jtweaks/resource/noober/J8#NOOB.D~ // The main part
	COPY_EXISTING ~OHB6NOOB.CRE~ ~override/J8#NOOB.CRE~ // Noober
		WRITE_ASCII 0x280 ~J8#NOOB~ #32 // Script name
		WRITE_ASCII 0x2cc ~J8#NOOB~ #8 // Dialogue file
		WRITE_ASCII 0x248 ~INITDLG~ #8 // Override script
	BUT_ONLY
	EXTEND_BOTTOM ~BALDUR25.BCS~ ~jtweaks/resource/noober/NooberPatch.baf~ // Summon script

OK, no actual custom scripts for the creature; a generic "initiate dialogue" script was plenty. But it's a fairly simple scheme. Clone an existing creature that already has most of the properties I want (because it's where the unused material came from), assign the dialogue file I just compiled (not reproduced here because it's 172 KB of plain text), give it a script name so I can refer to it if I need to, and there. My custom scripting takes the form of a block in the global ToB script so the guy can be summoned when his variable is set.

Link to comment
Quote

IF ~~ THEN BEGIN RejectebecHarpers
SAY ~Well i shall find someone else.~
EscapeArea()
EXIT
END



[revan/d/rqrev.d] PARSE ERROR at line 53 column 1-19
Near Text: (
syntax error

[revan/d/rqrev.d] ERROR at line 53 column 1-19
Near Text: (
Parsing.Parse_error
ERROR: parsing [revan/d/rqrev.d]: Parsing.Parse_error
ERROR: compiling [revan/d/rqrev.d]!
Stopping installation because of error.

This snippet causes this parse error what is the proper syntax to do stuff after say line

Edited by svj
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...