77-- so you will most likely want to have it reference
88-- values and functions later defined in `reload.lua`.
99
10+ -- These are some sample code snippets of what you can do with our modding framework:
1011local file = rom .path .combine (rom .paths .Content , ' Game/Text/en/ShellText.en.sjson' )
11-
1212sjson .hook (file , function (data )
1313 return sjson_ShellText (data )
1414end )
2020
2121game .OnControlPressed ({' Gift' , function ()
2222 return trigger_Gift ()
23- end })
23+ end })
24+
25+
26+ -- Everything below this line is part of the example mod creation guide,
27+ -- which you can find on our wiki, replacing Schelemeus portrait:
28+ -- https://sgg-modding.github.io/Hades2ModWiki/docs/category/creating-your-first-mod
29+ -- Note that the custom .pkg files are not included in the template, and you will
30+ -- need to create them yourself if you want to follow the tutorial.
31+
32+ ---- -------------------------------------------------------
33+ ---- ----------- Step 1: Loading the package ---------------
34+ ---- -------------------------------------------------------
35+
36+ ---- --- Method 1: Calling the package load function when entering the Hub_PreRun room
37+ -- modutil.mod.Path.Wrap("DeathAreaRoomTransition", function(base, source, args)
38+ -- if game.CurrentHubRoom.Name == "Hub_PreRun" then
39+ -- mod.LoadSkellyPackage()
40+ -- end
41+ -- base(source, args)
42+ -- end)
43+
44+
45+ ---- --- Method 2: Adding the package load function to the Schelemeus setup events
46+ -- local loadSkellyPackageCall = { FunctionName = _PLUGIN.guid .. ".LoadSkellyPackage" }
47+ -- table.insert(game.EnemyData.NPC_Skelly_01.SetupEvents, loadSkellyPackageCall)
48+
49+
50+ ---- --- Method 3: Adding the package to the list of packages loaded whenever Schelemeus is spawned
51+ local customPortraitsPackageName = _PLUGIN .guid .. " Portraits"
52+ table.insert (game .EnemyData .NPC_Skelly_01 .LoadPackages , customPortraitsPackageName )
53+
54+
55+ ---- -------------------------------------------------------
56+ ---- ------- Step 2: Modifying the portrait path -----------
57+ ---- -------------------------------------------------------
58+
59+ -- All packages built by `deppth2 hpk` will have the package name as part of all file paths, to prevent mods from clashing
60+ -- If you added any nested folders in your package, include them here as well
61+ local newPortraitFilePath = _PLUGIN .guid .. " Portraits\\ Portraits_Skelly_01"
62+
63+ -- rom.path.combine is provided by Hell2Modding to build file paths correctly across different operating systems
64+ -- rom.paths.Content() will return the path to the Content folder of the current Hades II installation
65+ local guiPortraitsVFXFile = rom .path .combine (rom .paths .Content (), " Game\\ Animations\\ GUI_Portraits_VFX.sjson" )
66+
67+ sjson .hook (guiPortraitsVFXFile , function (data )
68+ for _ , entry in ipairs (data .Animations ) do
69+ if entry .Name == " Portrait_Skelly_Default_01" or entry .Name == " Portrait_Skelly_Default_01_Exit" then
70+ entry .FilePath = newPortraitFilePath
71+ entry .CreateAnimations = {}
72+ entry .OffsetY = 0
73+ end
74+ end
75+ end )
0 commit comments