kucingkucing Posted February 24, 2020 Share Posted February 24, 2020 hi, I like to ask some question:1.how do I create some variable that can be saved or loaded to/from save file?2.how to get armor stat from a piece of armor, I succeed get from steel damage or silver damage like this: exec function GetSteelDamage() { var item : SItemUniqueId; thePlayer.inv.GetItemEquippedOnSlot(EES_SteelSword, item); theGame.GetGuiManager().ShowNotification( GetWitcherPlayer().GetTotalWeaponDamage(item , theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId() )); } but from armor, I studied the code and recreated it and I failed to get it, this the code : exec function armor() { var item : SItemUniqueId; thePlayer.inv.GetItemEquippedOnSlot(EES_Armor, item); theGame.GetGuiManager().ShowNotification( CalculateAttributeValue(GetWitcherPlayer().inv.GetItemAttributeValue(item, theGame.params.ARMOR_VALUE_NAME))); } the compile succeeds, but the result always 0 (zero),can someone explain how to get armor stat from a piece of armor?, or/and get crossbow damage (get crossbow base stat & bonus + xxx % Attack power). please help me, with any guide, link, google keyword, or anything, I will appreciate it, thank you Link to comment Share on other sites More sharing options...
KoalaNalle Posted February 27, 2020 Share Posted February 27, 2020 There are two methods that are most easy. 1) Use facts, addfact can add any type of string in it, you can delete facts and the query format can return values from none existing to 1...n.2) Make a container that is invisible or hidden. It can contain specific information (entities) and would be saved. However this would be mostly good for world dependant things as the container would be in that specific world. Link to comment Share on other sites More sharing options...
Partoutatix Posted February 28, 2020 Share Posted February 28, 2020 (edited) 1) You can also add savegame-persistent modifiers to specific items in an inventory: import final function GetItemModifierFloat( itemId : SItemUniqueId, modName : name, optional defValue : float ) : float; import final function SetItemModifierFloat( itemId : SItemUniqueId, modName : name, val : float); import final function GetItemModifierInt ( itemId : SItemUniqueId, modName : name, optional defValue : int ) : int; import final function SetItemModifierInt ( itemId : SItemUniqueId, modName : name, val : int );Something like inv.SetItemModifierInt(itemId, 'sex', 69); 2) Try saving the result of GetWitcherPlayer().inv.GetItemAttributeValue(item, theGame.params.ARMOR_VALUE_NAME) to a SAbilityAttributeValue variable and check all its members: import struct SAbilityAttributeValue { import saved var valueAdditive : float; import saved var valueMultiplicative : float; import saved var valueBase : float; } For xbow + xxx% attack power, example from geralt level scales: function ModGeraltLevelScalesGetCrossbowAttackPowerAsInteger(inv : CInventoryComponent, itemId : SItemUniqueId): int { var stat : int; var attributeValue : SAbilityAttributeValue; attributeValue = inv.GetItemAttributeValue(itemId, 'attack_power'); stat = RoundMath(attributeValue.valueMultiplicative*100); return stat; }Instead of debugging with ingame prints, in the long run you might be better off using witcher script studio, connecting it to a running instance of the game (check a tut, place its .exe in the game's \x64 folder, you need to add a couple of arguments to the game's shortcut, ex: "C:\GOG Games\The Witcher 3 Wild Hunt GOTY\bin\x64\witcher3.exe" -net -debugscripts" , switch the scriptstudio option from "editor" to "game" and run the game in windowed mode, the little yellow or red bug icon should turn green once it's connected, if it doesn't then keep toggling "editor"/"game" and pressing the bug icon until it works), reload workspace scripts whenever you make a change to your mod's scripts and use breakpoints for debugging to be able to easily check the values of all local variables using the "Locals" tab. Edited February 29, 2020 by Partoutatix Link to comment Share on other sites More sharing options...
kucingkucing Posted March 30, 2020 Author Share Posted March 30, 2020 hey, thanks for the reply, sorry I just reply it now, I just read it now,because nobody reply for two days, I assume this post will not get any reply,at that time I try to method try and error, and succeed,the result is this mod :for question number 1 :https://www.nexusmods.com/witcher3/mods/4391and for question number 2 :https://www.nexusmods.com/witcher3/mods/4482 after I read both replies, the texts are quite long, I quite regret not read this post earlier,to be honest, I just newbie modder, @Partoutatix, I always wonder: import final function what import do, do it import function from other ws files?then final, what final do?another topic is, I try script studio once before, cannot create a new mod,and everybody in the mod page complain about it, so i not using it again. and once again thanks for your replies Link to comment Share on other sites More sharing options...
Recommended Posts