PsychorGames Posted February 15, 2017 Posted February 15, 2017 Say I want all people in NCRFactionNV to have an Anti-material rifle in their inventories. Besides writing the quest script to initiate the mod on game start, what will I need to do to make this work?
PushTheWinButton Posted February 15, 2017 Posted February 15, 2017 Depends. Are you wanting to add them real-time, or when the game starts? Real-time is probably the less performance intensive. You'll have to utilise NVSE, but you can also use Lutana and JIP to simplify stuff. Here's a real-time example that just used NVSE (haven't tested):scn pwbAMRifleAdderQuestSCRIPT ; Adds Anti-Materiel Rifles to NCR faction members as the player explores array_var aEntry array_var aNPCs ref rCell ref rLastCell ref rNPC begin GameMode ; Check if player has moved cell let rCell := PlayerREF.GetParentCell if (rCell == rLastCell) return endif ; Save current cell let rLastCell := rCell ; Get all nearby NPCs let aNPCs := GetRefs 42 -1 ; Check array isn't empty if eval (ar_Size aNPCs) < 1 let aNPCs := ar_Null return endif ; Loop through the array of NPCs foreach (aEntry <- aNPCs) let rNPC := *aEntry if (IsFormValid rNPC) if (rNPC.GetDead == 0) && (rNPC.GetInFaction NCRFactionNV) && (rNPC.GetItemCount WeapNVAntiMaterielRifle == 0) ;do the stuff endif endif loop let aNPCs := ar_Null end
PsychorGames Posted February 16, 2017 Author Posted February 16, 2017 What's the difference between items placed in their inventories on in real time vs game start? The result is the same isn't it? The reason I ask is because I'm trying to put an item into everyone's inventory that I will add a script that will make it so that they are hireable (via a dialogue option) Oh and thanks for replying!
Mktavish Posted February 16, 2017 Posted February 16, 2017 On 2/16/2017 at 3:38 AM, PsychorGames said: because I'm trying to put an item into everyone's inventory that I will add a script that will make it so that they are hireable (via a dialogue option) Oh and thanks for replying! WoW ... that is some good thinkin
PsychorGames Posted February 16, 2017 Author Posted February 16, 2017 Well it wasn't my idea. I was snooping around other people's mods with the Geck and am now adapting their strategy. Can this be done without NVSE?
PushTheWinButton Posted February 16, 2017 Posted February 16, 2017 If you do it on game start then you'll have to work with base forms, not references, which means you'll have to use BaseAddItem from Lutana NVSE, and either loop through actors' base factions to check if any of them == NCRFactionNV or you'll have to make a form list of such actors in the GECK beforehand. And no, this isn't possible without NVSE. This isn't a case of "NCRFactionNV.AddItemToAll" if that's what you were thinking. Why do you need to add an item to them? Can't you just make a dialogue option with the (GetInFaction NCRFactionNV) condition and have the result script do what you want?
PsychorGames Posted February 16, 2017 Author Posted February 16, 2017 (edited) I will try that when I get home . Forgive me, I'm still pretty new to modding. I figured if the other NPC-recruiting mods didn't require NVSE, this task wouldn't require it either. But the difference is that they put the object into every NPC somehow whereas I'm trying to put the object into NPCs of specific factions. Edited February 16, 2017 by PsychorGames
PsychorGames Posted February 16, 2017 Author Posted February 16, 2017 (edited) "Why do you need to add an item to them? Can't you just make a dialogue option with the (GetInFaction NCRFactionNV) condition and have the result script do what you want?" Hmm, maybe that's what the original modders did to make their hiring mod work, and I'm simply misinterpreting what they did thinking that they added an object to all NPCs via script. Edited February 16, 2017 by PsychorGames
Recommended Posts