Page 1 of 2
recording speech
Posted: Thu Jun 12, 2003 8:10 am
by NoneOf Seven
following scenario:
Person A is in one location, Person B in another (may be the same area, but probably a different room.
A talks into a hole in the wall, wheras B listens to the other side of the hole.
I want this talk "transmitted" to B's location, and be "spoken" there.
so I need a few hints on how to
a) pick up any talk in one location
b) have it output elsewhere (which is probably the easier part)
Posted: Fri Jun 13, 2003 12:57 am
by maxinion
hmmm... not sure exactly how to do this. picking up the speech is the hard part, as I dont' know how to do it... I know Shadowlords 3, the module, had a feature like this, in the beginning of the dungeon (its one big dungeon). You could probably just jack that part of the script for parsing the text. To get the peephole effect, make clicking on the hole set a variable, and when they leave the area or soemthing, change it back to normal. Have the above script run if and only if the variable is set to true. Then have the peephole object SpeakString() the text which you got through the previous script.
Posted: Fri Jun 13, 2003 1:08 am
by Yen-lo Wang
You need to set listening patterns, I believe. As far as I know you could either do it with a NPC (easier) or a placeable (harder). You probably want a placeable in this case, since I'm assuming what you're after is anonymity. The only way I know to do it involves a hb script, though.
Posted: Fri Jun 13, 2003 7:17 am
by NoneOf Seven
hmm... heartbeat scripts are probably either disallowed or extremely frowned upon...
*sighs*
Perhaps an invisible NPC that's rooted to the spot and serves as a relay... Or would a NPC also need a heartbeat script ?
Posted: Fri Jun 13, 2003 11:18 am
by Jordicus
don't think so...
you could use an invisible NPC and a trigger on the ground, so that when the triggers OnEnter activates whatever routine you need the NPC to do and the OnExit deactivates it.
Posted: Fri Jun 13, 2003 11:24 am
by NoneOf Seven
That does actually sounds feasible.
So I have to combine the following ingredients:
An invisible NPC that has a listenening pattern and thus is able to record the spoken words.
A trigger that activates said NPC
A means of outputting the recorded words, for instance by another invisible NPC, or by FloatingTextOnCreature or similar.
Now I Just need to find a tutorial on listening patterns...
Thank you !
Posted: Fri Jun 13, 2003 11:43 am
by j5hale3
Random psysic answer warning: (means I don't know jack shit about it but here's a thought)
Could the scribe function help in this case?? It seems similar to what you are trying to do. as speak to scribe---> becomes note on board.
Just a thought.
Best regards,
Posted: Fri Jun 13, 2003 11:48 am
by Dhalmoh
That does actually sounds feasible.
So I have to combine the following ingredients:
An invisible NPC that has a listenening pattern and thus is able to record the spoken words.
A trigger that activates said NPC
A means of outputting the recorded words, for instance by another invisible NPC, or by FloatingTextOnCreature or similar.
Now I Just need to find a tutorial on listening patterns...
Thank you !
Okay, when you come up with the answer to this. Post it here so i can use it in my own house. Sounds dope
Posted: Fri Jun 13, 2003 12:03 pm
by Jordicus
Posted: Fri Jun 13, 2003 12:31 pm
by NoneOf Seven
Thank you for the pointers.
I think I have an idea for the script so that it listens to every sentence.
the combination of
Code: Select all
SetListeningPattern
SetListening
GetMatchedSubstring
should do the trick.
Pity that there doesn't seems to be any function that returns the whole line that was said, but only the substring that fits the search pattern. If someone knows one, please direct me to it...
(the scribe from the bulletin board seems to be an ideal object to dissect. Does anybody have his script at hand ?)
Posted: Fri Jun 13, 2003 1:53 pm
by Praetor
This is a relatively interesting idea, so I scripted this up. Unfortunately, it does have one drawback. In order to get an object to call an on conversation event, that object needs to be a creature (i.e. placeables can't hear stuff). This isn't a huge deal, as you can still give it a null body and give it no name. Unfounately, if the player hits tab or mouses over it, mouse tip feedback will hover Uninjured over the creature's head. Like I say, not a huge deal, but players will realize something is up ooc. anyways, if you want to use the script, I put it into erf format and uploaded it to my homepage at:
http://homepage.usask.ca/~mtm685/NWN/peephole.erf
Follow the instillation instructions to use it.
Posted: Fri Jun 13, 2003 3:03 pm
by Yen-lo Wang
Sorry, I meant if you used placeables you needed a hb...for NPCs its just the listening events, no need for triggers. Like Praetors done, I think
Posted: Fri Jun 13, 2003 9:52 pm
by NoneOf Seven
Praetor,
many thanks for this .erf, you spared me a lot of work.
Is it possible to attach improved invisibility to the listening NPC ? This should take care of the visible Uninjured tag, right ?
Posted: Fri Jun 13, 2003 11:44 pm
by maxinion
Heh... I'm pretty sure everyone in your home will have floaty eyes anyway, so improved invis won't help much. You can make a trigger for on enter to apply effect invis on it, though.
Posted: Fri Jun 13, 2003 11:54 pm
by Yen-lo Wang
Or just spawn it invis. Or make it sneak on spawn, which would cut out the lower level floaty eyes (see invis). I really need to type more clearly
Posted: Sat Jun 14, 2003 12:38 am
by Dhalmoh
Just wondering, i didnt test it yet. But when i implemented the .erf file, it said i needed to change the taggs. Im not sure i understand, did you script it so that if only the tags match then they will be connected ?
So all i acctually have to do is come up with tags like your description and they will be connected, then i am free to change the names so perhaps 1 of the speakers is named "Livingquarters" so i know what im hearing from where?
Also about onspawn hide/movesilently, how do i make that work?
And this last part, do i need a genetric trigger in order to spawn/make the speaker and listener work ?
Im no scripter, just wanted to clarify this.
And great work btw, fancy scripts own bad
Posted: Sat Jun 14, 2003 2:08 am
by Dhalmoh
I've come up with some questions.
1. I will make the listeners visible, and have them standing about and have a conversation to initiate. So they say something like "This is the guestquarters".
So now i don't have to conceal them. But i had some problems with the conversation, i could'nt make them as usuall. He didnt initiate the conversation even though i clicked on him..
2. Is it possible to have the speakers say what is beeing said in the other room without having to talk to them to initiate it?
3. Can my speakers be scripted so they give a message when something enters their line of sight. So they say something like : "We have guests in the livingquarters"?
edit:
4. How do i change the way the speakers present what is beeing said?
My rooms are not adjecant, so it's not suiting that it says: "you hear <blablabla> in the next room"
Posted: Sat Jun 14, 2003 3:36 am
by Praetor
I'll answer a few of these questions, though this is probally going to be about as much support as I give this thing. There is also a new version of the file up which includes the improved invis on spawn and moves some code in the on user defined event to make it more modular. It works exactly the same though.
______________________
NoneOfSeven: You were definately on the right track, this is just a little boost to give you an example of how to hurry it along. As for your question.
In the onspawn script (mm_9_peephole), attach the following line to make the listener have improved invis, then recompile... or download the new version in which I already did that.
Code: Select all
// Insert this at the bottom of the file right after the SetListening line
ApplyEffectToObject(DURATION_TYPE_PERMANENT,SupernaturalEffect(EffectInvisibility(INVISIBILITY_TYPE_IMPROVED)),OBJECT_SELF);
As for sneak on spawn, I did select that setting, and maxed out its hide and sneak skills, but it doesn't sneak for some reason. Not a big deal though.
For Dhalmoh:
I'll answer a few of your questions, but I'd recommend getting a bit mroe familiarity with the toolset and the scripting language (C-based). There are a lot of examples at NWVault, and the NWNLexicon has a great function reference. By examining Vault scripts, you can probally get ideas how to do a lot of what you're looking at. Now for the answers.
To link the two, the tags after the first _ must match (i.e. PHD_anythingunique and PHS_anythingunique). I figured that your name would be a good suggestion because each tag pair must have a unique ending. As for the Name field, the name can be absolutely anything that you want. Keep in mind that vanor will probally charge a fair bit for these peep holes.
You currently don't have to either npc to initiate the transfer. Just give the game engine a few seconds after the module starts to load all the tiles, placeables, and creatures. After that it will start handling events.
To change how the voices are reported, simply open the script file "mm_od_peephole". Near the bottom, you'll see text that says "You hear muted voices from the next room" - simply change that to whatever you want it to read.
To get changes to take effect, such as attching a conversation, be sure to Update Instances if you made the changes to the blueprints.
Finally, to make them work, just place an instance of each in your module and link the tags as described above. No triggers or anything like that.
Posted: Sat Jun 14, 2003 1:12 pm
by Dhalmoh
edited:
ok, these are the remaining questions.
I got all the things you said to work
I'd like to make a teleportation script.
Let me explain..
In my stronghold, i have one room that has a quest-door and only 1 tile circle.
In there i can hear what is beeing said around the house. Also i have a NPC helmethorror there, that i want to be able to transport me to various locations. (4 in all)
But also, inside my stronghold, i want to have two pressureplates or something else that i can step on and get transported to the room with the helmethorror.
It's very important that these plates check for the key, that should be fairly easy? Onuse check for the key and then autolock after ?
Can i be given some pointers. Or just make the .erf and send me, after this im going to be done...
Posted: Sat Jun 14, 2003 8:31 pm
by Dhalmoh
Important.
I have made the pressureplates that teleport me, i used a generic trigger with a waypoint where i wanted to go. And got a friend to make me that script. Now all i would like is for that trigger only to trigger when i carry a spesific key....
here is what i got so far:
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
AssignCommand(oPC, ClearAllActions());
object oTarget;
oTarget = GetWaypointByTag("Destination");
DelayCommand(3.0, AssignCommand(oPC, ActionJumpToObject(oTarget)));
oTarget = oPC;
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oTarget));
}
So where do i put the part that only triggers if it the "last used by" returns true when it comes to carrying a key?
Posted: Sat Jun 14, 2003 9:43 pm
by JollyOrc
you do need to insert a check if the oPC object has the specified key in his inventory. Don't know the exact function for it, but it should look something like:
Code: Select all
if HasItemInInventory("tag_of_key_as_string", oPC)
{
//insert script to teleport here
}
else
{
//nothing happens
}
Posted: Sat Jun 14, 2003 10:10 pm
by Dhalmoh
void main()
{
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
if (GetItemPossessedBy(oPC, "MasterKey")== OBJECT_INVALID)
return;
AssignCommand(oPC, ClearAllActions());
object oTarget;
oTarget = GetWaypointByTag("Destination");
DelayCommand(1.0, AssignCommand(oPC, ActionJumpToObject(oTarget)));
oTarget = oPC;
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oTarget));
}
This is what i got sofar, with help. It works great, i put it on use on a Pressure plate instead of the generic trigger.
But i have one problem, as you see it's delayed 1 sec. I would like to put an effect on my waypoint after 1 sec. So when i step on the pressureplate i get unsummon effect. And then i get summon monster on the destination, shouldnt that work ?
Posted: Thu Sep 11, 2003 12:29 pm
by Mistcaller
I would like my NPC to record in 2 LocalStrings the first two words a PC says.... Is this possible? Any ideas?
Posted: Fri Sep 12, 2003 12:12 am
by Morbid Ridicule
Well... those waitresses know when you call 'em somehow.
Posted: Fri Sep 12, 2003 11:55 am
by Mistcaller
The problem is how the NPC will sort out which are the first two words, either from a sentence or from a series of 4-5 different one-word sayings.
I mean I know by SetListening ,the NPC is able to listen to what you say. But how can he store just a pre-defined part of your words?