Stupid Enclave

Post » Sat May 28, 2011 4:14 pm

I'm currently doing a ref walk of NPCs, and adding some things to the inventories of any NPCs wearing power armor. The trouble is, if the ref walk happens during combat, the NPC's AI seems to get interrupted, and they stop fighting back. It only happens to NPCs that get items added to their inventory. Anyone know a way to prevent this, or maybe just snap them out of it after I'm done tweaking their inventory?

I've tried "evp" and "resetai" on frozen NPCs via console, but that doesn't seem to help. I've also tried using "startcombat" in my script, but no luck there either.
User avatar
Sunnii Bebiieh
 
Posts: 3454
Joined: Wed Apr 11, 2007 7:57 pm

Post » Sat May 28, 2011 5:29 pm

This is exactly what happened to me with IPA. I just had the script recast a scripted actor effect on the nearby NPCs instead of adding a token. Adding a second item can sometimes fix it, but I couldn't get it to work consistently.
User avatar
jessica Villacis
 
Posts: 3385
Joined: Tue Jan 23, 2007 2:03 pm

Post » Sat May 28, 2011 8:23 pm

Bummer. The whole point of the ref walk is to add items to the NPC's inventory, so there isn't really a way around that. I could maybe handle the exploding PA with a scripted effect, and add the lootable items to the corpse rather than the living NPC. But that means they won't ever be using the upgrades against you, unless I go through all of the headache of modifying all of those leveled lists. I'll keep trying stuff though, I'll let you know if I figure something out.


Edit - There's no problem if I do it during menumode. I wonder if people would object to the occasional "cell loading" message?
User avatar
Antonio Gigliotta
 
Posts: 3439
Joined: Fri Jul 06, 2007 1:39 pm

Post » Sat May 28, 2011 9:51 am

Bummer. The whole point of the ref walk is to add items to the NPC's inventory, so there isn't really a way around that. I could maybe handle the exploding PA with a scripted effect, and add the lootable items to the corpse rather than the living NPC. But that means they won't ever be using the upgrades against you, unless I go through all of the headache of modifying all of those leveled lists. I'll keep trying stuff though, I'll let you know if I figure something out.


Edit - There's no problem if I do it during menumode. I wonder if people would object to the occasional "cell loading" message?

Probably :) Can you just add it only if they're out of combat? Depending if your script runs regularly, presumably at a cell load they'll get an item before they enter combat with someone.
User avatar
GabiiE Liiziiouz
 
Posts: 3360
Joined: Mon Jan 22, 2007 3:20 am

Post » Sat May 28, 2011 12:25 pm

That doesn't seem to work for the game conditions I've been testing it under, unfortunately. I load a save where I'm a cell or two away from Wheaton Armory. When I approach it, two Enclave soldiers are already engaging the raiders there, so they'd never get the additions. Once I've cleaned that place out, I fast travel to a SatCom Array with an Enclave outpost at its base, and even if I do the ref walk as soon as I arrive, it triggers the "Stupid Enclave" bug, so combat must be triggered immediately. What I'm thinking is that I could do a gamemode, single cell ref walk every once in a while, maybe whenever the player enters a new cell, and if I come across an NPC that doesn't have the equipment that they should, exit that ref walk and post a message saying "New NPCs encountered, please wait..." or something, then do the equipment adding ref walk while in that menumode. I could use a cell depth of 1 or 2 for that one, so the loading wouldn't happen every time the player enters a new cell. They click OK, and things return to normal.

I'll admit it does sound pretty obnoxious. I also tried tapping the console key via FOSE, doing the ref walk, then tapping it again when its done, but all of that takes a bit longer than I was figuring - a second or two, rather than just a couple of frames. It's too obtrusive and confusing.
User avatar
Taylah Illies
 
Posts: 3369
Joined: Fri Feb 09, 2007 7:13 am

Post » Sat May 28, 2011 1:01 pm

You could apply the same 'effects' as the upgrades via the Actor Effects, and then just add the actual bits and pieces when they're dead? Not much difference between an object effect that gives +5 DR and an actor effect that does.
User avatar
Anna Krzyzanowska
 
Posts: 3330
Joined: Thu Aug 03, 2006 3:08 am

Post » Sat May 28, 2011 9:31 pm

I had a similar problem and Bonedog suggested that I add an armor, have the Actor equip it and then remove that equipped armor to force a re-eval of their inventory. That worked for my 'stupid NPC' bug.
User avatar
Chloe Lou
 
Posts: 3476
Joined: Sat Nov 04, 2006 2:08 am

Post » Sat May 28, 2011 10:49 pm

I kind of like doing the ref walk during menumode, it feels more stable. But I'll give the unequip/equip thing a try. If it works it'll be much less annoying for the player.

Edit -

Equipping/unequipping a pair of sunglasses didn't seem to work, so I think what I'll do is perform a ref walk with a cell depth of 2 or so every time the player enters a menu. That should catch things most of the time, and also solve the stability problems I was seeing - gamemode ref walks during combat were causing CTDs. I'll also include the load message method, but give the player the option to enable or disable it. That way they can either just enter menus on their own occasionally, or have the scripts do it for them when necessary.
User avatar
Naughty not Nice
 
Posts: 3527
Joined: Sat Nov 04, 2006 6:14 am

Post » Sat May 28, 2011 10:10 am

Just to clarify, did you try removing the sunglasses without unequipping them first? Removing equipped items should force an actor to re-evaluate their inventory, but unequipping items will not.

Cipscis
User avatar
Beth Belcher
 
Posts: 3393
Joined: Tue Jun 13, 2006 1:39 pm

Post » Sat May 28, 2011 6:27 pm

No, I just tried adding, then equipping and unequipping them, not removing while equipping. I think I read pkleiss' comment wrong. But a bigger issue is stability, doing the ref walk during gamemode, particularly during combat, often leads to crashes.

I was about to release, but I'll give the gamemode ones a try again and see how it works out.

Edit - Still no luck. The item doesn't get removed if it hasn't been unequipped, and the AI still gets distracted.


The good news is, the FOSE command con_CloseAllMenus can be used to automatically close the "load" message when the ref walk is done, so it only flashes on the screen briefly.
User avatar
Damien Mulvenna
 
Posts: 3498
Joined: Wed Jun 27, 2007 3:33 pm

Post » Sun May 29, 2011 12:13 am

No, I just tried adding, then equipping and unequipping them, not removing while equipping. I think I read pkleiss' comment wrong. But a bigger issue is stability, doing the ref walk during gamemode, particularly during combat, often leads to crashes.

I was about to release, but I'll give the gamemode ones a try again and see how it works out.

Edit - Still no luck. The item doesn't get removed if it hasn't been unequipped, and the AI still gets distracted.

When removing an item that's equipped without unequipping it first, you have to remove at least one more than the number that's in inventory. Somehow being flagged as equipped causes the item to make some sort of internal temp copy of itself and use the copy as the one equipped. There is actually 2 while equipped, the 'equipped' flagged original, and the temp copy in use. Unequipping seems to remove the flag on the original and destroy the temp copy, returning the original to normal status. The temp copies seem to be overlooked by item count inventory functions, but not by removeitem. This can be verified by equipping an item you can see, like armor or a weapon, and RemoveItem ID 1. You'll see the visible one be removed, yet one (the original) still remains in inventory. If done in the console, removing a quantity of one will print to console a remaining item count of 1. RemoveItem ID 2 will correct that. It may also be the case the you need to Add & Equip the item a frame or two before Removing it.
User avatar
Laura Wilson
 
Posts: 3445
Joined: Thu Oct 05, 2006 3:57 pm

Post » Sat May 28, 2011 12:22 pm

I just wanted to confirm that for me, I had to remove the equipped armor in a different frame than when it was equipped. I did not have to remove two of them though. Strange.
User avatar
Jessie Butterfield
 
Posts: 3453
Joined: Wed Jun 21, 2006 5:59 pm

Post » Sat May 28, 2011 8:56 am

If this works, than I think what I can do is greatly simplify the conditionals determining what gets added to NPC inventories during the ref walk, and handle the rest of it with objects scripts on the inventory tokens that I'll add instead.

It's kind of frustrating bumping up against the edges of the engine like this. I had a similar experience trying to get the jump height increases to work. At least there's FOSE.


Edit - OK, that worked. I added a token item to the NPC's inventory during the refwalk, plus equipping the dummy armor item (model and slotless). Then the dummy armor removes 2 copies of itself via its own object script. The NPCs remained engaged in combat, and the the tokens were in their inventory. Now I just have to see if I can do everything else I need to without crashing the game.
User avatar
Josh Dagreat
 
Posts: 3438
Joined: Fri Oct 19, 2007 3:07 am

Post » Sat May 28, 2011 9:20 am

I just wanted to confirm that for me, I had to remove the equipped armor in a different frame than when it was equipped. I did not have to remove two of them though. Strange.

The engine seems to correct the reporting mismatch on it's own when the "session" or mode changes. From the console, it'll report a remaining count of 1, and subsequent getitemcounts will also show 1 remaining, but it you close the console and reopen it again before checking getitemcount, it will have fixed it already and will report 0. I'm guessing because several frames of gamemode have ran.. no way to be sure though. I'm not entirely convinced it's behavior is consistant, which makes it hard to predict, which is why I suggest removing more than the original number to be on the safe side.

Edited to add that I'm not stating any of this as proven fact. It's what I think is going on based on observation during buttloads of item counts and remove item counts, and noting the inconsistancies. The only part I know is true is that there's some kind of swapping going on when something gets equipped, and that this little gimmick does work.
User avatar
Tammie Flint
 
Posts: 3336
Joined: Mon Aug 14, 2006 12:12 am

Post » Sat May 28, 2011 1:34 pm

If this works, than I think what I can do is greatly simplify the conditionals determining what gets added to NPC inventories during the ref walk, and handle the rest of it with objects scripts on the inventory tokens that I'll add instead.

It's kind of frustrating bumping up against the edges of the engine like this. I had a similar experience trying to get the jump height increases to work. At least there's FOSE.

Not wrong. If I had a dollar...

Anyway, another option: add your items to the equipment level lists via quest script on load using http://geck.gamesas.com/index.php/AddItemToLeveledList. Additions to lists this way need only be done once, and are saved in the user's savegame. No overhead, no gamemode scripts etc, very clean. The only concern is if other mods change the lists you use -- not in terms of altering them, because your additions get added after all that, but for those mods that move or replace those lists entirely (FOOK and maybe FWE come to mind). But here it's very easy to simply release compatibility .esps that update your list-addition script to use whatever lists these mods are using instead.
User avatar
Gwen
 
Posts: 3367
Joined: Sun Apr 01, 2007 3:34 am

Post » Sat May 28, 2011 11:48 am

Not wrong. If I had a dollar...

Anyway, another option: add your items to the equipment level lists via quest script on load using http://geck.gamesas.com/index.php/AddItemToLeveledList. Additions to lists this way need only be done once, and are saved in the user's savegame. No overhead, no gamemode scripts etc, very clean. The only concern is if other mods change the lists you use -- not in terms of altering them, because your additions get added after all that, but for those mods that move or replace those lists entirely (FOOK and maybe FWE come to mind). But here it's very easy to simply release compatibility .esps that update your list-addition script to use whatever lists these mods are using instead.


I have sort of a weird problem though - most of my upgrades do not have a biped slot selected. It doesn't crash the game or anything, though the geck yells at me every time I open up the mod. But I have to set the nounequip flag when I make an NPC equip one of them, or they will immediately unequip them. If I added them to leveled lists, they'd be there to loot, but the NPCs wouldn't take advantage of them.
User avatar
gary lee
 
Posts: 3436
Joined: Tue Jul 03, 2007 7:49 pm

Post » Sat May 28, 2011 8:47 pm

If you check the "unplayable" flag then they will be unavailable for the player to loot - they won't even see them in the actor's inventory.

Cipscis
User avatar
Philip Rua
 
Posts: 3348
Joined: Sun May 06, 2007 11:53 am

Post » Sat May 28, 2011 9:09 am

Have you tried setting up one equippable object as a sort of a trojan horse, so you can piggyback all your other slotless items on it? Maybe try making one that uses a legitimate equip type and unused biped slot, so the NPCs won't want to unequip it right away, and use its biped model list to force the other items on and keep them in place. Just an idea...
User avatar
Sammi Jones
 
Posts: 3407
Joined: Thu Nov 23, 2006 7:59 am

Post » Sat May 28, 2011 9:50 am

If you check the "unplayable" flag then they will be unavailable for the player to loot - they won't even see them in the actor's inventory.

Cipscis


In this case I do want the player to be able to loot them, it's an attempt to keep at least some balance. I could probably find a use for that though - right now, there's up to three or four seconds between the time when a nuclear power armor equipped NPC dies, and when they're done exploding, so if the player loots the body during that time they'll see the detonation token. If it were an unplayable bit of armor they wouldn't. Granted, the corpse is usually busy vigorously detonating during that time, so it's maybe not completely necessary :) I think it would be better to do away with the "physical" tokens though and try to accomplish it through a scripted effect.

Have you tried setting up one equippable object as a sort of a trojan horse, so you can piggyback all your other slotless items on it? Maybe try making one that uses a legitimate equip type and unused biped slot, so the NPCs won't want to unequip it right away, and use its biped model list to force the other items on and keep them in place. Just an idea...


If you can include armor in the biped model form lists and not just armor addons that would work, but would the individual components be lootable, or would the player just see the trojan horse when they looted the inventory? I guess object scripts could replace the equipped stuff with the misc. item upgrades upon death.
User avatar
marie breen
 
Posts: 3388
Joined: Thu Aug 03, 2006 4:50 am

Post » Sat May 28, 2011 8:59 am

I've created a token object that runs a script to randomly equip upgrades and add detonation tokens. At the moment I'm adding it via (simplified) ref walk, but I could also do it via leveled lists. As near as I can tell I'd have to create duplicates of all of the power armor leveled lists, add my token to the originals along with the duplicates, and check use all, to make sure both the armor and token were placed in the NPC's inventory. That would break merged patches wrt those leveled lists, in addition to being pretty tedious, so I'm hesitant to go that route.

While doing google searches related to leveled lists, I came across http://thenexusforums.com/index.php?showtopic=194738 thread. At one point pkleiss mentions a bug that seems to be resolved by setting the ref walk ref variable to "apple" every iteration. I was wondering what that bug was.
User avatar
alyssa ALYSSA
 
Posts: 3382
Joined: Mon Sep 25, 2006 8:36 pm

Post » Sat May 28, 2011 9:25 am

The "apple" bug occurs when the update line of a reference walking loop doesn't work properly, and your tracking variable is not updated correctly. Setting your tracking variable to an arbitrary value (I usually use Pencil01) before updating it will fix it. It's known as the "apple" bug because in Oblvion, where this bug was first encountered, the solution was to set the tracking variable to "Apple".

Cipscis
User avatar
Krista Belle Davis
 
Posts: 3405
Joined: Tue Aug 22, 2006 3:00 am

Post » Sat May 28, 2011 8:00 am

If you can include armor in the biped model form lists and not just armor addons that would work, but would the individual components be lootable, or would the player just see the trojan horse when they looted the inventory? I guess object scripts could replace the equipped stuff with the misc. item upgrades upon death.

Yeah sorry, forgot you were tring to keep these things lootable, and no.. only the carrier object would be an individual inventory item. Yeah you can add armor as well as armor addons to them lists.. I just did a hat and glasses armors along with leather glove addons to the same new armor no problem.
User avatar
Dalia
 
Posts: 3488
Joined: Mon Oct 23, 2006 12:29 pm

Post » Sat May 28, 2011 6:34 pm

I've discovered something recently regarding the AI interruption bug. It seems that you can add items to NPC inventories without a problem, but you can't equip them via a gamemode block without triggering the bug. However, if you equip them via an onadd block, no problems. So you can add tokens with scripts to NPCs, and do the inventory alteration and equipping via the script's onadd block.
User avatar
Danial Zachery
 
Posts: 3451
Joined: Fri Aug 24, 2007 5:41 am


Return to Fallout 3