Page 1 of 1

Hades [Lua Script Loader]

Posted: Thu Jan 13, 2022 5:33 pm
by cfemen
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:

Code: Select all

#define luaL_dostring(L, s) \
	(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
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:

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
Hero Health Commands ( will only update if you get damage / heal / change room )
xxx = any value you want:

Code: Select all

CurrentRun.Hero.MaxHealth = xxx
CurrentRun.Hero.Health = xxx
HeroData.DefaultHero.MaxHealth = xxx
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:

Code: Select all

LiveFillInShopOptions() StartUpStore() 
GenerateMarketItems()
RecordFish(GetFish("Tartarus", "Good"))
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:

Code: Select all

local playerId = GetIdsByType({ Name = "_PlayerUnit" })  for i=0,20 do DropHealth( "HealDropMinor", playerId ) end
Spawning God Gifts:

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 })
Weapon Upgrades:

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 )
Unlock Codex:

Code: Select all

UnlockEntireCodex() thread( ShowCodexUpdate )
Change Weapon:

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 } )
Add Trait:

Code: Select all

AddTraitToHero({TraitData = GetProcessedTraitData({ Unit = CurrentRun.Hero, TraitName = "SpearThrowBounce", Rarity = "Common"}) }) 
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 :lol: 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 )

Re: Hades [Lua Script Loader]

Posted: Fri Jan 14, 2022 11:08 am
by SunBeam
You may want to take a look at my Far Cry 6 table ;) -> viewtopic.php?f=4&t=17693. The "Toggle Console UDF" part. I don't mind if you use it in your table ;) It will show an UDF in which you can type stuff, much like an external console, if you like. With logging.

Re: Hades [Lua Script Loader]

Posted: Sat Jan 15, 2022 3:18 pm
by beguiler
Just a note, I had issues with this script not finding EngineWin64s.dll and it seems for some reason my game was loading EngineWin64sv.dll. So 2 changes in the script to look for that dll fixed it for me. I was using the Epic Store version BTW.

Thanks for the table btw. :)

Re: Hades [Lua Script Loader]

Posted: Wed Mar 02, 2022 4:45 am
by xGeno
So I managed to overload the lua script and now it jus says "No Lua State" any way to fix this? Sorry I'm a noob at this still lol.

Re: Hades [Lua Script Loader]

Posted: Sat Mar 18, 2023 5:22 pm
by TheThing
Not working with Cheat Engine 7.5
No Lua state

Re: Hades [Lua Script Loader]

Posted: Thu May 16, 2024 2:22 pm
by DarkThinkHuman
TheThing wrote:
Sat Mar 18, 2023 5:22 pm
Not working with Cheat Engine 7.5
No Lua state
How about reading the instructions and don't ignore it?
note : its only for the x64 version of the game
if you start the 32 bit version it won't work ....