Thread: Arcane Thesis
View Single Post
CptCoots
Senior Member
 
Join Date: Apr 2013
Location: Poughkeepsie, NY
Posts: 102

Old July 8th, 2013, 10:08 PM
Got it. It mostly works but there are two things: I keep getting "Attempt to access non-existent containing entity from script" error AND in the metamagic window shows the wrong Total Spell Level. Incidentally, this is going to form the start of my Easy Metamagic feats!

This is Eval Script 2- (timing is pretty arbitrarily chosen) Pre-levels: 5000
~Set up vaiables
var id as string
var nlvl as number
var spell as string
var normLvl as number
var LvlRed as number
var strcom as string
var result as number

~Exit if nothing chosen
doneif (field[fChosen].ischosen = 0)

~Set some things
id = field[fChosen].chosen.idstring
~the spell we're looking for, because it was chosen
spell = "thingid." & id
~the minimum level of the spell
normLvl=field[fChosen].chosen.field[sLevel].value
~we do not count Heighten in the entire calculation
strcom="Height"

~look through each spell memorized that matches chosen
foreach pick in hero where spell
LvlRed=0
~Goto the gizmos and look at the metamagics on them
foreach pick in eachpick.gizmo from BaseMetamg
~If it is not heighten (compare works like a child made it)
if (compare(eachpick.field[mmAbbr].text,strcom) <>0) then
~Increase potential level reduction by 1
LvlRed += 1
endif
nexteach
~Once all metamagics have been looked at the new level is either the
~base level or newly adjusted level
nlvl=maximum(normLvl,eachpick.field[sLevel].value-LvlRed)
~Delete the tag (Important because the metamagic spell shows the
~field value while the tag is what the spell list uses).
result=eachpick.delete[sLevel.?]
~Set the field.
eachpick.field[sLevel].value=nlvl
~Set the correct tag
if (eachpick.field[sLevel].value = 0) then
result = eachpick.assign[sLevel.0]
elseif (eachpick.field[sLevel].value = 1) then
result = eachpick.assign[sLevel.1]
elseif (eachpick.field[sLevel].value = 2) then
result = eachpick.assign[sLevel.2]
elseif (eachpick.field[sLevel].value = 3) then
result = eachpick.assign[sLevel.3]
elseif (eachpick.field[sLevel].value = 4) then
result = eachpick.assign[sLevel.4]
elseif (eachpick.field[sLevel].value = 5) then
result = eachpick.assign[sLevel.5]
elseif (eachpick.field[sLevel].value = 6) then
result = eachpick.assign[sLevel.6]
elseif (eachpick.field[sLevel].value = 7) then
result = eachpick.assign[sLevel.7]
elseif (eachpick.field[sLevel].value = 8) then
result = eachpick.assign[sLevel.8]
else
result = eachpick.assign[sLevel.9]
endif
nexteach
CptCoots is offline   #7 Reply With Quote