Jump to content

Newbie Modding Questions


Twani

Recommended Posts

IF ~AreaType(FOREST) Global("W5LiLoveTalk","GLOBAL",2)~ W5LiSR0_Intro
Take the first lovetalk out of the main OR() block and file it under its own specific trigger block that includes an area check or whatever else specific condition you might need.

 

See(Player1) //
RealGlobalTimerExpired("W5LiRomanceTimer","GLOBAL")
Global("W5LiRomanceActive","GLOBAL",1)
CombatCounter(0)
!See([ENEMY])

Replace See() checks with Detect(). You probably don't want the trigger to return false if PC carries Staff of Magi, nor do you want it true if there's a hidden assassin homing in for a backstab.

 

MoveToObject(Player1)

StartDialogueNoSet(Player1)

Dialog() does the same in a single action. That said, I advise to NOT move towards the player, it tends to be irritating rather than immersive.
Link to comment
IF ~AreaType(FOREST) Global("W5LiLoveTalk","GLOBAL",2)~ W5LiSR0_Intro
Take the first lovetalk out of the main OR() block and file it under its own specific trigger block that includes an area check or whatever else specific condition you might need.

 

See(Player1) //
RealGlobalTimerExpired("W5LiRomanceTimer","GLOBAL")
Global("W5LiRomanceActive","GLOBAL",1)
CombatCounter(0)
!See([ENEMY])

Replace See() checks with Detect(). You probably don't want the trigger to return false if PC carries Staff of Magi, nor do you want it true if there's a hidden assassin homing in for a backstab.

 

MoveToObject(Player1)

StartDialogueNoSet(Player1)

Dialog() does the same in a single action. That said, I advise to NOT move towards the player, it tends to be irritating rather than immersive.

 

Done on all of those - thanks for the tip! Did not know about See vs Detect.

Link to comment
MoveToObject(Player1)

StartDialogueNoSet(Player1)

Dialog() does the same in a single action. That said, I advise to NOT move towards the player, it tends to be irritating rather than immersive.

I'd stick with StartDialogueNoSet(Player1) and not use Dialog(). The reason is: I had the case that the time the NPC needed to walk up to the PC was enough for the script to already increment the LT variable (that was for a coding that increments the variable via script, of course), and on another occasion the player clicked a command in the short time the NPC needed to walk to the PC, and the dialogue was lost (this was without using Kulyok's "How to ensure your banters always run", of course). So, my paranoia might be of no importance / outdated, but I've sworn to myself never to use Dialog() again.
Link to comment

Some great strides today - coded a large number of dream-scripts and morning-after-sleep-conversations that all work out pretty perfectly. Now for the next snag.

 

How do i accurately code dreamscripts/rest-conversations that become active when the player sleeps at an inn? I thought i would simply add an areacheck to the dreamscript and add every single Inn-area in game as well as adding the MoveToObject(Player1) as i've seen in other mods. - this doesn't seem to do the trick 100% of the time. I've managed to get the talk to fire three times, all times i had to click the sleep button in the inn more than once before the window would "exit" and Liella would start the conversation.

 

Any way to make this more accurate, or is this a bug?

 

 

 

 

IF

InParty(Myself)

See(Player1)

!StateCheck("Myself",CD_STATE_NOTVALID)

!StateCheck(Player1,CD_STATE_NOTVALID)

CombatCounter(0)

!See([ENEMY])

OR(11)

AreaCheck("AR0021") //City Gates - Crooked Crane 1st floor

AreaCheck("AR0313") //Docks - Sea's Bounty 1st floor

AreaCheck("AR0406") //Slums - Copper Coronet

AreaCheck("AR0509") //Bridge - Five Flagons 1st floor

AreaCheck("AR0513") //Bridge - Calbor's Inn 1st floor

AreaCheck("AR0522") //Bridge - Five Flagons 1st floor (stronghold)

AreaCheck("AR0704") //Waukeen's Promenade - Mithrest Inn

AreaCheck("AR0709") //Waukeen's Promenade - Den of the Seven Vales

AreaCheck("AR1105") //Umar Hills - Imnesvale Inn

AreaCheck("AR1602") //Brynnlaw - Brynnlaw Inn

AreaCheck("AR2010") //Trademeet - Vytori's Pub

Global("W5LiLoveTalk","GLOBAL",17)

THEN

RESPONSE #100

IncrementGlobal("W5LiLoveTalk","GLOBAL",1)

MoveToObject(Player1)

StartDialogueNoSet(Player1)

END

 

 

 

Attached my current dreamscript code in the spoiler

Link to comment

What happened the other two times? Nothing, or did the resting start without the dialogue?

 

I think I would delete the "MoveToObject(Player1)" and try whether the dialogue fires reliably then. But that could just be my paranoia...

Link to comment

What happened the other two times? Nothing, or did the resting start without the dialogue?

 

I think I would delete the "MoveToObject(Player1)" and try whether the dialogue fires reliably then. But that could just be my paranoia...

 

Resting, no dialogue. Removing the MoveToObject seems to cause no difference. Had to speak to the inkeep 3 times and rest 2 times each before it would fire - the other two times it simply rested once then gave me "You may not rest at this time". When it does work, it works flawlessly, including advancing the lovetalk itself so perhaps this is a BG2EE bug?

 

Edit: Adding a few questions!

 

So - i've now finished all the necessary dreamscripts and wake-up scripts for SoA. When doing the last dreamscript that lead to a wakeup script, i noticed that instead of needing a wakeup-script, i can simply remove the timer reset from the previous, nightly lovetalk and allow the following lovetalk to trigger automatically - as it of course will upon wakeup, since there's no timer.

 

My question is if this is accepted practice? It seems as though doing it would leave things "open" somehow.

 

Anyway - all of my dreamscripts and wakeuptalks work perfectly - apart from the ones that require an inn, which all display the same aforementioned sort of error. Again, i do *all* of my debugging and troubleshooting in Bg2EE, not BG2/BG2TOB.

 

 

Edit2 - Bug report: I feel comfortable saying that this is an error in BG2EE. I just re-coded Liella slightly to work in BG2 Classic and tried it out - Inn-talks work perfectly.

 

The difference being:/Bg2/TOB has the "Are you sure you wish to rest"-window. Upon pressing confirmation, the rest-window exits and the lovetalk is performed.

 

In BG2EE, Inntalks are not preceded by that window. You simply rest.

 

I hypothesize, albeit with zero programming and coding experience, that this causes the error.

Link to comment

Onward and forward!

 

It's quite amazing how far i've gotten in the space of less than two weeks and how much i've learned, thanks to the excellent resources and the assistance and swift response of people here. Dreamscripts, wake-up-talks, reminders, unique conversations unlockable by certain answers, encounters that involve interaction with enemies...well, my mod is moving forward quite rapidly!

 

Now, as to today's little snag. I've been sitting and troubleshooting this for quite a bit now. Hopefully you guys can help.

 

I'm creating the second encounter for the SoA part. This encounter involves:

 

* Once lovetalks reach 24 and <CHARNAME> enters the Slums, a number of thugs/enemies will spawn and engage the player when the player moves to them.

* After battle, Liella's lovetalk will involve one of the survivors of the battle.

 

The way that i've programmed it now - using babysteps to get where i want it to be - is that upon reaching the slums and lovetalk is 24, increment W5LiSecondEncounter to 1.

 

* Upon W5LiSecondEncounter reaching 1, spawn x enemies and increment W5LiSecondEncounter to 2.

* When the specific enemy is dead, increment W5LiSecondEncounter to 3.

* When W5LiSecondEncounter is 3, engage in lovetalk.

 

My previous encounter worked out without a hitch because there was no need to involve the Dead-variable/check in the script. The enemies spawn upon entering the docks at lovetalk x, conversation is performed, combat is done, and lovetalk follows after combat. This is my first time dealing with the dead-check, and i think it is the problem in this case. I've tried creating a seperate CRE unique to the script/encounter (W5LiSm5), manipulating the variables, adding checks but nothing seems to do the trick.

 

encounter-script follows in spoiler. I'm sure that to experienced coders it looks like a salady mess :p. Any suggestions would be welcome, and thoughts on how to make it work even more so!

 

 

 

 

// Second Encounter

IF

InParty(Myself)

See(Player1)

!StateCheck(Myself,CD_STATE_NOTVALID)

!StateCheck(Player1,CD_STATE_NOTVALID)

CombatCounter(0)

!See([ENEMY])

AreaCheck("AR0400")

Global("W5LiSecondEncounter","GLOBAL",0)

Global("W5LiRomanceActive","GLOBAL",1)

Global("W5LiLoveTalk","GLOBAL",24)

RealGlobalTimerExpired("W5LiRomanceTimer","GLOBAL")

THEN

RESPONSE #100

SetGlobal("W5LiSecondEncounter","GLOBAL",1)

END

 

IF

AreaCheck("AR0400")

Global("W5LiSecondEncounter","GLOBAL",1)

THEN

RESPONSE #100

IncrementGlobal("W5LiSecondEncounter","GLOBAL",1)

CreateCreature("W5LiSm5",[3120.2131],1)

END

 

IF

AreaCheck("AR0400")

Global("W5LiSecondEncounter","GLOBAL",2)

CombatCounter(0)

!See([ENEMY])

Dead("W5LiSm5")

THEN

RESPONSE #100

IncrementGlobal("W5LiSecondEncounter","GLOBAL",1)

END

 

IF

AreaCheck("AR0400")

Global("W5LiSecondEncounter","GLOBAL",3)

CombatCounter(0)

!See([ENEMY])

THEN

RESPONSE #100

IncrementGlobal("W5LiSecondEncounter","GLOBAL",1)

StartDialogueNoSet(Player1)

END

 

 

 

 

 

Edit: Sorry, due clarification. I'm not looking to involve a "survivor" at the moment. I'm looking to make it work so that the conversation starts when combat ends and the enemy is dead.

Link to comment

I'm a bit wary of Global("W5LiLoveTalk","GLOBAL",24) condition.

 

Historically all romance scripts are coded so the variable always rests at odd values: it's 23 before the lovetalk, 24 immediately during the lovetalk, and sets to 25 right after the lovetalk(during the lovetalk in the dialogue file). It shouldn't be at 24, unless you're doing something very-very differently - any other romance would be checking for 23 or 25.

 

Other than that, I scanned the script, and seems to be okay.

Link to comment

I'm a bit wary of Global("W5LiLoveTalk","GLOBAL",24) condition.

 

Historically all romance scripts are coded so the variable always rests at odd values: it's 23 before the lovetalk, 24 immediately during the lovetalk, and sets to 25 right after the lovetalk(during the lovetalk in the dialogue file). It shouldn't be at 24, unless you're doing something very-very differently - any other romance would be checking for 23 or 25.

 

Other than that, I scanned the script, and seems to be okay.

 

I changed the script so it checks at 23 and increments it to 24 instead, removed the variables from the "standard" lovetalk rotation so as to not cause conflicts or loops. This didn't help, unfortunately. What seemed to do the trick was adding a "Wait(1) between:

 

IF

AreaCheck("AR0400")

Global("W5LiSecondEncounter","GLOBAL",3)

THEN

RESPONSE #100

StartDialogueNoSet(Player1)

Wait(1)

IncrementGlobal("W5LiSecondEncounter","GLOBAL",1)

END

 

 

Does that make any sense? Could it really be as fickle as that and update the encounter-variable too fast for the talk to fire in time?

 

In any case - solved for now - and seems to be no loops. Thanks for your help, Kulyok :).

Link to comment
* After battle, Liella's lovetalk will involve one of the survivors of the battle.
Professional advice - never assume for granted that any non-immortal character will survive player's control of the game environment after it has been spawned. Instead, always assume that players will do anything in their power to break your plot at the slightest opportunity.

Don't abuse immortality too much either.

 

IncrementGlobal("W5LiSecondEncounter","GLOBAL",1)

StartDialogueNoSet(Player1)

What's the variable's value in your dialog trigger? 3 or 4?

If it's 3, then you break it by increasing the var to 4 before the dialog starts.

 

StartDialogueNoSet(Player1)

Wait(1)

IncrementGlobal("W5LiSecondEncounter","GLOBAL",1)

Don't add anything after the Dialog()-like action. In-dialog actions may interrupt it. I assume you want to advance the var to close the event - do it in dialog, not in creature script.
Link to comment

1. Good point - i already planned to solve that by spawning the "survivor" as a neutral npc once the battle was done and having Liella walk up to him. As of right now, this works rather well, though i'd like to find ways to speed the process up a little.

 

2&3. Yep, seemed that way - fixed it now! Variable, dialogue and everything else triggers as it should. Added variable to the dialogue instead :).

 

The encounter works pretty well now! All i need to improve is perhaps find ways to speed up the spawning process and interaction a bit, if that's possible.

 

Thanks for your help :).

 

.

Link to comment

Arggh, everything is so complicated. Glad you're having better luck then I am, LiellaMod.

 

 

So I know you shouldn't set conditions or anything in the dialog file, that should all be done in the script file with the dialog file just having the variables. What about in banter dialogs? Is it safe to have an (AreaType) condition in their? A 'only go off when the Romance goes to step 2'? How about something more specific, like only triggers in one of Baldur's Gate's pubs at nighttime? Is that alright, or will it cause stutter?

Link to comment

I've seen several PIDs with area checks or checks for globals or things about the player and such. Like:

 

SAY ~What did you want to ask me, <CHARNAME>?~

+ ~AreaCheck("%BaldursGateDocks_JopalinsTavern%")~ + ~Would you like a drink?~ + offerdrink

+ ~AreaCheck("%Beregost_FeldepostsInn_L1%")~ + ~Would you like a drink?~ + offerdrink

etc. etc.

+ ~Global("##MyLifeStory","GLOBAL",0)~ + ~So tell me about yourself.~ + lifestory1

+ ~Global("##MyLifeStory","GLOBAL",1)~ + ~I wanted to hear more about that freak giraffe accident you mentioned.~ + lifestory2

etc. etc.

+ ~Global("Chapter","GLOBAL",3)~ + ~Gosh, that Chapter 3-related-event sure was something!~ + chaptertalk3

++ ~How do you like them apples?~ + apples

END

 

The very important thing is to make sure that there is always a conversational option open if none of your conditional branches are valid.

 

One of the more experienced modders will have to tell you about using conditions in banters.

Link to comment

I think PIDs with area/other narrow checks are a very bad idea(for me as a player), because if it's not available all the time, I won't see it.

 

As for banter dialogues - you mean Interact() between two party members, right? Sure, any conditions would do, but again, setting them in the dialogue file is a bad idea, because the player may never see them. If you want Keldorn and Anomen to talk in the Underwater City if PC-Jaheira romance is at 2, you'd better do it via script, which sets a certain variable to 1, and your banter would only run if that variable is 1(and thus be excluded from regular banter rotation).

Link to comment

Archived

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

×
×
  • Create New...