Jump to content

I'm just a sad starter


Bardess

Recommended Posts

I thought it might be helpful to give you an example of a script that would work in BG2. This one is for Tutu, but it would work just as well in BG2.

 

You might also want to note that I need to use the tildes around my dialogue file names because my prefix has a ! in it. Not the best idea, that.

 

IF
 InParty(Myself)
 Global("B!GavinFriendtalk","GLOBAL",0)
 Global("B!GavinFriendOnly","GLOBAL",1) /* I'm setting this after the romance check because I don't want the PC to have to endure 30 LTs and 15 friendship talks, too */
 GlobalGT("B!GavinFriend","GLOBAL",0) /* Gavin's friendship has more than one stage */
 !Global("B!GavinFriend","GLOBAL",3) /* stage 3 is for a broken friendship */
THEN
 RESPONSE #100
SetGlobal("B!GavinFriendtalk","GLOBAL",1)
RealSetGlobalTimer("B!GavinFriendTimer","GLOBAL",600) //10 min after joining
END

/* Friendtalk timer */

IF
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
RealGlobalTimerExpired("B!GavinFriendTimer","GLOBAL")
 Global("B!GavinFriendOnly","GLOBAL",1)
!Global("B!GavinQuietFriend","GLOBAL",1) /* friendship can be put on hold via PID */
Global("B!GavinFriendMatch","GLOBAL",1) /* there is a friendship */
GlobalGT("B!GavinFriend","GLOBAL",0)
!Global("B!GavinFriend","GLOBAL",3)
!AreaType(DUNGEON)   /* friendship talks don't happen in dungeons */
OR(6)
Global("B!GavinFriendtalk","GLOBAL",1) /* there's more than one friendtalk */
Global("B!GavinFriendtalk","GLOBAL",3)
Global("B!GavinFriendtalk","GLOBAL",5)
Global("B!GavinFriendtalk","GLOBAL",7)
Global("B!GavinFriendtalk","GLOBAL",9)
Global("B!GavinFriendtalk","GLOBAL",11)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("BGAV_S1")
RealSetGlobalTimer("B!GavinFriendTimer","GLOBAL",5400) /* resets the timer for the next one */
IncrementGlobal("B!GavinFriendtalk","GLOBAL",1) /* advances the global by one */
StartDialogNoSet(Player1) /* I've got the friendtalks in the J for the reasons I gave above */
END

 

Then, I close the global in the friendtalk. Here's the first line from one of them so you get the idea.

 

CHAIN
IF WEIGHT #-2
~Global("B!GavinFriendtalk","GLOBAL",10)~ THEN ~B!GAVINJ~ BGavinFriendtalk5
~<CHARNAME>, will you look at this! I could have sworn I packed these herbs correctly.~
DO ~SetGlobal("B!GavinFriendtalk","GLOBAL",11)~
END
++ ~They don't look too good, do they? I would have thought a cleric might be more adept with herbs.~ EXTERN ~B!GAVINJ~ BGavinFriendtalk5.1
++ ~Is it supposed to be that... color?~ EXTERN ~B!GAVINJ~ BGavinFriendtalk5.1a
++ ~On the bright side, I think you now have a fine fungus collection.~ EXTERN ~B!GAVINJ~ BGavinFriendtalk5.3
++ ~Can't you do anything right?~ EXTERN ~B!GAVINJ~ BGavinFriendtalk5.4

Link to comment

Thank you, I made some changes to my friendtalks and it seems they now work. I intend a friendship with Fiars to be possible only if the PC doesn't match his romance prequisites - he would not befriend a woman he finds attractive. And... umm... he'll neither romance nor befriend a Lawful Good PC. Should I add a couple of dialogs for them, too? (Considering the circumstances in which you meet him, it's not very likely that a LG PC would take him in at all.)

 

By the way, what is WEIGHT #-2 or -1 used for?

Link to comment

They're used with J-file conditional talks to make sure that the state has a lower weight, and therefore higher priority, than other states in the J-file, like PID.

 

Any conditional state, which is to say one that has IF ~ConditionOfSomeKind~ THEN in it, can function as player-initiated dialogue if the conditions are true, which is why it is important to close your variables. Unconditional states, those that are just IF ~~ THEN, never show up unless they are called by another state.

 

This is probably really confusing. Here's an example that will hopefully make it clearer.

 

I have StateA, StateB, StateB.1, and StatePID

 

IF ~Global("Talk1","GLOBAL",1)~ THEN BEGIN StateA

SAY ~How are you?~

++ ~Fine.~ EXIT

++ ~Go away.~ EXIT

END

 

 

IF ~IsGabber(Player1)~ THEN BEGIN StatePID

SAY ~You're mean to me. I'm not talking to you.~

IF ~~ THEN EXIT

END

 

IF ~Global("Talk2","GLOBAL",1)~ THEN BEGIN StateB

SAY ~I know you're grumpy, but is there anything I can do to help?~

++ ~You could shut up.~ EXIT

++ ~You could tell me why I have so much trouble supressing the desire to strangle you.~ + StateB.1

END

 

IF ~~ THEN BEGIN StateB.1

SAY ~Whatever.~

IF ~~ THEN EXIT

END

 

In our little dialogue, you will presumably call StateA using a script, but since I have forgotten to close the variable, this talk will loop indefinitely, every single time a dialogue is called. So later on, when I make a call using Global("Talk2","GLOBAL",1), I'll still get StateA, because I forgot to close the global.

 

I could fix this by closing the global:

IF ~Global("Talk1","GLOBAL",1)~ THEN BEGIN StateA

SAY ~How are you?~

++ ~Fine.~ DO ~SetGlobal("Talk1","GLOBAL",2)~ EXIT

++ ~Go away.~ DO ~SetGlobal("Talk1","GLOBAL",2)~ EXIT

END

 

But even then, I'd never see StateB, because I've got a conditional state ahead of it that will return true as long as the NPC is talking to player 1, which he usually will be.

 

Suppose I had given StateB a different weight, like WEIGHT #-1. That would put it ahead of StateA, and I'd get it even if I did forget to close the global. But since I've forgotten to close that variable, too, that talk would loop. So, I'd want to fix that before moving on.

 

IF ~Global("Talk2","GLOBAL",1)~ THEN BEGIN StateB

SAY ~I know you're grumpy, but is there anything I can do to help?~

++ ~You could shut up.~ DO ~SetGlobal("Talk2","GLOBAL",2)~ EXIT

++ ~You could tell me why I have so much trouble supressing the desire to strangle you.~ DO ~SetGlobal("Talk2","GLOBAL",2)~ + StateB.1

END

 

 

Any clearer?

Link to comment

I've had a hard time trying to make a spell do what I want it to, and now that I made it, I can't make it work. In the script, it says SPELLNAME not found in SPELL.IDS . How do I put it there? Is there a way to extend spell.ids (if that is its name)?

Link to comment

Yes, there is. You will need to append spell.ids. Some of Gavin's material draws on SCS material (used with permission), which appends spell.ids. If you look through the tp2, or perhaps the IDS folder, you will find a lot of lines that append the table. If it's in the IDS folder, which I think it is, it will use a tph extension. TPH uses the same syntax as a tp2.

Link to comment

I have been noticing that you guys have been very good about helping out the other modder and I was wondering if I could ask you guys a question.

In my initial script that I am creating for my NPC, I would like for it to be possible for my NPC to attack the PC. Can you please tell me how this would be coded?

 

Thank you

Keldon :)

Link to comment

It's certainly possible, but it all depends on what you want to happen. Do you want your npc to go hostile? He'll kind of have to.

 

Is he going to go from being hostile to becoming joinable? If so, that's going to take a few more steps, scripting-wise, but it's still possible.

 

Anyway, maybe you wouldn't mind starting your own thread so we don't clog up Bardess's, if she wants to use it again for some reason.

 

Map out how you want the conversation (and the combat) to go, and maybe we'll have some suggestions for you.

Link to comment

Archived

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

×
×
  • Create New...