Jump to content

Rephrasing a WeiDu question


Recommended Posts

Guh, my head hurts. I should be conjugating french verbs in various fun and profitable ways, but I elected to hunt through the mysteries of WeiDu instead. I've only myself to blame.

I attempted to ask this question a little while ago, but I admit that I was woefully unprepared at the time. Having done some research, I can ask...

Is there a tutorial or helpful post somewhere that I can use as a good jumping off point for coding a series of dialogues between a pre-existing Yoshimo and the PC? I've read the tut. for creating a new NPC... I've read the tut. for WeiDu basic by Japheth... and I've read through the WeiDu readme (that's why I have a headache). I understand that I need to use some form of the append (or possibly interject?) and I do understand the basics of how to use WeiDu and what it does and why it does that. Any of the tutorials or suggestions that I have tracked down either deal with a brand new,made up NPC doing something with somebody or the pre-existing NPC's doing something with each other. (must... avoid... joke... in... poor... taste...) I know it sounds like such a dumb question because I'm *sure* that I could see how everything needs to be done if I just looked at it in the right way, but... But. But hey, I've got my very own prefix!

Link to comment

Adding to an existing NPC is not a lot different than creating a brand new one.


There arer a few things to keep in mind, though. I wish I had the time to really answer your question in a way that would make sense. If nobody answers you better before I get the next version of Gavin out, I'll have another go at it then.

  1. You need to weight your states. You are working with an NPC that already has dialogue and possibly player-initiated dialogue added by another mod, so you'll want to manually put a state weight in there so your material shows up. In the following example, the -1 ensures that your dialogue gets seen first.
    IF WEIGHT #-1 ~Global("Talk","GLOBAL",1)~ Talk1
    SAY ~If I were not dancing on the heads of pins, I could have a dialogue with <CHARNAME> now.~

  2. You need to extend Yoshimo's script with your script blocks. You would do that the same way you would extend any other script, by placing the following in the tp2, where MyYoshi.baf is the script you are going to use to extend Yoshimo's. For NPC scripts, you can extend the top or the bottom. For party-joinables, though, their scripts are frequently large, so you might want to extend the top.
    EXTEND_TOP ~yoshimo.bcs~ ~MyMod/BAF/MyYoshi.baf~

  3. After Spellhold, you would have to create your own CRE, so you would be able to treat it just like a brand new NPC.

Link to comment

And the big one, in case you haven't guessed - if you are creating a banter between PC and Yoshimo, you really aren't creating a single action banter-response-banter-response.


What you are doing is giving Yoshimo a line, then giving the player a bunch of choices to respond.



Technically, you acn do it by using the dialogue PLAYER1, but most people want to have control not be scripted into a single banter directly.


So if I wanted to have a banter with Jaheira, for example, I would do this:


CHAIN IF WEIGHT #-1 ~Global("C-JaheriaBanter1","GLOBAL",0) 
!StateCheck(Myself,CD_STATE_NOTVALID)~ THEN ~BJAHEIRA~ CMorganTalksToJaheiraOne
~Move along now, will you. Things stir to the South... and East... oh, never mind.~
++ ~So, oh Druidic one, what is going on? You are acting kind of snappish. I mean more than you are usually.~ DO ~SetGlobal("C-JaheriaBanter1","GLOBAL",1)~ EXTERN ~BJAHEIRA~ CMorganJaheiraSnappy
+ ~Class(Player1,FIGHTER_ALL)~ + ~Awww, you interrupted me, Jaheira - just when I was about to practice my backswing. What is on your mind?~ EXTERN ~BJAHEIRA~ CMorganJaheiraFighter
+ ~OR(2) CheckStatGT(Player1,12,INT) CheckStatGT(Player1,12,WIS~+ ~Jaheira, you seem to be bothered by something. I suspect it is something more than just the challenges we are facing. What is on your mind?~ EXTERN ~BJAHEIRA~ CMorganJaheiraWiseorIntelligent
+ ~Gender(Player1,MALE) OR(2) CheckStatLT(Player1,10,INT) CheckStatGT(Player1,10,WIS~ + ~Yo, Jaheira, you look hawt. Wanna forget your troubles and go snogging?~ EXTERN ~BJAHEIRA~ CMorganJaheiraYourAnIdiotMale
+ ~Gender(Player1,FEMALE) OR(2) CheckStatLT(Player1,10,INT) CheckStatGT(Player1,10,WIS) InParty("edwin") InMyArea("edwin") !StateCheck("edwin",CD_STATE_NOTVALID)~  + ~Hey, Jaheira, stop with the crazy talk and let's go see if we can dump water on Edwin - that will cheer you up! ~ EXTERN ~BJAHEIRA~ CMorganJaheiraYourAnIdiotFemale


So you can see, talking about a banter between Player1 and Yoshimo is just like coding a quest or a NPC to NPC banter in terms of code, but in terms of actually accomplishing it the task is harder. Between 2 NPCs, you control what they say directly. When you put the palyer in the center of the action, running a real dialogue, it means lots and lots of possible banters out of just one starting point (unless you read jcompton's tutorial on techniques where you appear to have different options, but they all lead to the same response; something to be pretty sparingly used).

Link to comment

Thanks berelinde and cmorgan!

I just had to go and choose the mod style that's like coding a quest but harder.

I could kind of tell that coding this out would be pretty weighty, since writing it in a way that makes sense has already become pretty hairy...


Yoshimo:  It just seems like such a waste.

1)  I beg your pardon? [GOTO Block 1]
2)  Your incessant blabbing?  Yeah, it really is a waste of fresh air. [GOTO Block 2]
3)  I really haven’t the time for this.  [GOTO Block 1]
4)  That’s an awfully random thing to say.  Were we having a conversation I wasn’t aware of? [GOTO Block 1]

Block 1
Yoshimo:  I was merely thinking about the life we lead.  It is the life of adventure, of risk and excitement;  Who knows what gambles we may take, which barters may lead to untold riches and which may lead to our ultimate demise.  I prefer the untold riches, but still.   
Yoshimo:  And yes, I know how important your quest is, I know how many people rely on you and your grand band of merry wanderers.  Not so merry perhaps, given the current events.  It just seems so pointless that you should explore the lands of adventure and wealth and lovely ladies with bells on and not seem to enjoy it one bit.  
1)  Imoen means a lot to me, and rescuing her is the most important task that I can possibly conceive of, right now.  Anything else is simply peripheral to ensuring her safety, and if I am forced to wander the face of Faerun searching for the means of her escape, then I shall.  If you’re insinuatingâ€â€and I think you areâ€â€that I should be more concerned with hedonistic delights, then you’re clearly talking to the wrong person. [GOTO Block 3]
2)  I am intent on finding Irenicus.  Money is simply the means to that end.  Once I possess the power that he has hinted at, then I am certain that I will be able to acquire all the gold and jewels that I could possibly desire.  That is where true happiness resides, not in crawling around some dank, kobold-infested dungeon in the hopes of scraping together enough gold to waste on a disease-ridden whore. [GOTO Block 3]
3)  I would never let a friend of mine waste away in a Cowled Wizard prison simply because of the impressive ale selection at the local tavern.  But… well, I did get into adventuring for the excitement, and we’re going to have to do quite a bit of swashbuckling in order to collect enough gold anyway.  Imoen would never forgive me if I didn’t enjoy myself at least a little.  [GOTO Block 3]
4)  I’m spilling the fresh, warm blood of weaklings by the gallon, and you’re questioning whether I’m enjoying myself?!  If I were experiencing any more pleasure I’d start gaily singing the juicier bits of a small, personal composition I like to call “Die In a Crippling Fire, You Waste of Meat.† [GOTO Block 2] 
5)  I *really* haven’t the time for this. [GOTO Block 2]
6)  …Bells on?  [GOTO Block 4]


From looking at how WeiDU is generally set up, I thought this would be the best way to keep my mind in the right frame--set-up wise. I hope.

Anyway, I've got a bunch of examples and tutorials and the advice you guys gave printed out, so I'm going to play with turning that into a proper example of code and then post it here to be picked apart. :)

Is there any section of the WeiDU readme that I should take a closer look at? (bad preposition! Bad!)

Link to comment

Unless you've got a background in computer sciences, it's going to be months before *any* part of the WeiDU readme makes any sense.


You can look at that, if you like, but you might find these tutorials more useful:











Or, another thing you might like to do is download a couple NPC mods and look at the code. I learned to code almost exclusively from studying the BG1 NPC Project.


That might actually work out well for you, since it faced the same challenges you do: adding dialogue to an existing NPC.


But if you're going to go that route, make sure you get the new version!

Link to comment

First learn stand, then learn fly.


Before trying to build a branching PC interactive dialogue, which carries with it both the coding challenges and the "did I actually remember to deal with all of the branches?" logistical challenge, implement a simple banter. Let the banter pack code and the CHAIN tutorial be your guide there. Write a four-line exchange between Jaheira and Minsc (or whoever), compile it in, see it in-game, and jump up and down clapping with glee.


Doing that will help you get comfortable with some of the concepts you will need to do the interactive conversation properly.

Link to comment

I really wanted to wait until I had something a little more concrete before I replied, but I really needed to focus on school this past week, so I haven't been able to look at anything to do with code. I did want to say thank you immensely, and you're absolutely right jcompton--I need to worry about handling the basics before I worry about tackling any of this stuff. 'Running before walking' is a very bad habit of mine.

Link to comment


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

  • Create New...