Jump to content

A couple of questions about coding and such


muffin-tacos

Recommended Posts

I'm working on a little mod for myself and in her first meeting with Charname, Minsc and Jaheira interrupt the conversation. Since I'm a bit new to coding I'd like to ask you if this code that I put together would work in the game:

 

IF ~~ THEN BEGIN D1IT.07
SAY @18 /* @18 = ~Of course you do. A bunch of blind monkeys like you would most likely be squashed in an instant out on the battlefield without an assassin to back you up.~ */ 
IF ~InParty("Minsc")
See("Minsc")
!StateCheck("Minsc",STATE_SLEEPING)
!StateCheck("Minsc",STATE_HELPLESS)
!StateCheck("Minsc",STATE_STUNNED)
!StateCheck("Minsc",STATE_SILENCED)~ 
CombatCounter(0)
== BMINSC @19 /* @19 = ~Now hold on, lady in the hood! Minsc will not be squashed!! He is too big to fit under a shoe...~ /*
IF ~InParty("Jaheira")
See("Jaheira")
!StateCheck("Jaheira",STATE_SLEEPING)
!StateCheck("Jaheira",STATE_HELPLESS)
!StateCheck("Jaheira",STATE_STUNNED)
!StateCheck("Jaheira",STATE_SILENCED)~ 
CombatCounter(0)
== BJAHEIR @20 /* @20 = ~I do not like the way this young lady speaks to you, <CHARNAME>. Bring her along if you wish, though I will be keeping a careful eye on her.~ /*


IF ~~ THEN REPLY @21 /* @21 = ~I think you should know, Assassin, that I am on a quest to rescue a childhood friend of mine, Imoen, from the Cowled Wizards. It could be dangerous.~ */ GOTO D1IT.08
IF ~~ THEN REPLY @22 /* @22 = ~My final goal, Assassin, is to hunt down and kill a powerful mage called Irenicus. Danger will most likely be involved.~ GOTO D1IT.09
IF ~~ THEN REPLY @23 /* @23 = ~Actually I have changed my mind. We won't be needing you after all.~ */ EXIT
END

 

What do you think? :crazyeyes:

 

Thanks in advance!

Link to comment

You'd want this to be a CHAIN.

 

CHAIN

IF ~~ THEN MyNPC D1IT.07

~Of course you do. A bunch of blind monkeys like you would most likely be squashed in an instant out on the battlefield without an assassin to back you up.~

== BMINSC IF ~InParty("Minsc") InMyArea("Minsc") !StateCheck("Minsc",CD_STATE_NOTVALID)~ THEN ~Now hold on, lady in the hood! Minsc will not be squashed!! He is too big to fit under a shoe...~

== BJAHEIR IF ~InParty("Jaheira") InMyArea("Jaheira") !StateCheck("Jaheira",CD_STATE_NOTVALID)~ THEN ~I do not like the way this young lady speaks to you, <CHARNAME>. Bring her along if you wish, though I will be keeping a careful eye on her.~

END

IF ~~ THEN REPLY ~I think you should know, Assassin, that I am on a quest to rescue a childhood friend of mine, Imoen, from the Cowled Wizards. It could be dangerous.~ GOTO D1IT.08

IF ~~ THEN REPLY ~My final goal, Assassin, is to hunt down and kill a powerful mage called Irenicus. Danger will most likely be involved.~ GOTO D1IT.09

IF ~~ THEN REPLY ~Actually I have changed my mind. We won't be needing you after all.~ EXIT

 

You'll have to add the code for CamDawg's custom CD_STATE_NOTVALID, but it's easy enough. Just add this to the tp2.

 

APPEND ~STATE.IDS~

~0x80101FEF CD_STATE_NOTVALID~

UNLESS ~CD_STATE_NOTVALID~

Link to comment

Whose are you talking about? Mine or hers?

 

If it's hers, yes, the comments will not compile because the syntax isn't quite right.

 

Right: /* comment */

Right: // comment

Wrong: /* comment /*

 

I know that the game uses the @# /* dialogue */ format, but you shouldn't, for uncompiled dialogue.

Link to comment

Oh thanks for the heads up! I honestly didn't notice the /* thing being all screwed, so thanks for that. It saved me a lot of trouble.

 

I've seen the CHAIN thing going on here and there in other mods and such, but I really have no idea what that does and when you're supposed to use it.

 

What does CD_STATE_NOTVALID do? (Sorry, I'm a noob! :crazyeyes:)

Link to comment

CD_STATE_NOTVALID is a catch-all state for conditions under which the NPC shouldn't talk. It includes death, sleep, silence, stunning, and a host of other weird conditions, like stone death, acid death, etc.

 

I live by the principle that less typing = less typos. If I can type one line to cover all those conditions, it's a win.

 

For a discussion on CHAIN, I would advise reading Blue's "The Road to Banter". There's also a tutorial by Zyraen in the old CoM archive. Anybody got a link?

Link to comment

You can use CHAIN in dialogue with the PC as well. I'll see what I can dredge up on its use later. You have to understand that the WeiDU readme covers each item in as brief a summary as possible. It would be impossible to list all applications, and give examples of each, within the scope of the docs.

Link to comment

Depends. I use it all the time, especially for scripted dialogue. That way I only have to type DO ~SetGlobal(etc once, not copy paste for each transition. More copying/pasting = more chance of error.

 

CHAIN

IF ~Global("PrLT","GLOBAL",18)~ THEN MyNPCJ STATE

~Your hair is lovely.~

DO ~SetGlobal("PrLT","GLOBAL",19)~

END

++ ~Why thank you!~ EXTERN MyNPCJ state1

++ ~You're just saying that.~ EXTERN MyNPCJ state2

 

Works every time.

Link to comment

Oh, thank you so much, everyone. Your help is greatly appreciated! The links are really helpful too.

 

Looks like it's time to do quite a bit of editing for me. But that's fine.

 

Thank you all, again. I bet I'll be back with some more questions later though. :crazyeyes:

Link to comment

Oh yes, I'm back (already)!

 

When using a prefix in all the codings, can you use two letters or must it always have to be just one letter? For example, can mt#XXXX be used?

 

Can x# be used as a prefix too, or will that just muck things up?

Link to comment

Did you actually register a prefix? If so, that's what you use. If yours is MT, you can use MT#, or MT_, or MTQ, for that matter, but your prefix is MT.

 

You should never intentionally use another registered prefix unless you are writing crossmod. X# is registered to the BG1 NPC Project. If you're writing crossmod, and you want to check a variable, say, sure, you've got to use the prefix. But for your own stuff, never.

 

There are times when I am forced to use just one letter. My prefix is B!. It's fine in globals, filenames, etc, but when it's used in a state label, it just won't parse. So all of my interjection state labels, which get stored as globals, use the format BNPCstatelabel. So if Gavin interjects into Mae Var's dialogue, it will be BGavMaeVar.

Link to comment

Archived

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

×
×
  • Create New...