If you're not interested in helping, why then even post replies? The question isn't really CE related but more generally Lua code/BG3 commands related. There are plenty of ways to achieve what he's asking.sanitka wrote: ↑Sun Oct 22, 2023 10:14 pmlearn youself CE and save yourself and us time with answering you beginners questionsPrinceRevivalDK wrote: ↑Sun Oct 22, 2023 10:04 pmHey so a question.
...
Is there any way I can make spaces with these example of making it look somewhat similar to this.
- no, you can not simply put new-lines there, just spaces.
The first thing I like to do with a long string (the programming term for a what is a mix if letters, numbers, symbols etc.) like this, is to format it in a way to make it more readable, so I can better understand where I can "break it apart".PrinceRevivalDK wrote: ↑Sun Oct 22, 2023 10:04 pmHey so a question. I like this script here.But as you can see, where it says boosts =Code: Select all
{$lua} if syntaxcheck then return end [ENABLE] boosts = "UnlockSpellVariant(IsSpell() or not IsSpell(),ModifySpellRoll('not SavingThrow','SpellAutoResolveOnAlly'),ModifyTargetRadius(AdditiveBase,10),ModifyNumberOfTargets(AdditiveBase,2),ModifyMaximumTargets(AdditiveBase,2),ModifySpellFlags(Stealth,1),ModifySpellFlags(Melee,0),ModifySavingThrowDisadvantage(),ModifyUseCosts(Override,ActionPoint,0,0),ModifyUseCosts(Override,BonusActionPoint,0,0),ModifyUseCosts(Override,ReactionActionPoint,0,0),ModifyTooltipDescription())" AddBoostsToPlayer(boosts) [DISABLE] RemoveBoostsFromPlayer(boosts)
It is quite a long "sentence"
Is there any way I can make spaces with these example of making it look somewhat similar to this.
...Code: Select all
{$lua} if syntaxcheck then return end [ENABLE] boosts = "UnlockSpellVariant(IsSpell() or not IsSpell()," "ModifySpellRoll('not SavingThrow','" "SpellAutoResolveOnAlly')", "ModifyTargetRadius(AdditiveBase,10)", AddBoostsToPlayer(boosts) [DISABLE] RemoveBoostsFromPlayer(boosts)
In your example this could look like this:
Code: Select all
UnlockSpellVariant(
IsSpell() or not IsSpell(),
ModifySpellRoll('not SavingThrow','SpellAutoResolveOnAlly'),
ModifyTargetRadius(AdditiveBase,10),
ModifyNumberOfTargets(AdditiveBase,2),
ModifyMaximumTargets(AdditiveBase,2),
ModifySpellFlags(Stealth,1),
ModifySpellFlags(Melee,0),
ModifySavingThrowDisadvantage(),
ModifyUseCosts(Override,ActionPoint,0,0),
ModifyUseCosts(Override,BonusActionPoint,0,0),
ModifyUseCosts(Override,ReactionActionPoint,0,0),
ModifyTooltipDescription()
)
So the simplest way to break this into bits, would be to just use what is called concatenation, which is basically just taking two strings and add them together to one string. Because it's a function, we need to make sure we don't break the paramter/argument separators (commas), and that the last argument doesn't end with a comma. We're just gonna take care of that in our head, and swear at everything when we forget it
Code: Select all
{$lua}
if syntaxcheck then return end
local boost = ''
boost = boost .. "UnlockSpellVariant("
boost = boost .. "IsSpell() or not IsSpell(),"
boost = boost .. "ModifySpellRoll('not SavingThrow','SpellAutoResolveOnAlly'),"
boost = boost .. "ModifyTargetRadius(AdditiveBase,10),"
boost = boost .. "ModifyNumberOfTargets(AdditiveBase,2),"
boost = boost .. "ModifyMaximumTargets(AdditiveBase,2),"
boost = boost .. "ModifySpellFlags(Stealth,1),"
boost = boost .. "ModifySpellFlags(Melee,0),"
boost = boost .. "ModifySavingThrowDisadvantage(),"
boost = boost .. "ModifyUseCosts(Override,ActionPoint,0,0),"
boost = boost .. "ModifyUseCosts(Override,BonusActionPoint,0,0),"
boost = boost .. "ModifyUseCosts(Override,ReactionActionPoint,0,0),"
boost = boost .. "ModifyTooltipDescription()"
boost = boost .. ")"
[ENABLE]
AddBoostsToPlayer(boost)
[DISABLE]
RemoveBoostsFromPlayer(boost)
What I would probably do is to create a table (list/array) with the "Modify" items and using the built-in Lua table function concat to add them all together separated by a comma.
Code: Select all
{$lua}
if syntaxcheck then return end
local condition = "IsSpell() or not IsSpell()"
local arguments = {
"ModifySpellRoll('not SavingThrow','SpellAutoResolveOnAlly')",
"ModifyTargetRadius(AdditiveBase,10)",
"ModifyNumberOfTargets(AdditiveBase,2)",
"ModifyMaximumTargets(AdditiveBase,2)",
"ModifySpellFlags(Stealth,1)",
"ModifySpellFlags(Melee,0)",
"ModifySavingThrowDisadvantage()",
"ModifyUseCosts(Override,ActionPoint,0,0)",
"ModifyUseCosts(Override,BonusActionPoint,0,0)",
"ModifyUseCosts(Override,ReactionActionPoint,0,0)",
"ModifyTooltipDescription()",
}
table.concat(arguments, ',')
local boost = string.format("UnlockSpellVariant(%s,%s)", condition, arguments)
[ENABLE]
AddBoostsToPlayer(boost)
[DISABLE]
RemoveBoostsFromPlayer(boost)
condition
. Then create a table variable arguments
containing each of the modifications. Remember to remove the separator commas from the original string as these will be added using the table.concat
function.Then the
table.concat
function will take each item in the table arguments
and concatenating them using a comma ',' as a separator.Finally create the
boost
string. Here I'm using string.format so it's easy replace the %s
string placeholders with the previously created variables. This could also be done using concatenation like this:
Code: Select all
local boost = "UnlockSpellVariant(" .. condition .. "," .. arguments .. ")"
UnlockSpellVariant()
function uses 2 or more arguments, i.e. the condition and then one or more modifications. I don't know if this is the case.
How to use this cheat table?
- Install Cheat Engine
- Double-click the .CT file in order to open it.
- Click the PC icon in Cheat Engine in order to select the game process.
- Keep the list.
- Activate the trainer options by checking boxes or setting values from 0 to 1