imagine this, Lance …
i maintain the MetaPrepa add-on, it recasts party spellbuffs (aka a spell-sequencer)
But spells that are on a submenu won’t cast via ActionCastSpellAtObject() …
Because caster doesn’t memorize the subspell only the master spell (even though GetHasSpell(subspell) returns true)
So the released version of MetaPrepa uses bCheat to cast those subspells. But, the bCheat parameter forces the spell to cast at L10.
so am testing a workaround
// parsed down to only the relevant stuff
void DoAllPreparations(object oBook, int bInstant)
{
struct preparation pPrep = GetFirstPreparation(oBook);
while (GetIsPreparationValid(pPrep))
{
EncapsulateSpell(pPrep, bInstant, iIteration, oPossessor, oItem);
pPrep = GetNextPreparation(oBook);
}
}
void EncapsulateSpell(struct preparation pSpell, int bInstant, int iIteration = 0, object oPossessor = OBJECT_INVALID, object oItem = OBJECT_INVALID)
{
if (pSpell.iSpellId == iMasterId) // if spell is its own Master
{
ActionCastSpellAtObject(pSpell.iSpellId, oTarget, pSpell.iMeta, pSpell.bCheat, 0, PROJECTILE_PATH_TYPE_DEFAULT, FALSE);
}
else // fake the spell and execute a forced script ->
{
ActionCastFakeSpellAtObject(pSpell.iSpellId, oTarget, PROJECTILE_PATH_TYPE_DEFAULT);
ActionDoCommand(AddScriptParameterObject(oTarget));
string sScript = "radial_" + IntToString(pSpell.iSpellId);
ActionDoCommand(ExecuteScriptEnhancedVoid(sScript, oCaster, TRUE));
}
}
where the “radial” scripts are modified spellscripts (which ofc don’t have legitimate access to all the functions that a regular spellscript has)
Â
The code for fastcast is more tenuous …
else // do NOT fake the spell and only execute a forced script ->
{
DelayCommand(_fFastDelay, ActionDoCommand(AddScriptParameterObject(oTarget)));
string sScript = "radial_" + IntToString(pSpell.iSpellId);
DelayCommand(_fFastDelay + 0.0005f, ActionDoCommand(ExecuteScriptEnhancedVoid(sScript, oCaster, TRUE)));
}
Â
the point: Trying to set oTarget(s) on the module (iteratively) would be a nightmare … because that’s actually what i did with the cast-on-item code before clueing into ExecuteScriptEnhanced(). First it creates a long string that then needs to be parsed back down into objects, spellids, etc. It seems to work but it’s not quite as robust as I believe the technique above (which, uh, i’m still testing…) would be
ps. Sorry if that’s all bleh. Am just saying that this could be an even huger benefit when parameterized “commands” need to be iterated/sequenced. yet it remains to be tested whether the parameters stick properly to their respective ExecuteScriptEnhanced() calls …