JustChill Posted June 19, 2018 Author Share Posted June 19, 2018 Unfortunately I had to get to an older ESP.Thankfully GECK makes backups (at least with the setup I use, don't know about Vanilla). https://steamcommunity.com/sharedfiles/filedetails/?id=1416520632 It was able to repair stuff without issues, so I rather be careful using LET. Addition:It works again. Still wondering how to include the modded weapon condition. :/ Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 19, 2018 Share Posted June 19, 2018 That doesn't make any sense. Paste your final script in here so I can look at it? I have to look over some functions for the weapon mods, but it should be relatively easy once they're identified. Link to comment Share on other sites More sharing options...
JustChill Posted June 19, 2018 Author Share Posted June 19, 2018 I've already changed it back into working condition, sorry. Furthermore it seems the issue why I cannot repair these items fully lies in the function I use. https://steamcommunity.com/sharedfiles/filedetails/?id=1416554601Here I've calculated the correct values.However they cannot get applied by using "SetItemRefCurrentHealth". Furthermore the bigger issue is that ALL 6 things are included, while only 4 of them have mods attached that increase the condition.So it seems my current solution looks for a weapon which ALLOWS a mod that increases the condition.It doesn't have to be attached what's bad. :sad: If vListItemCounts > 0 Let vInventoryItems := Player.GetInvRefsForItem vListItem ForEach vArrEntry <- vInventoryItems let vListItem := vArrEntry["value"] if vListItem.GetType == 40 if vListItem.GetWeaponItemModEffect 1 == 10 Set Button to vListItem.GetWeaponItemModValue1 1 Set Button to Button + vListItem.GetWeaponItemModValue2 1 printc "%n" vListItem endif if vListItem.GetWeaponItemModEffect 2 == 10 Set Button to Button + vListItem.GetWeaponItemModValue1 2 Set Button to Button + vListItem.GetWeaponItemModValue2 2 printc "%n" vListItem endif if vListItem.GetWeaponItemModEffect 3 == 10 Set Button to Button + vListItem.GetWeaponItemModValue1 3 Set Button to Button + vListItem.GetWeaponItemModValue2 3 printc "%n" vListItem endif Set Button to Button + vListItem.GetBaseHealth If vListItem.GetItemRefCurrentHealth != Button vListItem.SetItemRefCurrentHealth Button endif printc "Calculated: %.2f" Button Set Button to vListItem.GetBaseHealth printc "Base: %.2f" Button Set Button to 0[...] Link to comment Share on other sites More sharing options...
JustChill Posted June 19, 2018 Author Share Posted June 19, 2018 Alright, I used "SetCurrentHealth" instead of "SetItemRefCurrentHealth" which works.Items are now fully repaired, even when modded. :D It seems that it is not possible to go over the maximum (as also the items without a mod got repaired), but I rather don't want to add some extra value there, but check if a weapon mod is even applied.Simply as I don't want to give the engine any reason to be upset with values exceeding a maximum amount. ^^ Guess that should be possible... Oh, I just got into a "broken" backup of the whole script: scn GSFarmWashmachineSCRIPT short Button short GetNotWashed short WashCount array_var vInventoryItems array_var vArrEntry begin OnActivate player if GetStage GSFarmLightQuest < 100 ShowMessage GSFarmWashmachineNoPower elseif GetStage GSFarmWaterQuest < 100 ShowMessage GSFarmWashmachineNoWater elseif Player.GetItemCount GSfarmClthListDirtyWashable == 0 ShowMessage GSFarmNoStorage elseif Player.GetItemCount GSfarmClthListDirtyWashable > 10 showmessage GSFarmWashmachineONLY10 Let GetNotWashed := 1 elseif Player.GetItemCount GSfarmClthListDirtyWashable <= 10 if WashCount == 0 Let WashCount := Player.GetItemCount GSfarmClthListDirtyWashable endif if player.getitemcount AbraxoCleaner + Player.GetItemCount BoxDetergent < WashCount showmessage GSFarmWashmachineNoCleaner Let GetNotWashed := 1 else ShowMessage GSFarmWashmachineUSE endif endif end BEGIN GameMode Short ListIndexCount Short vListItemCounts Ref vListItem Let Button := GetButtonPressed if (Button == 0 && GetNotWashed == 0) ;--->"The script went into the block and even removed detergent, but didn't want to repair." Label 1 ;--->"Instead the error as shown above appeared. :/" Let vListItem := ListGetNthForm GSfarmClthListDirtyWashable ListIndexCount ;--->"I still was able to hear the sound effect." Let vListItemCounts := Player.GetItemCount vListItem if vListItem == OutfitPrewarCasualwear2Dirty If vListItemCounts > 0 Player.RemoveItem OutfitPrewarCasualwear2Dirty vListItemCounts 1 Player.AddItem OutfitPrewarCasualwear2 vListItemCounts 1 endif elseif vListItem == OutfitPrewarCasualwearDirty If vListItemCounts > 0 Player.RemoveItem OutfitPrewarCasualwearDirty vListItemCounts 1 Player.AddItem OutfitPrewarCasualwear vListItemCounts 1 endif elseif vListItem == OutfitPrewarSpringDirty If vListItemCounts > 0 Player.RemoveItem OutfitPrewarSpringDirty vListItemCounts 1 Player.AddItem OutfitPrewarSpring vListItemCounts 1 endif elseif vListItem == OutfitPrewarSpring2Dirty If vListItemCounts > 0 Player.RemoveItem OutfitPrewarSpring2Dirty vListItemCounts 1 Player.AddItem OutfitPrewarSpring2 vListItemCounts 1 endif elseif vListItem == HatPartyDestroyed if vListItemCounts > 0 Player.RemoveItem HatPartyDestroyed vListItemCounts 1 Player.AddItem HatParty vListItemCounts 1 endif else If vListItemCounts > 0 let vInventoryItems := Player.GetInvRefsForItem vListItem ForEach vArrEntry <- vInventoryItems let vListItem := vArrEntry["value"] if vListItem.GetType == 40 if vListItem.GetWeaponItemModEffect 1 == 10 Let Button := vListItem.GetWeaponItemModValue1 1 Let Button += vListItem.GetWeaponItemModValue2 1 endif if vListItem.GetWeaponItemModEffect 2 == 10 Let Button += vListItem.GetWeaponItemModValue1 2 Let Button += vListItem.GetWeaponItemModValue2 2 endif if vListItem.GetWeaponItemModEffect 3 == 10 Let Button += vListItem.GetWeaponItemModValue1 3 Let Button += vListItem.GetWeaponItemModValue2 3 endif Let Button += vListItem.GetBaseHealth If vListItem.GetItemRefCurrentHealth != Button vListItem.SetItemRefCurrentHealth Button endif printc "%.2f" Button Let Button := 0 else if vListItem.GetItemRefCurrentHealth != vListItem.GetBaseHealth Let Button := vListItem.GetBaseHealth vListItem.SetItemRefCurrentHealth Button Let Button := 0 endif endif Loop let vArrEntry := Ar_Null let vInventoryItems := Ar_Null endif endif Let ListIndexCount := ListIndexCount + 1 if ListIndexCount < ListGetCount GSfarmClthListDirtyWashable Goto 1 endif PlaySound GSFarmhouseWashmachineWASHING 1 showmessage GSFarmWashmachineWASH short GettingCount if player.Getitemcount BoxDetergent >= WashCount player.removeitem BoxDetergent WashCount elseif player.GetItemcount AbraxoCleaner >= WashCount player.removeitem AbraxoCleaner WashCount elseif Player.GetItemCount AbraxoCleaner + Player.GetItemCount BoxDetergent > WashCount if Player.GetItemCount BoxDetergent > Player.GetItemCount AbraxoCleaner Let GettingCount := WashCount - Player.GetItemCount AbraxoCleaner Player.RemoveItem BoxDetergent GettingCount Let GettingCount := Player.GetItemCount AbraxoCleaner Player.RemoveItem AbraxoCleaner GettingCount else Let GettingCount := WashCount - Player.GetItemCount BoxDetergent Player.RemoveItem AbraxoCleaner GettingCount Let GettingCount := Player.GetItemCount BoxDetergent Player.RemoveItem BoxDetergent GettingCount endif elseif player.Getitemcount AbraxoCleaner + Player.getitemcount BoxDetergent == WashCount Let GettingCount := Player.Getitemcount abraxocleaner player.removeitem abraxocleaner gettingcount Let gettingcount := player.getitemcount boxdetergent player.removeitem boxdetergent gettingcount endif rewardXP WashCount endif Let GetNotWashed := 0 Let WashCount := 0 END It seems you helped me with my laundry. :DDon't know why this one did not want to work, but well the current one does so I rather stick to it. The whole thing is from a nice farmhouse in Goodsprings. I also have a translation of that one from my instructor, yet it is at the same place where an AWOP building is, so I completely moved it back (at the place of the broken house aside the school). And I also want to enhance some features which got added from the translated file.Like the washing machine.It allows to wash boxing gloves and tapes, which repairs them fully (any piece of cloth needs one Abraxo or Detergent. Yet in the older functionality, the script simply replaced the items. So if someone has WMX and mods the boxing gloves all mods would be gone.I wanted to avoid that with some fancy scripting. :wink: Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 19, 2018 Share Posted June 19, 2018 My guess is that similar to health restored to an actor via a Stimpak, the excess of the value is discarded. But you should be able to check weapon health afterwards in the console to confirm. Don't bother with Let for this script as it's very long, but in future, I would write all my scripts with Let. What made this one not work was probably a tiny thing that you'd catch as you wrote it if you were writing it from scratch. Here and there I've needed parentheses on things that shouldn't have needed them; could be something like that. Your indenting is a bit off starting near the middle as well, so it's possible you thought something lined up where it didn't. Well, good work. Always nice to expand a mod to be compatible with everything. I strive to do that with everything I make. Link to comment Share on other sites More sharing options...
JustChill Posted June 19, 2018 Author Share Posted June 19, 2018 I strive to do that with everything I make.It's a neverending story. ^^ I rather make it compatible to mods I like by myself. XDEverything else is just impossible. Even though New Vegas might not be that successful as F3 or F4, it still has a ton of mods. *faints* Not to mention DLCs. It was actually an issue for me to figure out how to implement DLC plants. XDI simply made an own instance of the plants for the farmhouse, that refer to the DLC meshes.As these are initially disabled a player who doesn't own HH or OWB simply doesn't have the options to plant "Cave Funugs", "Sacred Datura Plant" and "Mutant Cave Fungus".It was very interesting to find out about the "conditions" for messages and the buttons that appear.Even if the conditions are not visible in my GECK when set, I still can check them in FNVEdit if they're correct. I actually programmed my message boxes til yet, but that's pretty convenient and easy to translate.And they surely work and don't appear for players without the DLC. I even tried and planted them, exit the game and disabled both DLCs then restarted.Missing meshes symbol. ^^I've added a harsh "Disable" query for that case, even though why would somebody be that retarded to load the mod with DLCs just to disable them (except myself of course XD)?Well at least I am not planing to build a "recover function" for such a case. :P There is still no master necessary for the plugin except "FalloutNV.esm" and I am planning to keep it like that. Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 19, 2018 Share Posted June 19, 2018 Always a struggle, but I tend to find it worth it. I made a script that adds an effect to the Antivenom item at run-time (thus avoiding conflicts) in order to heal the player from my custom poison. Well, what about Datura Antivenom and anything mod-added? Had to do a script that runs at the beginning of the game and grabs any item with the vanilla Antivenom effect or the Honest Hearts one, and add my effect to them. This required using GetFormFromMod for finding items with the HH effect. If you like compatibility and you're not familiar with that function, you'd want to get familiar with it. I noticed some other stuff you may want to work on in your scripting. If you're a beginner, I wouldn't know it, but some of your formatting isn't what I'm used to. First, I would declare all variables at the start of the script. Second, I would use the normal prefixes to make them recognisable as what type of variable they are (r for ref, i for int, a for array, and so on). Third, if you just want to check that a variable is not 0, you can use if rItem ;or if iCount ;et ceterawith no operator or values to check against, which checks it like a bool, which returns true if the value isn't 0. And fourth, depending on the situation, functions like MessageBoxExAlt or MessageExAlt tend to be the easiest ways to do messages, and the best for performance. If you need to hide or show specific buttons based on conditions and there's a lot of buttons, the vanilla message boxes seem to be better for now, but for everything else, it's easier to use these newer functions. Link to comment Share on other sites More sharing options...
JustChill Posted June 19, 2018 Author Share Posted June 19, 2018 Oh, well I am not changing much on a mod which I've not made myself. Actually I think the code of my light mod is way more horrible. ^^Especially as of the comments, which I was too lazy to remove afterwards. XD Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 19, 2018 Share Posted June 19, 2018 I see, you're saying most of this script isn't yours. Got it. Should have realised that. I meant it more for future scripts anyway. Link to comment Share on other sites More sharing options...
JustChill Posted June 20, 2018 Author Share Posted June 20, 2018 Ok.I hope I'll think about the layout when I am into creating weird stuff. ^^ Finally, I got it with the additional weapon health. Even though it was tricky to check if the correct mod is applied."GetWeaponRefModFlags" did the trick, yet I was totally unaware about how this bits work.1 = Mod 12 = Mod 24 = Mod 3I checked for 2, but as more mods can be applied it was some sort of riddle to figure it out.Yet the flag actually is clever. So if only 1 mod is applied the value can be 1, 2 or 4.If 2 mods are applied the value can be 3, 5 or 6.If all 3 mods are applied the value is 7. If vListItemCounts > 0 Let vInventoryItems := Player.GetInvRefsForItem vListItem ForEach vArrEntry <- vInventoryItems let vListItem := vArrEntry["value"] if vListItem.GetType == 40 if vListItem.GetWeaponItemModEffect 1 == 10 ;=>"10 stands for a weapon mod that increases weapon condition." if vListItem.GetWeaponRefModFlags == 1 || vListItem.GetWeaponRefModFlags == 3 || vListItem.GetWeaponRefModFlags == 5 || vListItem.GetWeaponRefModFlags == 7 Set Button to vListItem.GetWeaponItemModValue1 1 Set Button to Button + vListItem.GetWeaponItemModValue2 1 endif endif if vListItem.GetWeaponItemModEffect 2 == 10 if vListItem.GetWeaponRefModFlags == 2 || vListItem.GetWeaponRefModFlags == 3 || vListItem.GetWeaponRefModFlags == 6 || vListItem.GetWeaponRefModFlags == 7 Set Button to Button + vListItem.GetWeaponItemModValue1 2 Set Button to Button + vListItem.GetWeaponItemModValue2 2 endif endif if vListItem.GetWeaponItemModEffect 3 == 10 if vListItem.GetWeaponRefModFlags == 4 || vListItem.GetWeaponRefModFlags == 5 || vListItem.GetWeaponRefModFlags == 6 || vListItem.GetWeaponRefModFlags == 7 Set Button to Button + vListItem.GetWeaponItemModValue1 3 Set Button to Button + vListItem.GetWeaponItemModValue2 3 endif endif Set Button to Button + vListItem.GetBaseHealth If vListItem.GetItemRefCurrentHealth < Button vListItem.SetCurrentHealth Button endif Set Button to -1 So now, the additional weapon health only gets applied, when the respective mod which increases the durability is installed.It was useless as boxing tapes and boxing gloves have both the mod which increases condition on slot 2.My "solution" is global and should work for any weapon which adds a mod that increases condition (regardless at which slots that weapon mod is applied).So all weapons should be fully repaired without giving weapons that don't have a condition+ mod installed, more health than allowed.Even though it seem not to have a bad impact by doing so, I rather think it's more clean to only give allowed values. I may try to LETify all scripts in this mod again. Hopefully this time I don't break any functionality.Maybe it was really a minor mistake. Otherwise I'll post the issue again.Pretty weird that a better function to set some variables or calculate stuff would have issues than the older clumsy one. First, I would declare all variables at the start of the script.But coming back to this, who told you that this is necessary?Declaring a variable inside a block make it to a "local variable".If you DON'T plan to use the variable outside the block it's absolutely fine to declare it inside, instead of making it global.Declaring variables outside the block make it "public" so they can be used in any block of the script. A local variable can be placed anywhere within the script code, it only needs to be declared before the first command that uses it. Usually you declare all variables on top of the script, though, to improve the script's readability.https://geckwiki.com/index.php/Declaring_Variables Ohhhhh, so that's the only benefit of declaring global variables, when they are actually not needed?Well, I've to be able to read and understand the scripts I work with.And as long as I do that, there shouldn't be any issue. :smile: You don't have to necessarily take over the layout or way to do things like someone else when it also works by your way. :wink: Link to comment Share on other sites More sharing options...
Recommended Posts