A Hat in Time

A Hat in Time

Not enough ratings
Writing to an .Ini file for Configs
By Crash
This Guide will help teach you how to add configuration settings to an a hat in time mod file
   
Award
Favorite
Favorited
Unfavorite
What is the Ini file
The Ini file, called Modinfo.ini, is a file that is automatically created when you make a new mod, It stores basic info about the mod, The name, The Creator "Usually stated as me", and the description.

This file can be opened using any kind of text editor.

[Info]
States what the info of the mod is
name
Refers to the mod name
author
Who made it
description
Mod description
version
What version is the mod and how many updates have been released for it
is_cheat
false(Not exactly sure what this one does but i belive it refers to the Death wishes and being able to use the dev console, it automaticly sets to false)
icon
Refers to the name of the icon file, usually larger than 100*100 and needs to be a square
modclass
Refers to what file is the file that extends GameMod, and does whatever the player has defined the class to do


All these files are automatically added and don't need to be messed with alot
Editing the Ini file
Now that we know WHAT the ini file is and what it does we need to know how to edit this,
THE EDITOR MUST BE CLOSED , The file(Ini) must be open and the editor must not be opened. If the editor is for some reason, the open file will not save and you will need to rewrite the ini file again.
There are many options on what we can do in this file,
Tags
Tags are what appear in the workshop. They tell the user what the mod contains, some examples below:

[Tags]
What they do (If 1 then true, if 0 then false)
HasHat
Does the player attain a hat
AutoGiveItems
Does it gave the player the items on mod loaded
HasSkin
Does it add a dye or material skin
HasBadge
Does the player get a badge
MapType
This one is different from the rest, It explains how many time peices are in the map and what kind of map it is (Purple rift, Blue rift, Multi time peice level)


If a tag is = 0 then that means that it doesnt have that tag, if it is one then that means that the tag is true.

These tags are auto set so there is no need to edit them.
Configs
Configs can do a variety of things but they require user input.
Here is an example of one from my playable conductor mod,





[Configs]
THIS IS ONLY NEEDED ONCE The [] (Square Brackets)Simply imply that the user is defining a config here
+Config=playerSet(Playerset can be anything, Just make sure you define it correctly later)
(This is important, I'll explain later on)
Name="Costume Switch"
(This is the name that appears in the mod config in the game)
Description="Toggle between Conductor Costume and in-game costumes!"
(Description of the Config)
Default=0
(What it sets the config to when nothing is selected, this can be a tad bit buggy, I'll try to go into more detail it a later update)
Option[0]="Hat Kid Clothes"
v----- These refer to the name of the options. There can be as many as you need
Option[1]="Conductor Clothes"
<---/





So now you have the config set up here, but its not doing anything!
You need to define this variable again in the mod file,
Making the Config do something
This is Somewhat complex, so i will be using Playable Conductor as an example,

So before we added,
+Config=playerSet
This in itself does nothing
We need to define the variable in the GameMod class
Note: If you want to change the name to something other than playerSet go ahead just make sure to edit that in the rest of your code, being consistant is key!

Make sure to have
Config(Mods);
under the Gamemod or else nothng will work!






So make sure this gets changed we want to make a new event in our GameMod Class



This says that when something is changed, update this file,
We need an initial

If(ConfigName == 'playerSet'){ }
Be sure to keep capitalization consistant
This checks to make sure its updating the correct config and nothing else
inside of that because we allready defined our variable,
We can use that to check the configuration, so we need 2 or more if statements here

I only had 2 Configuration statements so Mine is somewhat small.



You can do this for as many configs you need, just make sure you have that many in your ini file.

So a final product should(or could) look something like,

If(ConfigName == 'playerSet'){ if(playerSet == 0){ /*(Example)*/ Hat_PlayerController(GetALocalPlayerController()).GetLoadout().AddBackpack(class'Hat_Loadout'.static.MakeLoadoutItem(class'Hat_Ability_Help'), false); //adds the class item } else if(playerSet == 1){ /*(Example)*/ Hat_PlayerController(GetALocalPlayerController()).GetLoadout().RemoveBackpack(class'Hat_Loadout'.static.MakeLoadoutItem(class'Hat_Ability_Help', class'Hat_CosmeticItemQualityInfo_SearchAny')); //removes the class item } }

This would Give you the help hat if config is = to 0, and remove it if its = to 1
13 Comments
Crash  [author] 26 Jan, 2021 @ 3:13pm 
There are functions that you can call for OpenHud() but you would p be better off looking at how "rate mod" buttons in other mods like Spops Deep Sea mod do it, since you would need to make your own HUD class file
Dald22 26 Jan, 2021 @ 2:24pm 
what if I want to make a custom menu with out using the mod setting (example I place a object in the hub that opens a custom gui that plays music depending on what buttons you press?)
Crash  [author] 23 Jul, 2020 @ 4:09pm 
you need to add it in the def props

SupportsRoulette=true
pablothesilly 23 Jul, 2020 @ 1:38pm 
i dont see it anywhere in classes though
Crash  [author] 23 Jul, 2020 @ 1:29pm 
the dye or song one
pablothesilly 23 Jul, 2020 @ 1:26pm 
which classes?
Crash  [author] 23 Jul, 2020 @ 10:43am 
No, in the classes them selfs there's a bool called SupportsRoulette that should = true
pablothesilly 23 Jul, 2020 @ 10:20am 
if you put AutoGiveItems=0 will that make it so it will be in the rift roulette instead?
pablothesilly 23 Jul, 2020 @ 10:17am 
customization mods like dyes, remixes, hat flairs
Crash  [author] 23 Jul, 2020 @ 10:10am 
what kind of mod