Hades [Lua Script Loader]
Posted: Thu Jan 13, 2022 5:33 pm
Hey,
longer time ago I made this -> viewtopic.php?p=121562#p121562
back then in early-access the devs used the Monogame-Engine, the final release changed the engine.
this topic is only about the used Lua I won't bother to do a normal table( e.g doing string compares to get pointers to the Lua variables ) so this here is for people who likes to experiment and explore with commands.
While looking at the Lua in this game I noticed that some stuff is different,the Lua functions are inside the EngineWin64s.dll instead of in the Lua52.dll and some of the macros are replaced with functions.
what do I mean with macros:
normally dostring does execute loadstring and then pcall, but this game has a own dostring function that can be called directly coz its not a macro
my table is getting the lua_state before a lua_gettop call ( the game has more than one lua_state) and then calling dostring with the lua_state instance and a string that contains Lua script
how the table works:
activate Enable and if you click on Execute Lua a input window will appear, you can use lua commands here.
some easy commands that are tested and working:
Hero Health Commands ( will only update if you get damage / heal / change room )
xxx = any value you want:
Hero.MaxHealth will be overriden from the game after a new room.
DefaultHero.MaxHealth is permanent until you reload the savegame.
not tested / not working correctly:
I guess the commands names already tell what they should do
you can also do more complex stuff:
e.g if you want a full heal you could spawn lots of heal items:
Spawning God Gifts:
Weapon Upgrades:
Unlock Codex:
Change Weapon:
Add Trait:
traits will stack ( level up ) you can also try out other traits - "SpearThrowBounce" is just an example, take a look at the TraitData.lua
of course you can do way way more didn't have the time yet to dig deep into it ... also I didn't look yet to dump all the _G globals edit : dumped some stuff - its now attached as txt file to this post and I've added some more useful Lua commands here.
feel free to share lua scripts if you find something useful
if you go into the Hades\Content\Scripts folder you can see all the .lua scripts that are loaded from the game, this should help to figure out more stuff.
note : its only for the x64 version of the game
make sure to use Cheat Engine 7.3 - some older versions will freeze if you attach it to the game!
make sure that the game is paused if you are playing in windowed mode while executing lua scripts
Im not sure why but windowed mode can cause a crash if you spawn something,
solutions to it : play in fullscreen mode or pause the process with a cheat engine hotkey (settings->hotkey->pause the selected process)
//
added the UDF method from SunBeam, thanks for that!
now there is a big input field and a Log that shows previous commands, you can send commands with Shift+Enter.
//
reuploaded the UDF table with "0FR" prefix to exclude it from FearlessRevolution BETA ( UDF controls are not compatible for now )
longer time ago I made this -> viewtopic.php?p=121562#p121562
back then in early-access the devs used the Monogame-Engine, the final release changed the engine.
this topic is only about the used Lua I won't bother to do a normal table( e.g doing string compares to get pointers to the Lua variables ) so this here is for people who likes to experiment and explore with commands.
While looking at the Lua in this game I noticed that some stuff is different,the Lua functions are inside the EngineWin64s.dll instead of in the Lua52.dll and some of the macros are replaced with functions.
what do I mean with macros:
Code: Select all
#define luaL_dostring(L, s) \
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
my table is getting the lua_state before a lua_gettop call ( the game has more than one lua_state) and then calling dostring with the lua_state instance and a string that contains Lua script
how the table works:
activate Enable and if you click on Execute Lua a input window will appear, you can use lua commands here.
some easy commands that are tested and working:
Code: Select all
AddMoney( 1000, "GrantUpgrade" )
AddResource( "MetaPoints", 100, "Debug" )
AddResource( "Gems", 100, "Debug" )
AddResource( "LockKeys", 100, "Debug" )
AddResource( "GiftPoints", 100, "Debug" )
AddResource( "SuperLockKeys", 100, "Debug" )
AddResource( "SuperGems", 100, "Debug" )
AddResource( "SuperGiftPoints", 100, "Debug" )
AddRerolls( 99, "Debug", { IgnoreMetaUpgrades = true } )
CreateWeaponLoot()
CreateStackLoot()
AddSuperRarityBoost()
SetPlayerInvulnerable()
SetPlayerVulnerable()
BuildSuperMeter( CurrentRun, 100 )
DestroyRequiredKills() --kills all enemies in room
xxx = any value you want:
Code: Select all
CurrentRun.Hero.MaxHealth = xxx
CurrentRun.Hero.Health = xxx
HeroData.DefaultHero.MaxHealth = xxx
DefaultHero.MaxHealth is permanent until you reload the savegame.
not tested / not working correctly:
Code: Select all
LiveFillInShopOptions() StartUpStore()
GenerateMarketItems()
RecordFish(GetFish("Tartarus", "Good"))
you can also do more complex stuff:
e.g if you want a full heal you could spawn lots of heal items:
Code: Select all
local playerId = GetIdsByType({ Name = "_PlayerUnit" }) for i=0,20 do DropHealth( "HealDropMinor", playerId ) end
Code: Select all
CreateLoot({ Name = "AthenaUpgrade" , OffsetX = 100 })
--
CreateLoot({ Name = "DionysusUpgrade" , OffsetX = 100 })
--
CreateLoot({ Name = "AresUpgrade" , OffsetX = 100 })
--
CreateLoot({ Name = "PoseidonUpgrade" , OffsetX = 100 })
--
CreateLoot({ Name = "ZeusUpgrade" , OffsetX = 100 })
--
CreateLoot({ Name = "AphroditeUpgrade" , OffsetX = 100 })
--
CreateLoot({ Name = "ArtemisUpgrade" , OffsetX = 100 })
--
CreateLoot({ Name = "HermesUpgrade" , OffsetX = 100 })
--
CreateLoot({ Name = "DemeterUpgrade" , OffsetX = 100 })
Code: Select all
local consumableName = "ChaosWeaponUpgrade" local playerId = GetIdsByType({ Name = "_PlayerUnit" }) local consumableId = SpawnObstacle({ Name = consumableName, DestinationId = playerId, Group = "Standing" }) local consumable = CreateConsumableItem( consumableId, consumableName, 0 )
Code: Select all
UnlockEntireCodex() thread( ShowCodexUpdate )
Code: Select all
EquipPlayerWeapon( WeaponData.SwordWeapon, { PreLoadBinks = true, LoadPackages = true } )
--
EquipPlayerWeapon( WeaponData.SpearWeapon, { PreLoadBinks = true, LoadPackages = true } )
--
EquipPlayerWeapon( WeaponData.ShieldWeapon, { PreLoadBinks = true, LoadPackages = true } )
--
EquipPlayerWeapon( WeaponData.BowWeapon, { PreLoadBinks = true, LoadPackages = true } )
--
EquipPlayerWeapon( WeaponData.GunWeapon, { PreLoadBinks = true, LoadPackages = true } )
--
EquipPlayerWeapon( WeaponData.FistWeapon, { PreLoadBinks = true, LoadPackages = true } )
Code: Select all
AddTraitToHero({TraitData = GetProcessedTraitData({ Unit = CurrentRun.Hero, TraitName = "SpearThrowBounce", Rarity = "Common"}) })
of course you can do way way more didn't have the time yet to dig deep into it ... also I didn't look yet to dump all the _G globals edit : dumped some stuff - its now attached as txt file to this post and I've added some more useful Lua commands here.
feel free to share lua scripts if you find something useful
if you go into the Hades\Content\Scripts folder you can see all the .lua scripts that are loaded from the game, this should help to figure out more stuff.
note : its only for the x64 version of the game
make sure to use Cheat Engine 7.3 - some older versions will freeze if you attach it to the game!
make sure that the game is paused if you are playing in windowed mode while executing lua scripts
Im not sure why but windowed mode can cause a crash if you spawn something,
solutions to it : play in fullscreen mode or pause the process with a cheat engine hotkey (settings->hotkey->pause the selected process)
//
added the UDF method from SunBeam, thanks for that!
now there is a big input field and a Log that shows previous commands, you can send commands with Shift+Enter.
//
reuploaded the UDF table with "0FR" prefix to exclude it from FearlessRevolution BETA ( UDF controls are not compatible for now )