Jump to content

Quest Making: Checking NPC Inventory For Item


Lemecc

Recommended Posts

There's a mod I'd like to make, but there's a specific way I'd want it to start. First, I'd want to check the player has completed Far Harbor, and achieved a specific ending, and also check how they finished the main Fallout 4 storyline (or visa versa. It doesn't matter which order these are checked in, so long as they are both satisfied), and only if the right conditions are met will the mod begin the first quest. Although I don't know how to do this yet, I'm reasonably sure it's "simple" (to an extent), and I'm not worried about this too much yet. There are vanilla examples I can check.

 

Something I'm not sure about is the next step though. Should the conditions for the mod to start prove true, I'd like a quest to begin that involves a stage where the player must place a specific item into an NPC's corpse inventory to progress (one of the NPCs that is killed during a FH scene, according to the wiki the corpse will never despawn, so ensuring it's there for the player to interact with shouldn't be a problem I'd hope), and leave the location/wait a few days. Providing those things are done, it'd then move onto the next stage (disabling the corpse from the world when it does so).

 

I know some of those things are possible just by existing examples. However, I can't think of any scenario similar to checking the inventory of a dead character (especially one that was previously alive) for a player-placed item and using that as a way to progress a quest in the base game - or in any mods I've played.

 

For those of you more versed in the quest system than I (which would be most everyone!), is this something that would be possible to do?

Link to comment
Share on other sites

What you are suggesting is straightforward if you understand the game systems, but that could be many weeks of actual learning.

 

In words how it could be implemented:

 

(a) Add the actor of interest to a quest reference alias.

 

(b) Add a script to the quest reference alias that triggers when the object of interest is added the the actor inventory (AddInventoryEventFilter + OnItemAdded + IsDead) to then progress to the next stage of your quest.

 

Turning that into a quest and scripts is the hard, possibly frustrating but fun-in-the-end bit.

 

Just one caution: "disabling the corpse from the world when it does so" ... be extreamely careful messing about with objects from other quests as you may break something without knowing it. If you dont totally KNOW the full chain of references and events on an object you did not create LEAVE IT ALONE.

Link to comment
Share on other sites

Thanks, that's a great help, and much appreciated!

 

I've got a ton to learn before I can even begin executing on this idea, but I wanted to check if it was even possible before I dove in doing the bits of the mod that are more in my current scope. I've seen the base game and mods do every other thing I have in mind, it was really just this one interaction I've not seen. Sounds like it's all very possible, which is excellent. As long as I know point B exists, I can start learning and begin the journey from point A.

 

Great point with the warning too. I was assuming that since that NPC is dead, and there are no further quests to FH's story once they are dead and no other calls to them, they're "free" for me to disable, but you're right in that's a big assumption. Is there a safe way for me to move the corpse away from player view and interaction after they've satisfied the item condition?

 

On the topic of making safe mods (or as safe as possible, anyway), the reason I wanted the player to add an item to the NPC's inventory, is because this seemed (in my uneducated mind) to be the cleanest method to have the player interact with an already existing NPC, vs adding an alternative activation to the NPC corpse (press X to plant item, for example). Is that right, or is that a completely off-base assumption?

Link to comment
Share on other sites

The BEST and CLEANEST approach is to always use your own assets then you KNOW there will be low possibility of conflict or contention.

 

If you cant place&enable or spawn your own dead actor and must use existing for narrative purposes then adding a trigger object to their container is good. I actually do that in Preston is Killable, take a look at that for a template.

 

Adding a third activation option with a unique AddActivate perk looks clean and EZ, but there are so many solutions now using AddActivate that touch actors (quick trade, quick loot, pacify, prostitute, whatever) contention is likely and totally undetectable. As AddActivate contention is so common I would probably spawn an invisible activator box around the actor to capture/control interaction and the delete itself. Getting the size and XYZ offset on the actor that copes with multiple ragdoll/surface postures would take some fun testing cycles tho.

Link to comment
Share on other sites

Oh my god, I didn't even think about the fact they can ragdoll around and what that might mean for my idea. Trying to account for that is probably well beyond my current ability. :laugh: Interesting. In terms of play, for the player it'd be such a mundane task to do, but it might actually be one of the most awkward parts for me to wrangle!

 

For this mod, my intention is to create a new copy of an NPC (just copying appearance, stats and voice but as a brand new record) for the mod to use so that it doesn't touch the original actor in any way, but it requires that original character to have been killed during the final cutscene so that hopefully everything connected to them is shut down for good. Everything else about the mod would be related to this brand new copy, and the one singular interaction with the original would be cleaning up their corpse. I could definitely make a copy corpse to use, but the player specifically witnesses the death in FH, and the actor never despawns, so it feels like my hands are tied on needing to use the existing actor for one brief action.

 

Thanks for the heads-up SKK50, I'll take a look at Preston Is Killable and see what I can learn! That definitely sounds like the way forward. I think my idea is a mod I won't even be 10% of the way through any time soon, but it's good to know it should be possible, and I appreciate the pointers and tips on what sort of functions I'll need to utilize.

Link to comment
Share on other sites

I'm mainly curious if that's some larva that needs to be planted into the corpse and what goes next after a few days :wink:

 

Looks like perceived as overcomplicated, while it's not.

Although i'm not sure why such a strict need to disable, worst problem for a character without postmortem dependencies (as properly advised to check out above) would be just with other mods, which might decide to use the same body. Can't grasp the immensity here. Still, it's a reasonable idea to keep very unique corpses intact and at least not vandalize game by Delete. Good practice for both sides would be to have a spare scenario for the case when base game object is unavailable or just something went wrong, then a fresh spawn or else goes into play, for example, can reenable that disabled corpse for own use.

 

Ragdoll isn't a problem, unless he falls out of map, of course. As advised, quest alias is likely the best way. OnAliasInit event or any code that fills the alias should check if actor is dead already, otherwise ReferenceAlias OnDeath event should progress the quest, either of them should inform player by a quest marker (SetObjectiveDisplayed) which points to the Actor, so it doesn't really matter where he lays, unless primary goal of the mod is to challenge player by hide and seek. If that's some larva indeed, then OnItemAdded event as described, otherwise OnActivate can be enough. May be proximity check as well, depends on mod's plot. Another option to designate player's acknowledgement may be a custom (or scripted by alias) item that needs be taken out of corpse, OnContainerChanged() event, though anyway OnActivate will fire still, so it can be any dummy thing.

 

I could advise to pay attention to DefaultAlias / DefaultRef base game scripts series. They're inefficient as hell, but good for start.

 

* ps. Should avoid forced alias fill for temporarily captured intermediate objects, unless that actor (or whatever else REFR) is Persistent in base game. This requires additional measures though, like starting the quest (or filling the alias) when he's loaded, then clearing the Alias. Still, may be ignored while in experimental stage. nah, nevermind

Edited by hereami
Link to comment
Share on other sites

  • Recently Browsing   0 members

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