This is a handy performance based script that causes two NPC's to have a nice chat using occasional voiceset sounds. It belongs in the OnHeartbeat event of One NPC. Place another NPC near enough to look like they could be engaged in dialogue, and you are done! You can customize the chat lines to fit your PW or Mod. You can even use it for dungeon ambience; making two creatures speak whatever tongue they know. This works fine alone or equally well if you have the NPC's sit down in the OnSpawn and ConversationEnd events. Hope it helps! (Updated 12-31-05)
Hello folks! I still exist, but have been working so much I don't have too much time anymore.
If you have problems with any of my code, give me a shout! I will be happy to help you.
Expect some new coding toys to arrive soon!
_________________________ Lord X E Ryder, Oracle of KoJ
Kindred Oracles of Justice
The KoJ Realm Persistant World
Posted by nux2000 at 2006-10-11 16:26:20 Voted 10.00 on 10/11/06
Excellent
Posted by Jamine at 2005-05-06 14:31:29 Voted 10.00 on 05/06/05
Great script. I tend to make edited copies of it and give it to different NPC types.
Posted by Gomisan at 2004-09-27 07:01:38 Voted 9.75 on 09/27/04
Posted by Gomisan at 2004-09-27 07:01:00 Voted 9.75 on 09/27/04
Turns out I just wasn't hanging around long enough! Might have been a fluke, but the first line of conversation didn't fire until about a minute after I entered the area.
It does work though! So thanks, great script!
Posted by Gomisan at 2004-09-26 23:11:00 Voted 9.75 on 09/27/04
Thanks, I'll have another look at it. I did change Dialogue, so maybe I made a mistake in my tired state.
Yes, I made a Blueprint of the NPC .. I do that for all my NPCs.
We are trying to get the nearest NPC, which becomes the dialogue partner. So is not a player char, and that is as written.
We bypass the chat sequences on 0 or not value yet set, that is correct, but near the bottom is a iSelfstate++ command to increment that int before we save it, and try again next HB, at which time (on 1) we switch to see if we hit a comment, etc.
Hope that helps :-)
XE-Ryder KoJ
Paladin & Guild Master
Kindred Oracles of Justice
The KoJ Realm Persistant World _________________________ Lord X E Ryder, Oracle of KoJ
Kindred Oracles of Justice
The KoJ Realm Persistant World
Gomisan, Before replying I created a new mod, placed a commoner female and commoner male Then copy and pasted the script from the vault window here into the compiler and saved it as Chatter_hb. I placed this script as a replacement for the commoner females OnHeartbeat handler, and did nothing else.
I ran the mod and they began speaking within 18 seconds or so. Have you edited the dialogue by chance? I am not sure I follow what you said about assigning it to the palette, unless you mean you saved the NPC with that script as a custom creature blueprint. That certainly wouldn't hurt. If the script compiles correctly it should be fine, I would strongly urge not changing any of the delays for math until you see how it works for you.
Some other considerations: If the game calls the same number it returns so they dont sound like broken records, repeating themselves. They are only supposed to talk every other HB. If they are supposed to talk and they hit a dead end switch (which I added to keep them from being too chatty, thus "silence is golden"), they will skip that cycle as well.
Copy paste the script again, make sure nothing fancy is done in some other event handler, and get it running as is. Once it works for you, then go in and make adjustments, perhaps with a backup copy saved, this should prevent any possible headaches.
If for some reason it still does'nt work for you, I will be happy to whip up a one area mod with it running for you to open up in the toolset and game.
XE-Ryder KoJ
Paladin & Guild Master
Kindred Oracles of Justice
The KoJ Realm Persistant World _________________________ Lord X E Ryder, Oracle of KoJ
Kindred Oracles of Justice
The KoJ Realm Persistant World
Posted by Gomisan at 2004-09-26 11:07:00 Voted 9.75 on 09/27/04
I just tried to use your script in my module, but it didnt actually work.
I placed two NPCs close to each other, made them both members of the same faction, gave one the chat script in her heartbeat and left the other without a HB script. Made sure the script was assigned in the pallete so she was guaranteed to spawn with that script assigned. I then jumped in the game, walked into the bar (empty except for a few placeables, a bartender and my two NPCs) But she never started chating.
Any suggestions? The GetNearestObject function.. is that meant to be "CREATURE_TYPE_PLAYER_CHAR" ? I dont get what that constant aactually means.
Also,
int iSelfState = GetLocalInt(oSelf,"CHAT_STATE");
Would return 0, and hence never execute the chat code. Should it be set on the NPC in the toolset to 1?
Posted by Gomisan at 2004-09-26 06:33:00 Voted 9.75 on 09/27/04
There's actually a nifty script already on the vault which has a halfling and a drunken dwarf involved in some rowdy bar chatter. Weaposn get drawn, potions swigged and so forth. Much like what you're planning.
I can't remeber the name sorry. However, your code looks a LOT tidier than the code in that script, and I'd be happy to use any variations you came up with.
Posted by Jamine at 2004-09-25 04:16:00 Voted 10.00 on 05/06/05
So far I a have been editing the conversation to fit the councilors both on break in the city center, and at work in the office for my campaign module, and I am considering doing four or five additional variations and attributing them to different NPC's around my realm. It's some great stuff which can add depth to any world if used with relevance.
I would just like to say thanks a lot for making this public, and I would like to take back what I said about the delays. I now think that they are perfect!
Posted by Jamine at 2004-09-25 04:16:00 Voted 10.00 on 05/06/05
So far I a have been editing the conversation to fit the councilors both on break in the city center, and at work in the office for my campaign module, and I am considering doing four or five additional variations and attributing them to different NPC's around my realm. It's some great stuff which can add depth to any world if used with relevance.
I would just like to say thanks a lot for making this public, and I would like to take back what I said about the delays. I now think that they are perfect!
Posted by Gomisan at 2004-09-25 02:10:00 Voted 9.75 on 09/27/04
This looks great, I look forward to popping a few chatting NPCs into my bars.
Of course, they could just as easily be hanging around teh town square.
Yes the delays were a head-scratcher - Shorter? Longer? I tried to make it a relaxed convo not to speedy!
I am currently working on a workaround for the ActionSit() command, probably by defining a new function I am calling StageSit(). This will address the endless problem that while you are sitting, you are in the middle of an action loop. You cannot assign another action (like drink) until this is completed - or you get up. So once I DO get around this, we can all finally sit down and have a beer! This was a long day!
I will post it the moment it works right. I am adding a nice barmaid script as well.
XE-Ryder KoJ
Paladin & Guild Master
Kindred Oracles of Justice
The KoJ Realm Persistant World _________________________ Lord X E Ryder, Oracle of KoJ
Kindred Oracles of Justice
The KoJ Realm Persistant World
I was just thinking how much better this would be if we had a drink animation. Wait, we do - the drink potion animation. Maybe this would be a good addition to the flow?
Actually, I just saw these in operation last week on the KoJ PW, and it was quite well timed. The pause was long enough that it didn't spam the channel, and short enough to make me wonder if it was an actual PC. A good job all around!
Posted by Jamine at 2004-09-24 06:14:00 Voted 10.00 on 05/06/05
This is absolutely fantastic! The delays seem a tad unrealistic for it to be true natter, but appart from that it's a nice piece of code.
Keep up the good work!
You must be Logged In to post comments in this section.