Jump to content

Newbie Modding Questions


Twani

Recommended Posts

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).

 

 

It seems that the prefix i'd applied for was already taken (or rather, not accepted, seems only 2-letter prefixes are okay these days) - forgot to check back on it a few weeks ago. I'll have to find a new one and rework what i've coded so far in the morning - oh well! I'll switch so another, unregistered prefix and correct what i've done thus far. Better to be thorough than hasty :).

 

My apologies also. In retrospect, it seems like i could have avoided a lot of the trouble i had today by simple going over things a few more times.

Link to comment
It seems that the prefix i'd applied for was already taken...
The Notepad has replace command... just put your former prefix and replace all of them with the new one... easy as pie...

 

Good point! Man, it really shows that i haven't slept in 35 hours :).

Link to comment

Alright. Good progress this morning thus far. No real questions, as much as assurances and accords, as it were.

 

I've changed my prefix to something unique that i've now reserved - "W5". Changed every relevant variable and name as well. It all seems to work out good! Patience and thoroughness paying off!

 

First off: I had a bit of a problem this morning getting a banter to work. In this specific case, the tutorial i follow called for me to write the following as part of the banter.

 

 

 

 

THEN W5LiB LiellaPC1

~Heya, <CHARNAME>, how goes it?~

DO ~(“W5LiellaPCTalk”,”GLOBAL”,3)~

 

 

 

However, when installing this, i kept getting syntax errors related to the exact line of the DO ~(“W5LiellaPCTalk”,”GLOBAL”,3)~. Comparing it to my other banters in the B-file, i finally noticed that the other cases where global variables are set, it was preceded not only by DO, but by SetGlobal. Changing that immediately fixed the error - i'm guessing this is either a fault in the tutorial, or perhaps since i'm debugging and testing everything i do in BG2EE, it might be that BG2EE doesn't accept only the DO. What i wanted to ask if this is the case - if the SetGlobal is always required when changing this sort of variable.

 

Secondly:

 

I tried my hand on writing a timer to try and trigger said banter after three days of joining. Code in the spoiler.

 

 

 

IF

 

Global("W5LiellaJoined","LOCALS",1)

Global("W5LiellaPCTalk","GLOBALS",0)

THEN

RESPONSE #100

SetGlobal("W5LiellaPCTalk","GLOBAL",1)

SetGlobalTimer("W5LiTimer","GLOBAL",THREE_DAYS)

END

 

IF

GlobalTimerExpired("W5LiTimer","GLOBAL")

Global("W5LiellaPCTalk","GLOBAL",1)

THEN

RESPONSE #100

SetGlobal("W5LiellaPCTalk","GLOBAL",1)

Interact(Player1)

END

 

 

Compiling was fine, but after adding the baf-file into the install, my interjection (singular, only one so far, the one with nalia) kept not working. In fact, her entire conversation crashed and simply quit after the "I've helped lots of your kind!" Finally i figured that i should actually debug my mod on a clean BG2EE install, uncluttered with other mods. After installing a second install, the script installed fine and no longer broke interjections. I suppose i was hoping you could tell me if i've done something horrible in the script that would cause an error like that - if other mods were to be installed. I've read and re-read the code over and over and compared it to the code i was told to write - seems fine to me.

 

Other than that - i've managed to add portraits to be installed when installing the mod, trying out some other interjections to see if i can make all of those work as i want to and generally experimenting with the code. I think i'll try to add all of the SoA banter later on today (There's no danger of doing that early on if i'm careful about naming the banters for later on, when i want to decide how to trigger then apart from the internal banter engine, right?). Quite fun, when one gets into it and so far it's been a pretty smooth ride - thanks mostly to you guys and your excellent help and quick responses!

Link to comment

You have to watch your script logic as well as your script syntax. In the second block of your script, you say "if my timer expired and variable W5LiellaPcTalk is 1, I want to set that variable to 1 and interact with Player". Logic demands that the variable be set to something else, otherwise the game would be stuck in a loop/stutter. Setting it to 2 and changing the check in your conversation to 2 is likely the answer.

 

Also, for safety reasons, I'd still use basic InParty() checks for all script blocks, and I would also recommend you never ever use Interact anywhere - StartDialogueNoSet is much more liberal and won't crash your game if one of the characters is suddenly in a building/too far from each other.

 

 

If a tutorial author made a syntax error in their tutorial, please, let them know - I would myself, but I don't know which tutorial it is(I don't think I saw anything like this in our G3/PPG tutorials, though I might be mistaken).

Link to comment

You have to watch your script logic as well as your script syntax. In the second block of your script, you say "if my timer expired and variable W5LiellaPcTalk is 1, I want to set that variable to 1 and interact with Player". Logic demands that the variable be set to something else, otherwise the game would be stuck in a loop/stutter. Setting it to 2 and changing the check in your conversation to 2 is likely the answer.

 

Also, for safety reasons, I'd still use basic InParty() checks for all script blocks, and I would also recommend you never ever use Interact anywhere - StartDialogueNoSet is much more liberal and won't crash your game if one of the characters is suddenly in a building/too far from each other.

 

 

If a tutorial author made a syntax error in their tutorial, please, let them know - I would myself, but I don't know which tutorial it is(I don't think I saw anything like this in our G3/PPG tutorials, though I might be mistaken).

 

Understood - i'll try that. That might also explain why i just found out that the script causes Liella to move in stutters - i.e, she stops moving every few seconds.

 

I don't want to oust the tutorial or anything since i think it's more than likely that i've just made a mistake or done something incorrect - i'll send you a PM with the relevant tutorial attached with the pages/passages.

Link to comment

What Kulyok said. The SetGlobal() in the second script block should set the variable to "2", either this, or if the dialogue triggers for variable = 1, in this case (only !) you whould take the "GlobalTimerExoired()" check also into the dialogue trigger (or the dialogue will trigger instead of another one at some point, because the variable is already true).

 

To your first question: This could be an error in the tutorial. The SetGlobal cannot be left out. Feedback to the author would be very much appreciated, indeed.

 

And, als as Kulyok pointed out: It has advantages to put all scripted dialogues into the joined dialogue file, i.e. xxxJ.dlg. Then they are triggered using StartDialogueNoSet(). The "Interact()" command triggers banters from the banter file (xxxB.dlg). But if you trigger a banter there, it might well be that instead of your triggered banter, an untriggered banter with true conditions fires instead, which is to be avoided.

Link to comment

Alright, quick update. It seems that i've been following a set of rather out-of-date guides that - while being extremely extensive and good in many ways - are no longer supported.

 

After following Kulyok's excellent banter guide on how to making things run when you want them to, i've managed to create a series of banters that fire exactly when and how i want, including both from the B-file as well from the J-file. using Interact and StartDialogueNoSet. Also, no longer a stuttering character.

 

However - when pulling the dialogue from the Joined-file, i not only get the banter - but instead the NPC starts up the PID-conversation in the J-file as well, before the banter. After following the marvelous technique of "looking at other mods to see how they do it" i moved the PID conversation and enclosed it in an APPEND as well as another END. Now the banter fires without problem from the J-file, as it should and my PID's still work fine as well. The question is, is this a good way of handling it?`I've checked the G3 tutorial on the APPEND and while i grasp the general concept of it - allowing other NPCs to begin or end a discussion -, i'd be very grateful for any advice on what this did and if/what i should be careful of.

Link to comment

Not sure you mean APPEND in the above context.

 

APPEND dlgname
..
END

Is just a way to append to an existing dialogue file, that is all. - Ah, I think that's what you meant, by using APPEND you append to other NPC's dialogue file, so they can begin a conversation. That is correct.

 

For the PID, all you need to consider is: It has to be last in the (compiled!) dialogue file of your NPC. Because dlgs are searched by the engine from top to bottom - the first true dialogue triggers, regardless whether this is actually the one the script was trying to trigger. So, if your PID is on top of the scripted dialogue, it will trigger instead, and if the script is still true, it will trigger again etc.

 

PIDs work just the way that it's an always true dialogue that gets triggered when the PC talks to the NPC because there is no other, true dialogue on top of it.

 

This is for the compiled dlg-file, mind. So, theoretically, if you are using CHAIN syntax, it could be that your .d-file gets compiled in a way that the PID-dialogue (which might be last in your .d-file) gets compiled before your CHAIN dialogues. This is because CHAINs are compiled a bit differently and not necessarily in the order they appear in your .d-file (especially not in addition to APPENDs ).

 

What almost all NPC mods do, is to put the PIDs into a separate .d-file, and compile it separately, and last in your tp2.

Link to comment

Let's view your J dialogue file is a list of dialogues, basically - dialogue 1, dialogue 2, and so on. Your PID dialogue should always-always-always be the last dialogue on the bottom of the list. As long as it's there, it will not trigger instead of a different conversation. APPEND doesn't matter so much - APPEND basically means "this file contains different things from other dialogue files, like a CHAIN between MINSC, PC and JAHEIRA, and it means the compiler may be confused after CHAIN, so I want to put APPEND on this list of dialogues here to make sure everything compiles correctly".

Link to comment

Awesome - thank you both for your explanations!

 

And thank you, Kulyok for your excellent guide on scripting romances and banters. I'm currently deeply entrenched in entering the lovetalks into code - quick question regarding that.

 

In the script file - may i add multiple racial requirements in the same block and have them viewed as "Human OR Half-orc OR Elf", or would doing it like in the spoiler below not work properly?

 

 

 

IF

InParty(Myself)

Gender(Player1,MALE)

OR(4)

Race(Player1,ELF)

Race(Player1,HALF_ELF)

Race(Player1,HALFORC)

Race(Player1,HUMAN)

Global("W5LiLoveTalk","GLOBAL",0)

THEN

RESPONSE #100

RealSetGlobalTimer("W5LiRomanceTimer","GLOBAL",3000)

SetGlobal("W5LiRomanceActive","GLOBAL",1)

SetGlobal("W5LiLoveTalk","GLOBAL",1)

END

 

 

 

Edit: Actually, nevermind. Your tutorial answers that. If i understand it correctly, using the OR(4) with them - making the code in the spoiler work. Please correct me if i'm wrong.

 

 

Also, currently, when i try out my lovetalks in order to debug them - once the lovetalks have reached their end and i advance time, Liella gets stuck in a loop of PID-conversations and trying to approach the PC with her PID convo/standing in one spot self-selecting. Do i need to write a script for as to how/when PID's are available in order to prevent this looping?

Link to comment

Your script should work for the OR() thingy. As for your loop, there must be a variable that's not "closing" - that is, not updating after the talk. Check that all blocks in your script are false after the conversations have been played. For example, if MyTalk variable was at 17 when the conversation started, it should be at 18 afterwards(should be incremented by 1 during the conversation).

Link to comment

Your script should work for the OR() thingy. As for your loop, there must be a variable that's not "closing" - that is, not updating after the talk. Check that all blocks in your script are false after the conversations have been played. For example, if MyTalk variable was at 17 when the conversation started, it should be at 18 afterwards(should be incremented by 1 during the conversation).

 

I just finished up the lovetalks and now the PID-loop is fine.

 

Now i see what went wrong. I had 4 planned lovetalks scripted in the baf-file, which means that before i finished the 4th lovetalk (which i just did), the global variable only went to 7 after Lovetalk #3...after which when the timer ended, the script forces Liella to engage in a dialogue with the PC using StartDialogueNoSet, for which only the PID would work, causing said loop - an unclosed variable, like you said.

 

Seems i need to be more careful when following these scripts. Thanks for the response and the quick logical insight!

Link to comment

New days, new questions!

 

I've hit a lovetalk where i want a dialogue block to result in the entire lovetalk repeating (I.E, let's talk about it later).

 

My solution for this - at least the one i had in mind, was to simply use DO ~SetGlobal("W5LiLoveTalk","GLOBAL",23)~.My thinking was that since starting the conversation (at W5LiLoveTalk, 24) causes the W5LiLoveTalk-Variable to increment by one (to 25), resetting it to 23 would cause the active timer to run it's course until 0, and then cause the lovetalk at W5LiLoveTalk, 24 to repeat. However, in trying to do this, i kept getting parsing after parsing error until i finally made this placement of the SetGlobal (See spoiler)

 

 

 

IF ~~ W5LiSR12_12.3

SAY ~Repeat this lovetalk later~

IF ~~ DO ~SetGlobal("W5LiLoveTalk","GLOBAL",23)~ EXIT

END

 

 

Will this work like i want it to work without causing some error or unseen complication, or am i missing something?

Link to comment

Archived

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

×
×
  • Create New...