Page 1 of 1
Mod MQ2Cast to find best spell version
Posted: Wed Aug 02, 2017 8:57 am
by dewey2461
Problem: MQ2Cast requires specific spell ranks to cast.
Solution: Make it do the right thing. If you ask to cast "Ardent Light" but have "Ardent Light Rk. II" ready ...
Huge side effect of this mod, would be to make MQ2Melee holy/down shits a lot easier to maintain since most are written using MQ2Cast and require you to go through all the shits looking for spell versions.
Re: Mod MQ2Cast to find best spell version
Posted: Wed Aug 02, 2017 11:34 am
by JudgeD
+1
I feel like there's room to improve on the spell rank maintenance. Especially if you box a crew it can be hard to notice you're casting the wrong version of something.
Re: Mod MQ2Cast to find best spell version
Posted: Wed Aug 02, 2017 5:22 pm
by warlock45
It can be an issue when you fall back to silver/FTP and have the spell, but can't cast it.
Though to put it out there for other posters, I have made it a habit to go ahead and make my holy/downshits with /cast "${Spell[SomeSpell].RankName}" for that exact reason. That and when I get time I like to consolidate the "best" set ups between toons of the same class and update all of them to use the same set up (and they of course will have different ranks of X spell lines)
But aye, it would make things much nicer if MQ2Cast itself recognized ranks, if it could also figure out to only use rank1 in the process when needed.
Re: Mod MQ2Cast to find best spell version
Posted: Thu Aug 03, 2017 12:59 pm
by MacQ
I don't use MQ2Cast, so I don't know it well. I use a modified version of SpellCast.inc that does not require the "rank" of a spell. You just call the subroutine with the spell name and the subroutine deals with the rank. If that is not true with MQ2Cast, I can see it can be a hassle.
Re: Mod MQ2Cast to find best spell version
Posted: Thu Aug 03, 2017 2:21 pm
by demonstar55
/casting "${Spell[foo].SpellRank}" doesn't work?
Re: Mod MQ2Cast to find best spell version
Posted: Thu Aug 03, 2017 7:02 pm
by dewey2461
demonstar55 wrote:/casting "${Spell[foo].SpellRank}" doesn't work?
I'm sure that is the correct way to work around the issue. If only everyone wrote all their holyshit/downshits that way.
Having /casting "foo" just work would be a lot easier to maintain - IMHO
Re: Mod MQ2Cast to find best spell version
Posted: Thu Aug 03, 2017 9:47 pm
by SwiftyMUSE
change the SpellBook routine to:
Code: Select all
PSPELL SpellBook(PCHAR ID)
{
if (PSPELL pSpell = GetSpellByName(ID)) {
for (DWORD nSpell = 0; nSpell < NUM_BOOK_SLOTS; nSpell++) {
if (PCHARINFO2 pChar2 = GetCharInfo2()) {
if (pChar2->SpellBook[nSpell] != 0xFFFFFFFF) {
if (PSPELL pFoundSpell = GetSpellByID(pChar2->SpellBook[nSpell])) {
if (pFoundSpell->SpellGroup == pSpell->SpellGroup && !_strnicmp(pSpell->Name, pFoundSpell->Name, strlen(pSpell->Name)))
{
return pFoundSpell;
}
}
}
}
}
return pSpell;
}
return NULL;
}
Re: Mod MQ2Cast to find best spell version
Posted: Thu Aug 03, 2017 11:40 pm
by dewey2461
Doesn't work for me but its late. I'll check in further tomorrow night.
Re: Mod MQ2Cast to find best spell version
Posted: Fri Aug 04, 2017 9:24 am
by SwiftyMUSE
Give me a few examples. The limited testing I did seemed to work.
Re: Mod MQ2Cast to find best spell version
Posted: Fri Aug 04, 2017 5:11 pm
by dewey2461
User Error 101:
I did not realize ( or had forgotten ) that /cast and /casting are two different things.
/cast must be the core MQ function and /casting is the MQ2Cast version of the function.
So I went ahead and added
Code: Select all
PLUGIN_API VOID InitializePlugin(VOID)
...
AddCommand("/cast", CastCommand);
PLUGIN_API VOID ShutdownPlugin(VOID)
...
RemoveCommand("/casting");
And now /cast is working very well.
Thank you SwiftyMUSE - I'd like to donate a krono to you. How would I go about it?
Re: Mod MQ2Cast to find best spell version
Posted: Fri Aug 04, 2017 11:46 pm
by SwiftyMUSE
You don't need to do that dewey... I have added that to the core code, just wanted someone else to test with MQ2Cast first. It should be included with the release of the next zip.
Re: Mod MQ2Cast to find best spell version
Posted: Sat Aug 05, 2017 5:00 pm
by MacQ
Swifty,
Are you making a change to /cast in the MQ core?
If so, would that mean /cast "${Spell[${SpellName}].RankName}" would no longer work?
Re: Mod MQ2Cast to find best spell version
Posted: Sat Aug 05, 2017 10:35 pm
by dewey2461
Donated a Krono to SwiftyMUSE. Its been a while since I've donated and want to give a small token of appreciation for the changes made to the core compile to make things easier.
Re: Mod MQ2Cast to find best spell version
Posted: Sat Aug 05, 2017 11:44 pm
by SwiftyMUSE
MacQ wrote:Swifty,
Are you making a change to /cast in the MQ core?
If so, would that mean /cast "${Spell[${SpellName}].RankName}" would no longer work?
That will still work, but it should also work with
/cast "${Spell[${SpellName}]"