MasterMagnus Posted March 7, 2016 Share Posted March 7, 2016 Hi, I'm new around here. This is probably jumping the gun before the creation kit comes out, but here goes. I got the SetActorFullName function to work with custom strings. You simply need to create a custom .esp file to store the strings using FO4edit. Using console commands (or in a bat file)setactorfullname 5000800Works great considering my .esp file is number 5 in the mod manager. Is there a way to know the number 'slot' my mod will occupy on other people's system? Or perhaps a way to address the specific ref_ID that is independent of the mods installed and their order? I'm all new to this, so maybe that's a simple question addressed elsewhere. I had seen several mentions of SetActorFullName in various places online with no actual solution, so I thought it would at least be a good bit of info to drop here. Link to comment Share on other sites More sharing options...
chucksteel Posted March 7, 2016 Share Posted March 7, 2016 Is there a way to know the number 'slot' my mod will occupy on other people's system? No, that will depend on where your mod falls in any given load order. Or perhaps a way to address the specific ref_ID that is independent of the mods installed and their order? When giving a console command for a specific mod refer to the mod index as "xx" so in your case you would tell people it is "xx00800". It is up to the mod user to determine where the mod falls in there load order to get you mod to work in this way. Link to comment Share on other sites More sharing options...
MasterMagnus Posted March 7, 2016 Author Share Posted March 7, 2016 Thanks for the reply! Link to comment Share on other sites More sharing options...
Reneer Posted March 9, 2016 Share Posted March 9, 2016 (edited) Hi, I'm new around here. This is probably jumping the gun before the creation kit comes out, but here goes. I got the SetActorFullName function to work with custom strings. You simply need to create a custom .esp file to store the strings using FO4edit. Using console commands (or in a bat file)setactorfullname 5000800Works great considering my .esp file is number 5 in the mod manager. Is there a way to know the number 'slot' my mod will occupy on other people's system? Or perhaps a way to address the specific ref_ID that is independent of the mods installed and their order? I'm all new to this, so maybe that's a simple question addressed elsewhere. I had seen several mentions of SetActorFullName in various places online with no actual solution, so I thought it would at least be a good bit of info to drop here.Yes, there is a way, but getting it to work with your batch file is probably not possible. To obtain a specific ref ID, you would want to use ObjectReference yourRef = Game.GetFormFromFile(0xFormID, "YourMod.esp") As ObjectReferenceAnother example: Actor yourActor = Game.GetFormFromFile(0xFormID, "YourMod.esp") As ActorGetFormFromFile requires only 6 parts of a regular 8-letter FormID, since it finds the first two (mod order) by looking at where the ESP file is in your load order. You can, if you want, supply the 8 character FormID though. That being said, I don't believe you can call SetActorFullName from a Papyrus script. But I haven't tried to see if it works yet either. You could, however, use that information to tell the mod-user the information to type within the console. Edited March 9, 2016 by Reneer Link to comment Share on other sites More sharing options...
registrator2000 Posted March 9, 2016 Share Posted March 9, 2016 Reneer has mentioned Game.GetFormFromFile, and that's great for referencing a Form that you haven't attached to your script via a Property - but it doesn't give you the load-order-corrected formID of your form. If you're trying to get the load-order-corrected formID of a mod-added form, you'd probably want Form.GetFormID() instead. GetFormID() is a function on the Form object, which all other objects inherit from. The result can then be cast to a string to be shown to the user as a Notification or Message Box. Message Property MyMessage Auto Debug.MessageBox(MyMessage.GetFormID())But you need to be aware that this results in an integer representation of the refid, NOT a hexadecimal number as you'd expect. I've written a Int to Hex conversion function for Papyrus as part of a larger (small) project for exposing several Papyrus-only functions as console commands. string[] Property HexDigits Auto string Function IntToHex(int num) string result = "" int rem While (num > 0) rem = num % 16 result = HexDigits[rem] + result num /= 16 EndWhile return result EndFunction You will want to make sure that HexDigits is defined as an Array of Strings ['0', '1', ..... 'A', 'B', ...'F'] for the valid characters in a hex number. If you pass the result of GetFormID() through IntToHex first, you'll get a nice hex-representation that users can enter verbatim into the console. Now, I'm not certain doing all this just to display the mod's loadorder is wise, because you could always ask users to find that out for themselves with help "messagename" 0 MESG and you could save yourself the trouble. But the option is certainly there. I don't know whether there is a Papyrus equivalent to set actors' names, but I believe actors in quest aliases can have their names changed - has been so since Skyrim. And now that you can have a RefCollectionAlias in Fallout 4, perhaps you could do something with that to safely manage a whole collection of renamed actors that you can "undo" the name-change for at any time. Link to comment Share on other sites More sharing options...
MasterMagnus Posted March 10, 2016 Author Share Posted March 10, 2016 (edited) Thank you both. I'm familiar with Hex and programming (from years ago), so I'm pretty sure I get what you're saying. I am typing things in the console line by line, or running a script via text file and the command: Bat ScriptFilename What I am doing that works fine:-Created an .esp as a string table, copying a MESG item.-Spawned a settler from console using Player.PlaceAtMe 1c2694-Close console (to spawn settler), open console, Click on Settler.-Run a script on the Settler to make them a companion: setconsolescopequest followers forcerefintoalias companion setplayerteammate 1 setrelationshiprank player 4-Change name using SetActorFullName 5000802 (one of the message strings I created with my .esp in the 05 load order slot). This all works fine. I've been travelling with two custom named companions (one companion, one dogmeatcompanion) from right outside vault 111 to currently level 17. Save games remember the custom name, they can be dismissed and brought back, still retain custom name. But ultimately I don't want to have an end user responsible for figuring out my mods number, clicking on the right thing, and making sure everything was correct before proceeding. I assume the load order issue is something the creation kit would address. Being able to address your mod from code, independent of the load order, seems like job number one to ease use of mods for the player. Defining a variable and storing a RefID seems like something I'm going to need for sure but I can't seem to get any of the code you provided to work for me. ObjectReference yourRef = Game.GetFormFromFile(0xFormID, "YourMod.esp") As ObjectReference Run from a script or typed from console I get error:Script Command ObjectReference not found. If I type Game.GetFormFromFile I get error:Script Command Game not found. If I type GetFormFromFile I get:Script Command GetFormFromFile not found. Message Property MyMessage Auto Debug.MessageBox(MyMessage.GetFormID()) string[] Property HexDigits Auto string Function IntToHex(int num) string result = "" int rem While (num > 0) rem = num % 16 result = HexDigits[rem] + result num /= 16 EndWhile return result EndFunction I get errors:Debug not foundMessageBox not found I couldn't even define a variable in the way you show. Is Papyrus code you're referring to run through the console (in Fallout4) by default (and/or scripts run from Bat "filename")? Do I need to include some other files to expose the functions you mention? I may not need to get too fancy, but I'd surely like to define and work with a variable if possible. **EDIT**Maybe I have to set my SetConsoleScopeQuest back to a 'larger scope'? Maybe SetConsoleScopeQuest Game? Edited March 10, 2016 by MasterMagnus Link to comment Share on other sites More sharing options...
Recommended Posts