Jump to content

Newbie Modding Questions


Twani

Recommended Posts

Complete newbie question incoming.

 

I'm delving into beginning to code the mod that i am currently creating. In doing so, and delving through tutorials and existing mods, i've stumbled across a number of different ways to structure things - specifically dialogue.

 

One model, advocated in most tutorials seems to be the most extensive with a whole lot of IF THEN REPLY and a bit chaotic structure. A bit hard to read, but perhaps the easiest to troubleshoot as a beginner.

 

The second models seems to involve abuse of CHAIN with a lot of "++" "@1" and dialogue contained within /* Dialogue */. This seems to be very easy to follow when writing and reading the material, but seems very prone to errors if you're inexperienced (like me).

 

Can you tell me anything about these two different ways that may help me choose? A few warnings perhaps? Notes? Currently, i am coding by trying to understand the logic through tutorials and reading the codes from other mods.

Link to comment

What you're seeing with @1 and dialogue within /* brackets */ is not actually a coding style. That's a mod that has already been prepared for translation. Unfortunately, because of BG2EE's journal system, mods that are compatible with BG2EE have had to be upgraded to it, so you won't get much help from them anymore. It's possible to download earlier versions of a mod, though, so go back to a pre-traified version to see what you should actually be looking at.

Link to comment

"IF ~condition~ THEN REPLY ~text~ GOTO statename"

 

is equal to

 

"+ ~condition~ + ~text~ + statename"

 

it's just a short version.

Without the ~condition~ the "IF ~~ THEN REPLY" shortens to "++".

 

The @1 numbers are for dialogues that are split into .d/.tra pairs, with the tra-files having the text lines ("@0 = ~text~"). This is important for different language versions.

 

The /* dialogue */ is put in by the modder to see the text line in the d-file. Everything in /* */ is a comment that gets ignored by the installer.

Link to comment

New issue incoming - well, not an issue exactly. It *seems* to be working. It just doesn't show up in game. I've been coding away for a few hours now. Coded the joining, leaving and rejoining dialogues with my NPC. Even added some scripted spellcasts and leavearea-commands that all work out perfectly.

 

The trouble is banter.

 

Within the spoilerbrackets you'll find a simple banter-template i wrote based off another mod as well as off the excellent modding tutorial i found linked here. So far so good - everything installs and compiles perfectly with zero errors.

 

However - the banter doesn't fire. I've manually sped up the game several times - banters and talks fire, but never *my* banter. Is there any way to ensure that my banter will fire, to test it out, or is the fact that it installs without error enough indication to ensure that it *does* indeed work, it's just random?

 

Thank you in advance!

 

 

 

 

// ---------------------------------------------

// Liella Banter

// ---------------------------------------------

 

BEGIN LL#LiB

 

CHAIN IF ~InParty("Viconia")

See("Viconia")

!StateCheck("Viconia",CD_STATE_NOTVALID)

!StateCheck("Liella",CD_STATE_NOTVALID)

CombatCounter(0)

!See([ENEMY])

Global("LiellaViconia","GLOBAL",0)~ THEN LL#LiB LiellaViconia_1

~IntroBanter~

DO ~ActionOverride("Liella",SetGlobal("LiellaViconia","GLOBAL",1)) ActionOverride("Viconia",SetGlobal("LiellaViconia","GLOBAL",1))~

== BVICONI ~Banterhere~

== LL#LiB ~BanterThere~

== BVICONI ~BanterHere~

== LL#LiB ~BanterThere~

== BVICONI ~Banterhere~

== LL#LiB ~Banterthere~

== BVICONI ~‘Banterhere~

EXIT

 

 

Link to comment

Did you assign the LL#LiB to the NPC's Script Variable as banter dialogue file (to the interdia.tp2)?

Did you try having only Viconia and your NPC in the party when hitting "Ctrl.+i"?

 

btw:

ActionOverride("Liella",SetGlobal("LiellaViconia","GLOBAL",1)) ActionOverride("Viconia",SetGlobal("LiellaViconia","GLOBAL",1))

Global variables can be set by any script. You can shorten this to "SetGlobal("LiellaViconia","GLOBAL",1)"

Link to comment

Did you assign the LL#LiB to the NPC's Script Variable as banter dialogue file (to the interdia.tp2)?

 

I must confess - i have no real clue as to what that means. I'm currently following a very straightforward guide in the matter - which told me to make the LL#LiB-file, begin with the customary BEGIN command, and then write up pretty much what you see before you (as well as obviously adding the compile line to the tp2-file). However, after following your advice of removing other NPC's as well as replacing the longer code with the much shorter, the banter seems to work perfectly :). Following this model, i should be able to write banters for all NPC's by simply incrementing the numbers - as seen in other mods. Thank you for your assistance!

 

"LiellaViconia"

Oh, and very important: Also mark the variables with your personal prefix, or it might be that other mods overwrite yours and vice versa.

You're quite right - fixed!

 

 

 

...and if someone is around for another question - Interjections.

 

 

 

 

 

// ---------------------------------------------

// Liella Joined

// ---------------------------------------------

 

BEGIN LL#LiJ

 

 

INTERJECT_COPY_TRANS NALIA 45 LL#LiellaCommentNalia

== LL#LiJ IF ~InParty("Liella") InMyArea("Liella")~ THEN

~Look at that.~

END

 

 

 

However, the same sort of "error" happens here. It installs and compiles without flaw, yet when encountering the situation (Nalia saying "Is anyone willing to hear my plea"), despite being close and in the area, my NPC does not respond.

Link to comment

Hm, code looks fine, and should work from all over the area, too (so "NPC too far away" cannot be the problem). I would check whether it's really the right state from the Nalia dialogue, and whetehr the dialogue was compiled OK.

 

Just a note: Best you add a check whether Liella can actually talk, too (have a look at CD_STATE_INVALID), or the I_C_T will force-end the dialogue if your NPC cannot talk.

 

And... Don't foget to tag your script variables with your personal prefix, too (as well as all the file names for dlg, itm, cre, etc..)

Link to comment

Might have found the error - or *an* error at least. The guide tells me to change the Override script in the CRE file in NearInfinity to my NPC's filename - LL#Li. I thought i did, but apparently i cannot find the LL#Li in the list. It's instead been Loupgar.bcs, which probably causes all manner of confusion. The guide doesn't hint as how to fix this, so i must be missing something rather obvious.

Link to comment

The list in NI only shows the installed scripts. To change the name to a new one, right click on the script name field, chose "edit as string", and type your script name in without the bcs-ending.

 

The script has nothing to do with the interjection, though.

Link to comment

Fixed! Thanks :).

 

The interjection seems a bit odd, for certain. I've added a state check in the form of "!StateCheck("Liella",CD_STATE_NOTVALID)" and also added the following in the TP2 to make sure i can *use* the check. Still no interjection. The dialogue seems correct - 45 is the number of the relevant Nalia-speech. 'Tis an oddity!

 

// Adds CD_STATE_NOTVALID state

APPEND ~STATE.IDS~ ~0x80101FEF CD_STATE_NOTVALID~

UNLESS ~CD_STATE_NOTVALID~

 

 

Edit: I tried adding a few PID's to the J-file. The same thing (Non-response) happened here as well however, despite it compiling flawlessly with zero errors. The only thing i can imagine or consider in my inexperience is that somehow the conditions that across the board contain the "Liella" description are somehow flawed - that'd account for both interjection and PID's not working (Since i haven't set any romance or progressional conditions for the PIDs, only Noncombat and Notvalid.)

 

The name "Liella" contained within the conditions - what should it reflect? The character's name? This seemed to be the case in the banters, and the banter i've written seems to be working fine.

Link to comment

And i found it. My NPC id was LL#Li - a relic, i suspect from me misunderstanding the tutorial. Or perhaps i am still misunderstanding naming conventions. In any case - i renamed the DV to "Liella" and now all PIDs and interjections work fine.

 

Now my banters don't seem to trigger however. I do feel like i'm doing one (multiple) things incorrectly. Pasting information from my Tp2. My characters current DV is"Liella". When the DV was "LL#Li", the banters worked but the PID's/Interjections did not. When i change it to this, the Interjections and PID's work, but banters won't trigger.

 

 

 

APPEND ~interdia.2da~ ~LIELLA LL#LiB LL#LiB25~

UNLESS ~LIELLA~

 

APPEND ~pdialog.2da~ ~LIELLA LL#LiP LL#LiJ LL#LiD LL#Li25P LL#Li25J LL#Li25D LL#Li25~

UNLESS ~LIELLA~

 

 

 

Regardless - no hurry in responding! I apologize for the numerous questions - i feel like i've reached considerable heights today considering i started from zero, much thanks to you guys :). Gonna close down the coding for today and pick it up tomorrow again.

Link to comment

The name "Liella" contained within the conditions - what should it reflect? The character's name? This seemed to be the case in the banters, and the banter i've written seems to be working fine.

If you spawn a creature, you use the file name. If you want an existing creature to do something via script, or being detcted by other creatures etc., you use the Script Variable that is also assigned in the cre file (e.g. via NI).

 

I would like to repeat my note to flag the Script Variable(s) for your creatures with a prefix, too. Everything added by your mod that could lead to a potential conflict should use the prefix (variable names, Script Names (formerly know as Death Variables), file names). You'll save yourself a lot of trouble later. (btw. reservation of prefixes is here).

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...