Noway3 wrote: ↑Fri Jan 05, 2024 10:44 am
yabadaba wrote: ↑Fri Jan 05, 2024 2:07 am
I'm new to programming in cheat engine and lua, I'm trying to make a "Transform All" command cheat with the latest CE table, where the whole party transforms to a defined UUID. I searched the functions in Register Commands but didn't find one to get the whole party as a table
In the SE console I can use this to teleport the party, so I know there is a way to get the party as a table type:
Code: Select all
x,y,z = GetPosition(GetHostCharacter()) for i,v in ipairs(Osi.DB_PartyMembers:Get(nil)) do TeleportToPosition(v[1],x,y,z) end
But I couldn't figure out how to properly call Osi.DB_PartyMembers:Get(nil) using ExecuteCall
something like this:
Code: Select all
ExecuteCall("DB_PartyMembers:Get(nil)") --doesn't work
local party = GetArgAt(0) --doesn't work
--printf(party)
for i = 1, #party do
--use party[i] for whatever
end
I don't really know how the commands are registered when the game loads but I'm assuming the problem is the ":Get(nil)" part, how do I properly call it and get the table value?
The functions
OsiDatabase:Get(...)
and
OsiDatabase:Delete(...)
are neat hooks available within Norbyte's Script Extender only.
And Osiris calls like
Osi.IterateInventory(...)
or
Osi.IterateCharacters(...)
require to register an event handler function, which is possible to implement within CE, in theory, but ... it's complicated!
There are may be ways to interface CE with SE but, well, you could as easily create a mod to do the stuff with SE and without CE!
I recall
EvenLess and
PeDaGaNG have posted pieces of code about getting a list of party members and apply "things" to them.
check their posts here:
(No, I am a not a search bot, I just have a selective memory!)
Hey thank you for linking to these! I was curious if anyone found a function to pull out UUIDs of all the active party members for stuff like this, and now iterating on PeDaGanG's version of the script, I've been able to recreate a lot of Zanzer's helper functions using lambdas without needing to require some user overhead to annoyingly copy each UUID (like scrolling through each party member, activating GetHostCharacter, placing it in a list, and repeating for each different party member on every game load). Instead, I just need to activate it while having my character selected and it's good until I next change up my party composition. In that case, I just need to close and reopen it.
Code: Select all
{$lua}
if syntaxcheck then return end
-- Script to generate active party member list, activate first before running any of the party member functions listed in the script
-- companionInParty["FLAG_UUID_State_IsInParty"] = {"COMPANION_UUID", "DISPLAY_NAME"}
companionInParty = {
["ef789a01-f41e-4a7d-9097-fa9c4f1d0f16"] = {"c7c13742-bacd-460a-8f65-f864fe41f255", "Astarion"},
["639d141f-6fa8-4d93-8eb7-41243e0fea32"] = {"ad9af97d-75da-406a-ae13-7071c563f604", "Gale"},
["9a3ea4cd-3a44-40f7-9d63-2b29bdb28725"] = {"7628bc0e-52b8-42a7-856a-13a6fd413323", "Halsin"},
["1b86aa78-a2db-4faa-b4a6-c5591c03bac9"] = {"91b6b200-7d00-4d62-8dc9-99e8339dfa1a", "Jaheira"},
["eb7c4de0-36b7-4086-aa33-82c09596a395"] = {"2c76687d-93a2-477b-8b18-8a14b549304c", "Karlach"},
["3ee6b1f2-24f4-4e85-b7dc-49060e6d2699"] = {"58a69333-40bf-8358-1d17-fff240d7fb12", "Lae'zel"},
["aeb58e60-562a-4e20-8cb2-0deb03b010fc"] = {"0de603c5-42e2-4811-9dad-f652de080eba", "Minsc"},
["766b8981-eb17-3ec5-5d30-2626509c550f"] = {"25721313-0c15-4935-8176-9f134385451b", "Minthara"},
["9a029c5a-e3c3-45ef-9cd4-1cb45718deb1"] = {"3ed74f06-3c60-42dc-83f6-f034cb47c679", "Shadowheart"},
["3c0972ef-d7a4-46ac-abdd-0ce6aadd61b0"] = {"c774d764-4a17-48dc-b470-32ace9ce447d"; "Wyll"},
["126c47da-7d24-49ce-b06f-5a44f09ee87e"] = {"4888dfaa-2e0a-4c10-9c8a-d5345aeb4746", "DarkUrge"}
}
-- hireling["HIRELING_UUID"] = {"CLASS", "DISPLAY_NAME"}
hireling = {
["7bed07ee-d1db-498d-bbfd-600ddf04676e"] = {"Barbarian", "Eldra Luthrinn"},
["4d3c9cb3-ca34-46ba-9c81-44081270bfde"] = {"Bard", "Brinna Brightsong"},
["12e541ac-1eb3-4b8c-a8b8-95263e30b217"] = {"Cleric", "Zenith Feur'sel"},
["49f522f8-9ac9-431e-ab39-a45e38e222c2"] = {"Druid", "Danton"},
["d61d12ad-dc80-4805-8c6e-fb876da196cd"] = {"Fighter", "Varanna Sunblossom"},
["0b149cab-4438-467a-953d-8697535b953d"] = {"Monk", "Sina'zith"},
["244e782b-a99c-444a-bd8d-d356c26c2902"] = {"Paladin", "Kerz"},
["0488a406-402c-4bd1-ba38-63b28c112d8d"] = {"Ranger", "Ver'yll Wenkiir"},
["e4818484-7ee4-466b-82b3-60bbd7b2ff8f"] = {"Rogue", "Maddala Deadeye"},
["097aa418-eda5-47f9-867f-29a4339be03e"] = {"Sorcerer","Jacelyn"},
["ee3f1f8d-f2d1-43f2-aba0-72cacafce03c"] = {"Warlock", "Kree Derryck"},
["2c8c93f0-898b-42d6-b2ca-cf4922852632"] = {"Wizard", "Sir Fuzzalump"},
}
partyMember = {}
function setActivePartyMembers()
partyMember = {}
table.insert(partyMember, GetHostCharacter())
for k,v in pairs(companionInParty) do
local gotFlag = 0
gotFlag = GetFlagOnPlayer(k)
if gotFlag ~= nil and gotFlag ~= 0 then
-- print(string.format("Companion '%s' is in your party.", v[2]))
table.insert(partyMember, v[1])
end
end
for k,v in pairs(hireling) do
local gotFlag = 0
gotFlag = GetFlag("0052da16-4401-4873-8176-16336d8942da", k)
if gotFlag ~= nil and gotFlag ~= 0 then
-- print(string.format("Hireling '%s' (%s) is in your party.", v[2], v[1]))
table.insert(partyMember, k)
end
end
end
function onParty(func)
local status = 0
for i = 1, #partyMember do
status = func(partyMember[i])
end
return status
end
function AddPassiveToParty(PassiveID)
local func = function(player) AddPassive(player, PassiveID) end
return onParty(func)
end
function RemovePassiveFromParty(PassiveID)
local func = function(player) RemovePassive(player, PassiveID) end
return onParty(func)
end
function AddBoostsToParty(Boosts)
local func = function(player) AddBoosts(player, Boosts, 0, 0) end
return onParty(func)
end
function RemoveBoostsFromParty(Boosts)
local func = function(player) RemoveBoosts(player, Boosts, 0, 0, 0) end
return onParty(func)
end
function ApplyStatusToParty(Status, Duration)
local func = function(player) ApplyStatus(player, Status, Duration, 1, 0) end
return onParty(func)
end
function RemoveStatusFromParty(Status)
local func = function(player) RemoveStatus(player, Status, 0) end
return onParty(func)
end
function AddSpellToParty(Spell)
local func = function(player) AddSpell(player, Spell, 0, 1) end
return onParty(func)
end
function RemoveSpellFromParty(Spell)
local func = function(player) RemoveSpell(player, Spell, 0) end
return onParty(func)
end
function SetTagOnParty(Tag)
local func = function(player) SetTag(player, Tag) end
return onParty(func)
end
function ClearTagOnParty(Tag)
local func = function(player) ClearTag(player, Tag) end
return onParty(func)
end
[ENABLE]
setActivePartyMembers()
[DISABLE]
{$asm}
With this enabled a lot of Player functions I can just change from Player to Party to more or less have the same effect on the party, like adding an extra bonus action
Code: Select all
[ENABLE]
{$lua}
if syntaxcheck then return end
AddBoostsToParty("ActionResource(BonusActionPoint,1,0)")
{$asm}
[DISABLE]
And for anything else that requires a UUID, I can just encapsulate it into a lambda and pass it as an argument to OnParty like so
Code: Select all
[ENABLE]
{$lua}
if syntaxcheck then return end
onParty(function(player) SetTag(player, "dc860a81-f3c2-4c1a-ab90-e7583324845c") end)
{$asm}
[DISABLE]
Only sucky part is I need to have it as its own separate script instead of part of the script after activating
Register Commands
so I can refresh the list of Party Members on the fly. I probably could set it up to initialize on
Register Commands
and then just set up the other script to reset it, though I like having the party logic all live in one specific place rather than across multiple scripts. Either way, this definitely has made a lot of console commands easier on me