Jump to content

A couple small-ish scripting questions (NPC-NPC detection!)


AngryFace

Recommended Posts

UPDATE:

I'm working on a relatively basic mod that handles lore-friendly-ish sexout interactions between a few vanilla npcs. If I'm satisfied with where its going, I'll post a wip once I get a bunch of the features working.

 

---

 

I'm pretty sure I can hammer out most of it with ease, but there are two features I'd like to include that are giving me trouble.

 

First: a privacy checker. Works by checking the number of nearby npcs that have line-of-sight to the npc it's running on. The problem is that getLOS (according to GECK's terrible documentation) is player-only. Is there any sort of way to check for LOS between npc's?

 

Second: a rep system that increments based on completion of quests -- any quest. I know how to add rep tokens based on time and based on a specific quest, but is there a flag or a variable that increments per any quest completed?

:idea: EDIT: figured it out by typing it out. The "quests completed" challenge variable!

Link to comment

Sure, if it's only between npc's. The wiki says IsActorDetected doesn't work for the player; Getdetected seems to work for both player & npc so my instinct tells me to go with that option as a default, in case AF wants to mix in the player at some point.

Assuming the wiki's right of course ;)

Link to comment

Thanks! For some reason the detection functions never occurred to me :s

 

GetDetected seems to be the best and simplest option for ensuring total privacy, which I can definitely use. I'm not sure if it registers the player, but if it doesn't I can use getLOS to check if the player can see the npc.

 

IsActorDetected could possibly be useful because I want to be able to filter a particular npc (such as the desired npc partner) out of the privacy check. There appears to be two ways to approach a privacy check with such a filter.

 

I can somehow "blind" the filtered npc momentarily so that it doesn't register with GetDetected.

-OR-

I can use GetFirstRefInCell/GetNextRef to grab all the npcs in the target cell, then filter out the target npc and any npcs that are too far away. Once I'm done, I can call GetIsDetected on each of them to check detection.

 

I'd prefer to take the first route because it's way simpler, however I'm not sure if it can be done. Does 0 PER prevent detection of non-sneaking entities? Does the bucket-over-the-head trick work in fnv? In case I have to do the second approach, I'd like some help on GetFirstRef. What is the criteria for the first ref - is it the closest npc to the player? Also, how big is an outdoor cell; if I fetch all of the npcs in an outdoor cell am I likely to get a list of hundreds of people?

Link to comment

I can somehow "blind" the filtered npc momentarily so that it doesn't register with GetDetected.

-OR-

I can use GetFirstRefInCell/GetNextRef to grab all the npcs in the target cell' date=' then filter out the target npc and any npcs that are too far away. Once I'm done, I can call GetIsDetected on each of them to check detection.

 

I'd prefer to take the first route because it's way simpler, however I'm not sure if it can be done. Does 0 PER prevent detection of non-sneaking entities? Does the bucket-over-the-head trick work in fnv? In case I have to do the second approach, I'd like some help on GetFirstRef. What is the criteria for the first ref - is it the closest npc to the player? Also, how big is an outdoor cell; if I fetch all of the npcs in an outdoor cell am I likely to get a list of hundreds of people?

[/quote']

 

Outdoor cells are pretty small. No worries there.

Not sure if 0 perception will avoid getting detected completely. But I bet you're better off going with one of the AI functions like SetActorsAI or SetUnconscious.

As to the rest, it may take some more intel. Is this privacy check something you'd do with every sexout scenario, or something only for a specific mod, existing or otherwise? If the former, I'd definitely look into hooking into Sexout's own scanner.

Link to comment

The privacy checker is for certain situations with a couple of NPCs I'm tracking in this mod I'm making:

- Occasional masturbation when alone

- Agree to sex with the player if no one else is around

- Engage in sex with a specific partner NPC, as long as they are alone together.

 

This hard part of the privacy checker is for the third situation. The player isn't necessarily involved, so I can't use the Sexout Scanner because (to my knowledge) it only scans around the player.

 

At second glance, SetUnconscious looks like it might work. I was originally under the impression that it caused the actor to ragdoll. I'll have to test it out. Thanks!

Link to comment
This is relevant to my interests. I've been contemplating a Marriage mod' date=' and these privacy settings could come in handy for courtship and marriage behavior.[/quote']

I have 2formlists in SCR SexoutSLDataIsPartnered and SexoutSLDataIsPartneredFaithfully you might want to use. I think I had one for IsPartneredToPlayer & IsPartneredToCass etc.

Link to comment

- Engage in sex with a specific partner NPC' date=' as long as they are alone together.

 

This hard part of the privacy checker is for the third situation. The player isn't necessarily involved, so I can't use the Sexout Scanner because (to my knowledge) it only scans around the player.

[/quote']

 

But if the player is not there, would sex matter?

 

If you are going for long term consequences (like building relationships and/or children) then I think you should have a "quick resolution system" for this kind of thing, to keep from having all the npc activity freeze the game for the player.

 

If you are trying for having scenes that the player can sometimes stumble over then maybe using the scanner is the right thing to do, if you can extend its range enough?

Link to comment

But if the player is not there' date=' would sex matter?

 

If you are going for long term consequences (like building relationships and/or children) then I think you should have a "quick resolution system" for this kind of thing, to keep from having all the npc activity freeze the game for the player.

 

If you are trying for having scenes that the player can sometimes stumble over then maybe using the scanner is the right thing to do, if you can extend its range enough?

[/quote']

 

True. Trees falling with no one around and all that jazz. I'm going for the latter, btw - sex scenes that aren't necessarily hidden, just not in the middle of town. The player should be able to find them pretty easily if they know where to look and follow the sound effects.

 

The Sexout scanner looks curmplurcated, though. Let's see...I put a formlist and a spell into the scanner, and whenever my player is near an npc, it gets added to the formlist and the spell is cast on the player.

 

It looks like it could be useful, but I'm not familiar with it and I don't know its limitations. How far away does the scanner go? Can it be used to populate a list of all the npcs in a cell, like I mentioned earlier?

Link to comment
curmplurcated

Wait... what? ...what does that word exactly mean? Or does it mean anything? :huh: Truly confused here ;<

curmplurcated:

curm·plur·kate·ed (krmpl-ktd)

adj.

1. Containing intricately combined, bizarre or involved activity involving sexually produced fluids.

2. Sexual relationships not easy to understand, analyze or comprehend.

3. A mispelling of Complicated due to catlike typing on keyboard, lack of sleep or alcohol consumption.

 

Does that help? :)

Link to comment

True. Trees falling with no one around and all that jazz. I'm going for the latter' date=' btw - sex scenes that aren't necessarily hidden, just not in the middle of town. The player should be able to find them pretty easily if they know where to look and follow the sound effects.

 

The Sexout scanner looks curmplurcated, though. Let's see...I put a formlist and a spell into the scanner, and whenever my player is near an npc, it gets added to the formlist and the spell is cast on the player.

 

It looks like it could be useful, but I'm not familiar with it and I don't know its limitations. How far away does the scanner go? Can it be used to populate a list of all the npcs in a cell, like I mentioned earlier?

[/quote']

 

If you put an empty list of your own into the scanner's list, then everyone it finds will be put in that list. So, yes. All you really need to do is have a way of clearing it on cell transition, I think, to avoid dead weight. Use the spell to trigger a getdetected check between everyone in the list and the player, in a label/goto loop, leading up to an all-clear or not. The scanner has the range of the cell you're in and the surrounding eight cells, so that should be fine, I think, a cell being close to 200ft/60m a side (exterior, interior can be bigger) & the game looking bigger than it is.

This will need some testing though, especially to make it economical on the cpu - can't say I'm very familiar with it myself. The default is it's cast 10 times a second, so I'd actually use the spell you place in the list to trigger a timer somewhere and only run the getdetected loop every 10-20 seconds, out of combat, and under whatever quest conditions etc I could use to minimize the impact.

Link to comment

Archived

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use