FafnirTheDragon Posted December 19, 2012 Share Posted December 19, 2012 Is there a way to prevent player from taking an item equipped by a dead NPC, if specific conditions are met? I'm trying to figure a way to prevent player from looting power armors from dead paladins, if he doesn't have Power Armor Training perk. I thought about simply replacing them with unplayable versions, but it's not very elegant solution, more of a temporary fix. I'd also need dynamic script that scans area for dead bodies and dynamically replaces and equips unplayable versions. Perhaps there is a better way. Link to comment Share on other sites More sharing options...
Xaranth Posted December 19, 2012 Share Posted December 19, 2012 Use the container's onOpen block to check against player.hasPerk, and if that fails, have it call removeallTypedItems on itself against a formList of your PAs you want to restrict. Dump everything you don't want to obliterate into a temporary container, then dump the rest into a container you purge later, then call everything back from the temporary container. Link to comment Share on other sites More sharing options...
FafnirTheDragon Posted December 19, 2012 Author Share Posted December 19, 2012 (edited) Use the container's onOpen block to check against player.hasPerk, and if that fails, have it call removeallTypedItems on itself against a formList of your PAs you want to restrict. Dump everything you don't want to obliterate into a temporary container, then dump the rest into a container you purge later, then call everything back from the temporary container. I was trying to make this work not only for existing dead bodies, but even for situations, when player kills a paladin and then cannot loot his armor. To use onOpen I'd have to add script effects to every actor wearing power armor. This also wouldn't automatically work for mods adding actors wearing power armors. Edited December 19, 2012 by FafnirTheDragon Link to comment Share on other sites More sharing options...
Xaranth Posted December 19, 2012 Share Posted December 19, 2012 Mmm. You could use a token watching for MenuMode 1008, but how to get the container the player's interacting with.... No, I think the only way to do it would be to refWalk the cell. Sorry, but that's NVSE and I've just lost interest. :) Someday, I'll find a mod that uses NVSE that I can't live without, or I'll want to do something that can only be done with NVSE and then I'll start using it and figuring out how the new stuff works. Link to comment Share on other sites More sharing options...
FafnirTheDragon Posted December 19, 2012 Author Share Posted December 19, 2012 No, I think the only way to do it would be to refWalk the cell. Sorry, but that's NVSE and I've just lost interest. :) I know the general idea how it works, but not how to actually write code for it. Are there any tutorials or examples of a script scanning cells and putting specific objects in a form list? Link to comment Share on other sites More sharing options...
Xaranth Posted December 19, 2012 Share Posted December 19, 2012 http://www.cipscis.com/fallout/tutorials/loops.aspx#examples Link to comment Share on other sites More sharing options...
Gribbleshnibit8 Posted December 20, 2012 Share Posted December 20, 2012 You could take a look at Imp's Inventory Access mod. He does cell walking for adding tokens to actors. Since he provides no permission though, and hasn't been online in quite a long time, you won't be able to just use his scripts, but you can get the idea of how it works. Alternatively, take a look at my Nuka-Cola Enhanced mod, which has a ref walking script in it. With some modifications, and referencing Imp's script, you should be able to have it find NPCs instead of Nuka-Cola. What I would do in this case is have it walk the cell looking for dead actors wearing power armor, and have a token in their inventory that sets the "Unplayable" flag on their armor when the player looks at the inventory (menumode check), and sets it back again when they close the menu. That should do it, though without testing I can't guarantee that it will. Someday, I'll find a mod that uses NVSE that I can't live without, or I'll want to do something that can only be done with NVSE and then I'll start using it and figuring out how the new stuff works.I've never understood the aversion to the SEs. You can't tell me that a mod like this or this aren't really awesome (and impossible without NVSE) and something you wouldn't consider using. Ok, you could tell me, but I'm not sure I'd believe it. :no: Link to comment Share on other sites More sharing options...
Xaranth Posted December 20, 2012 Share Posted December 20, 2012 @Gribbleshnibit8 - Of course not. They're just not awesome enough to make me go through the bother of downloading and setting up NVSE for my game. ;) ...Although if you hadn't killed Jayne in Vera's description I might have been tempted. It's not so much an aversion to the SE as a 'I don't see a need to bother'. Also, I like my own work to be as accessible as possible. :) Meaning no DLC, external mods, or Extenders involved. And I would be so, sooooo tempted if I had NVSE available. Link to comment Share on other sites More sharing options...
luthienanarion Posted December 20, 2012 Share Posted December 20, 2012 (edited) What I would do in this case is have it walk the cell looking for dead actors wearing power armor, and have a token in their inventory that sets the "Unplayable" flag on their armor when the player looks at the inventory (menumode check), and sets it back again when they close the menu. That should do it, though without testing I can't guarantee that it will. Whoa, whoa, whoa... You can change the Playable flag in a script? Edit: WORDS. Edited December 20, 2012 by luthienanarion Link to comment Share on other sites More sharing options...
FafnirTheDragon Posted December 20, 2012 Author Share Posted December 20, 2012 You could take a look at Imp's Inventory Access mod. He does cell walking for adding tokens to actors. Since he provides no permission though, and hasn't been online in quite a long time, you won't be able to just use his scripts, but you can get the idea of how it works. Alternatively, take a look at my Nuka-Cola Enhanced mod, which has a ref walking script in it. With some modifications, and referencing Imp's script, you should be able to have it find NPCs instead of Nuka-Cola. Unfortunately, I don't have FO3, thus I cannot reference Imp's script. GetFirstRef 200 1 0 ;Actorsif (rObject.IsActor == 1) && (rObject.GetIsCreature != 1) && (rObject.GetIsDead == 1) && (rObject.GetDisabled != 1) && (rObject.GetIsID player != 1) Figuring this out wasn't that hard. I'm still not sure, if IsActor is necessary and if GetFirstRef also works on player. I also need to write elseif script with different conditions, putting actors in a form list - a different feature of my mod. However your script uses a container, instead of a form list - is there any difference? IIRC form lists are more tricky to use in loops, but I may be wrong. What I would do in this case is have it walk the cell looking for dead actors wearing power armor, and have a token in their inventory that sets the "Unplayable" flag on their armor when the player looks at the inventory (menumode check), and sets it back again when they close the menu. That should do it, though without testing I can't guarantee that it will. Do you mean Begin MenuMode 1008? Is it possible to actually modify an item with a script, while player is actively looking at it in inventory? I mean, if it's set as unplayable, will it simply disappear from item list?Also how to check in this block, if player is opening specific container? Link to comment Share on other sites More sharing options...
Recommended Posts