jonpetro Posted October 2, 2011 Share Posted October 2, 2011 Here's the long and short of it, and I suspect I'm going about this entirely wrong... I am writing a mod that checks all existing NPC spawns when the player enters a cell, and will at some point randomly requip them with custom gear. So far I've set up a game mode block that stores the current cell in a variable after the first iteration, so I can skip multiple passes on the same cell. Yes, this seems silly and convoluted, but to be honest, the G.E.C.K. scripting format seems pretty silly and convoluted, so I'm working with what I got. Anyhow. This is all technically well and good, but it brings me to my second point. I don't want to re-quip NPC's every single time the player enters a cell, just the first time (until the NPC respawns). This means I either need to somehow mark the cell to be skipped until the re-spawn timer kicks, or the modified NPC's need to be marked themselves, either through a custom boolean variable or some kind of workaround. I was hoping someone with a better understanding of the GECK could offer up some insight, since I've just started playing with it. Thanks. Link to comment Share on other sites More sharing options...
rickerhk Posted October 2, 2011 Share Posted October 2, 2011 You can mark the actors by using SetActorValue, and using one of the user defined values: http://geck.bethsoft.com/index.php/ActorValue#User_Defined_Actor_Values I'm assuming you are doing a Ref walk or an actor effect to scan the cell. if (actorREF.GetAV Variable04 == 123) else ;Do stuff to inventory actorREF.SetAV Variable04 123 endif One thing about changing actor inventory in gamemode:1. Using additem the first time will probably glitch their weapon (invisible or unable to equip)2. Using additem a second time, but waiting 30 frames or so, will unglitch them. Now on the second additem, you could just as easily add an invisible armor token to mark and unglitch them instead of using Variable04 Link to comment Share on other sites More sharing options...
jonpetro Posted October 3, 2011 Author Share Posted October 3, 2011 The actor values seem to work as you described -- thanks for the quick response! You were also correct about the weapon glitching/becoming invisible upon the additem call. This poses a bit of a problem, so I'm hoping for some insight.. To better explain my intent, the mod will essentially strip all "normal" NPC's naked when a player enters a cell, then re-equip them with random gear based on their normal load, stats, faction, abilities, etc. It will then randomize certain item properties (magazine size, rate of fire, sway, etc.) or possibly apply small stat bonuses or penalties, in an effort to add a bit of variety and excitement to item drops. The problem is, the transition is already far from seamless - When you enter a new cell within visual range of NPC's, you will see them stripped and re-equipped, and of course the newly added weapon ends up glitched. Anyhow, any suggestions on how to make the transition a bit more elegant, or at least remedy the weapon glitch expediently, would be much appreciated. Thanks! Regards,Jon Link to comment Share on other sites More sharing options...
rickerhk Posted October 4, 2011 Share Posted October 4, 2011 After the first loop where you re-equip the actors, Wait 20-30 frames (just a suggestion, less frames might be ok), then run another ref-walk pass to check for glitched weapons. A weapon will never have 100% health - unless it's glitched. Just check every actor and if their weapon health is 100%, then force them to re-evaluate their inventory:set fWeaponHealth to ActorREF.GetWeaponHealthPerc if (fWeaponHealth == 100) ;glitched ActorREF.AddItem AmmoMicroFusionCell 1 ;Force re-evaluate ActorREF.RemoveItem AmmoMicroFusionCell 1 endif I don't have a good suggestion on how to hide all this from the player. Maybe skip the actors that the player can see.if (Player.GetLOS ActorREF) ;skip this actor Link to comment Share on other sites More sharing options...
jonpetro Posted October 4, 2011 Author Share Posted October 4, 2011 After the first loop where you re-equip the actors, Wait 20-30 frames (just a suggestion, less frames might be ok), then run another ref-walk pass to check for glitched weapons. A weapon will never have 100% health - unless it's glitched. Just check every actor and if their weapon health is 100%, then force them to re-evaluate their inventory:set fWeaponHealth to ActorREF.GetWeaponHealthPerc if (fWeaponHealth == 100) ;glitched ActorREF.AddItem AmmoMicroFusionCell 1 ;Force re-evaluate ActorREF.RemoveItem AmmoMicroFusionCell 1 endif I don't have a good suggestion on how to hide all this from the player. Maybe skip the actors that the player can see.if (Player.GetLOS ActorREF) ;skip this actor Great suggestions, kudos mate. Link to comment Share on other sites More sharing options...
jonpetro Posted October 6, 2011 Author Share Posted October 6, 2011 Mod is coming along nicely. The equip routines are working well, and the resulting encounters are getting pretty interesting. A question though - How would I go about skipping "Special" npc's. For example - quest-related npc's, or the tied-up prisoners in the legion camps (silly to have them spawn with full equipment), or just npc's that should really have a set, unvarying appearance? Is there a simple universal way to lump all the "cannon fodder" npc's into on group? Ideally I just want "combat-oriented" npc's to receive random gear, though I will take steps to make sure faction appears remains true to the theme of the game. Any suggestions? Link to comment Share on other sites More sharing options...
rickerhk Posted October 7, 2011 Share Posted October 7, 2011 Certain factions are one way. Another way is to add special vanilla actors to a formlist and check against that, after converting the REF to a base object: set rBaseObject to GetBaseObject rActorREF set iIndex to ListGetFormIndex MYSpecialActorList rBaseObject if iIndex > -1 ;skip actor Link to comment Share on other sites More sharing options...
Recommended Posts