Tutorial on how to make a mod use console commands?

Post » Tue Sep 22, 2015 10:05 am

I'm having a bit of trouble finding a tutorial for this haha. I noticed that when you set an ini value and use 'saveini' from in the game, it doesn't actually write the file, so basically you're just updating the value for the session. A mod would kinda fit that well, as removing the mod would revert the ini value back to default.

I'm totally new to the creation kit, and thought this would be something easy to start with, but surprisngly I can't find anything, not even on how to make a god mod that'd use 'tgm' when a save is loaded (which I would have thought might be one of the easiest things to do).

If it is possible, how would I go about doing it?

With a bit of searching I came across the Utility Script SetINI functions (eg. http://www.creationkit.com/SetINIBool_-_Utility), but I imagine that'd actually write it to the file and I just want it as a session thing, plus typing the actual console commands as opposed to learning the language would be a bit easier :smile:

User avatar
kelly thomson
 
Posts: 3380
Joined: Thu Jun 22, 2006 12:18 pm

Post » Tue Sep 22, 2015 3:27 pm

Console commands are a debugging tool and you can't use the CK/scripting to use them. The function there u posted even says that it doesn't write to file: "This function can only change the values of pre-defined ini settings in Skyrim.ini and SkyrimPrefs.ini and only during the current game session. It cannot create new settings and does not save them to an ini file."

Scripting isn't really that hard, especially for something just like this. It just depends on when you want the ini setting to change.

User avatar
Elizabeth Falvey
 
Posts: 3347
Joined: Fri Oct 26, 2007 1:37 am

Post » Tue Sep 22, 2015 12:06 pm

Ah thanks for the reply, I skimmed over that bit haha. I presume it'd be fairly easy just getting a script to run once as skyrim is loaded, so I'll check out a few basic tutorials :)

User avatar
hannaH
 
Posts: 3513
Joined: Tue Aug 15, 2006 4:50 am

Post » Tue Sep 22, 2015 5:33 pm

Something like this is what you need, but this example was more complicated than I remember it...

http://www.creationkit.com/Complete_Example_Scripts#Maintenance.2Fupdate_code_which_runs_once_per_save_load_and_shows_a_message_when_a_mod_is_updated_or_first_loaded

You essentially set up a quest which automatically starts upon install. You create a reference alias which points to the player. You have a script on the quest and the reference alias and you scripts would be something like this:

Event OnInit() ;this script is needed as it fires upon the first load of the mod    Utility.SetINIBool("bRandomSetting:CoolSettings", true)EndEvent
Scriptname _test_testscript extends ReferenceAliasEvent OnPlayerLoadGame() ;this script will fire for every load game AFTER the mod has been installed    Utility.SetINIBool("bRandomSetting:CoolSettings", true)EndEvent

Edit: Slightly less cluttered link: http://www.creationkit.com/OnPlayerLoadGame_-_Actor

User avatar
Rude Gurl
 
Posts: 3425
Joined: Wed Aug 08, 2007 9:17 am

Post » Tue Sep 22, 2015 5:08 pm

Thanks, I kinda got something similar, but then I couldn't get any compiling to work so ended up going to bed ;p

I followed the notepad++ tutorial, changed the paths in the bat file and everything, but it says failed if I try compile anything inside the CK, and comes up with a load of 'unknown type x' errors if I do it through notepad++ (this is including trying it on existing scripts too), I don't suppose you know what might be wrong?

One thing though, if I do create a quest, won't it write itself into the save permenantly?

User avatar
Josee Leach
 
Posts: 3371
Joined: Tue Dec 26, 2006 10:50 pm

Post » Tue Sep 22, 2015 6:32 pm

If you're having trouble compiling with the CK, post what you got here. For some reason on my end, I can't compile anything, although it's been several months and I think there's been a CK update so maybe that's causing problems?

As for the quest, it will permanently write itself to the save file, but if the mod is removed the scripts will no longer run to update your INI setting. There may be some "garbage" left behind if a user uninstalls the mod, but that will happen with any mod with scripts. In your case, there should be no real effect at all.

User avatar
Alexander Horton
 
Posts: 3318
Joined: Thu Oct 11, 2007 9:19 pm

Post » Tue Sep 22, 2015 1:13 pm

Actually, scratch the whole script idea and try this first...

http://www.creationkit.com/INI_files#Mod_Defined

User avatar
Rik Douglas
 
Posts: 3385
Joined: Sat Jul 07, 2007 1:40 pm

Post » Tue Sep 22, 2015 6:46 pm

Yeah I temporarily messed up Skyrim with saveini, turns out it'll save an ini in the data folder with some random mods name, and it's such a pain to find the cause of problems lol, since you don't know it's actually done that ;p

Anyway yeah thanks, I ended up doing that a few hours ago haha, I noticed 'npcs use arrows' used an ini with an empty esp file, so I tried the same thing and it worked :)

User avatar
Killer McCracken
 
Posts: 3456
Joined: Wed Feb 14, 2007 9:57 pm


Return to V - Skyrim