Neverwinter Nights > Script Request

Two simple scripts, fuckload of problems.

(1/2) > >>

Soul Sojourner:
Why, by all that is so fucking bloody unholy... are these two... simple... little... miniature... tiny... scripts... GIVING ME A FUCKING HEADACHE!?

Seriously... I know there's some simple shit I've been missing this entire time that for some blasted reason I can't seem to grasp that will solve my problems with these two scripts... but for every thing I try I've so far fucked up pretty bad. lol.

Okay, what I wanted to do was make two separate things happen. Really simple things, actually (or so I thought... lol).

The first thing. I have a gate at the entrance to an area, there is nowhere to go but through this gate but the gate is locked and needs a key. I have a guard at the gate which I want to distribute a key to every player who asks for it. In the conversation, I have the player ask the guard if they may enter... this is where I want the script to come into play. What I want, is for the guard to tell the player they already have a key and not give them another one IF (fucking if) they already have one. So I want the script to detect if the player has the key, IF they have the key, I want the guard to tell them they already have one and not to give them another one. IF they don't have one, I want the guard to tell them something else (basically the guard saying something like "Sure here's the key."), and give them the key. My problem is, is that I can't figure out how to get one line or the other of text to appear in the conversation depending on whether or not they have the key. I tried using "Text appears when" and If then statements... but I keep fucking up somewhere.

Now, the other script... which is more of a bitch... I have an area where 'servants' are walking through the halls and doing their own thing (using the follow waypoint on the default heartbeat script), and what I want is for those servants to say something in text while they are walking (as talking above their head), but also saying something using an actual sound file at the same time. What they say in the sound file matches perfectly to what they will say in text. My problem is... I can't get the sound thing to work at all! I've gotten them walking around and talking in text... I've tried using the delay command and loops on their heartbeat and spawn scripts... but nothing's worked so far. At first I tried using the PlaySound function... What I want is for them to continually say stuff in text and aloud forever, but only like every 30 seconds or so. Problem is... the PlaySound function only seems to work when a characters action queue is clear... and since I have them constantly walking from waypoint to waypoint... their action queue is never clear... also PlaySound isn't even an action! It plays instantly! For some reason though it doesn't work unless the queue is clear so... I tried using SoundObjectPlay... but... that means I have to use a sound object... I tried things with that but it also ended in failure.

I've probably made a hundred scripts for both situations to no avail. Seems like a simple thing to do yet it is eluding me so... Blindly frustrating it is.

420:

--- Quote from: Soul Sojourner on January 10, 2009, 07:36:33 PM ---The first thing. I have a gate at the entrance to an area, there is nowhere to go but through this gate but the gate is locked and needs a key. I have a guard at the gate which I want to distribute a key to every player who asks for it. In the conversation, I have the player ask the guard if they may enter... this is where I want the script to come into play. What I want, is for the guard to tell the player they already have a key and not give them another one IF (fucking if) they already have one. So I want the script to detect if the player has the key, IF they have the key, I want the guard to tell them they already have one and not to give them another one. IF they don't have one, I want the guard to tell them something else (basically the guard saying something like "Sure here's the key."), and give them the key. My problem is, is that I can't figure out how to get one line or the other of text to appear in the conversation depending on whether or not they have the key. I tried using "Text appears when" and If then statements... but I keep fucking up somewhere.
--- End quote ---
Put this in the "Text appears when" of the dialog that option that states that the PC already has a key. This should be above the alternate dialog option that gives the key. (Replace "ItemTag" with the tag of the item.)

--- Code: ---int StartingConditional()
{
if(GetItemPossessedBy(GetPCSpeaker(), "ItemTag") == OBJECT_INVALID)
    {
    return FALSE;
    }
return TRUE;
}

--- End code ---




--- Quote from: Soul Sojourner on January 10, 2009, 07:36:33 PM ---Now, the other script... which is more of a bitch... I have an area where 'servants' are walking through the halls and doing their own thing (using the follow waypoint on the default heartbeat script), and what I want is for those servants to say something in text while they are walking (as talking above their head), but also saying something using an actual sound file at the same time. What they say in the sound file matches perfectly to what they will say in text. My problem is... I can't get the sound thing to work at all! I've gotten them walking around and talking in text... I've tried using the delay command and loops on their heartbeat and spawn scripts... but nothing's worked so far. At first I tried using the PlaySound function... What I want is for them to continually say stuff in text and aloud forever, but only like every 30 seconds or so. Problem is... the PlaySound function only seems to work when a characters action queue is clear... and since I have them constantly walking from waypoint to waypoint... their action queue is never clear... also PlaySound isn't even an action! It plays instantly! For some reason though it doesn't work unless the queue is clear so... I tried using SoundObjectPlay... but... that means I have to use a sound object... I tried things with that but it also ended in failure.

--- End quote ---
Try using the PlayVoiceChat function in combination with the VOICE_CHAT_ constants.

-420

Soul Sojourner:

--- Quote from: 420 on January 11, 2009, 01:36:43 AM ---Put this in the "Text appears when" of the dialog that option that states that the PC already has a key. This should be above the alternate dialog option that gives the key. (Replace "ItemTag" with the tag of the item.)

--- Code: ---int StartingConditional()
{
if(GetItemPossessedBy(GetPCSpeaker(), "ItemTag") == OBJECT_INVALID)
    {
    return FALSE;
    }
return TRUE;
}

--- End code ---


Try using the PlayVoiceChat function in combination with the VOICE_CHAT_ constants.

-420

--- End quote ---
That worked flawlessly. My problem there was I wasn't using int StartingConditional. When I did use that, it always popped up the other option and gave them another key (most likely because it was above the dialogue text with the script on it, I think.)

This second script is the bugger though, I don't think voicechat will work though. The actual thing I want the servants to say out loud is a sound file (one of grovels from the second expansion), and the constants use their actual voicechat stuff rather than playing sound files. I thought PlaySound would be the best option, but like I said... they're always walking so it wouldn't work. Unless I actually just fucked it up and their walking wasn't the reason for it not working.

420:

--- Quote from: Soul Sojourner on January 11, 2009, 08:26:18 PM ---
This second script is the bugger though, I don't think voicechat will work though. The actual thing I want the servants to say out loud is a sound file (one of grovels from the second expansion), and the constants use their actual voicechat stuff rather than playing sound files. I thought PlaySound would be the best option, but like I said... they're always walking so it wouldn't work. Unless I actually just fucked it up and their walking wasn't the reason for it not working.

--- End quote ---
Ah, the problem is that you have to manually type out the text that you want them to say.

For Smith Hold I use something like this on heartbeat:

--- Code: ---ActionSpeakString("It's break time now, yes? Yes? Maybe? No, back to work.");
PlaySound("vs_nx2goblm_59");

--- End code ---

-420

Soul Sojourner:

--- Quote from: 420 on January 11, 2009, 09:14:26 PM ---Ah, the problem is that you have to manually type out the text that you want them to say.

For Smith Hold I use something like this on heartbeat:

--- Code: ---ActionSpeakString("It's break time now, yes? Yes? Maybe? No, back to work.");
PlaySound("vs_nx2goblm_59");

--- End code ---

-420

--- End quote ---
I've been able to get them to show text above their heads, my problem is that the PlaySound function isn't working. It's probably better if I show you what I have right now. This was the last script I wrote for them and what I currently have for their heartbeat script.


--- Code: ---void main()
{
    object oNPC = OBJECT_SELF;
    float fWait = 30.0f;
    float fWaitLonger = 60.0f;
    string sSpeakOne = "It not that dirty here, no no no, but boss says clean, so we clean, clean, clean.";
    string sSpeakTwo = "It's breaktime now yes, yes, maybe? Nooo, baack to work.";
    int nTalkVolume = TALKVOLUME_TALK;
    string sSayAloud = "vs_nx2goblm_55";
    string sSayAloud2 = "vs_nx2goblm_59";

    DelayCommand(fWait, SpeakString(sSpeakOne, nTalkVolume));
    PlaySound(sSayAloud);

    DelayCommand(fWaitLonger, SpeakString(sSpeakTwo, nTalkVolume));
    PlaySound(sSayAloud2);
}

--- End code ---

However, PlaySound doesn't actually work... the DelayCommand is there to space things apart although that isn't working either (my guess has been because it's onheartbeat) so every few seconds they say more text above their head (instead of 30 seconds or so), and I'm trying to play two different sounds at two different times, but also have them have the correct sound play with the corresponding text talk.

Navigation

[0] Message Index

[#] Next page

Go to full version