Redcap's Corner
Well-known member
The class I'm working on has an ability that allows it to use two polymorph effects simultaneously, taking the better of each physical ability score modification, summing the natural armour bonuses of both, and taking the size category of either. Many of the questions I've been asking over the last week or two have been leading up to this particular nightmare. I've come up with the following code to start this ability out.
The error I'm getting is for the line where I attempt to set the attributes, and it says "Error parsing parameter 1 of function". My guess is that it doesn't like my using a variable as only part of the address of a field. Is that correct? If I get the variable to hold the entirety of the address, will it like it better?
Further, I'm going off the assumption that my looping tricks from my QBasic days in middle school will work with foreach statements, but I guess I don't know for sure. With a foreach statement, the code cycles through each match one at a time, allowing me to flag results the way I'm attempting, right? Is there a better way of doing this?
And for reference, here is an example of one of the abilities its drawing from (they all have similar code).
This obviously isn't complete. I still need to setup a size category menu on the Polymeld ability to allow the user to select the size category of their final form. And I need to have each polymorph ability disable each of the others when selected UNTIL polymeld comes online, at which point I need to have each pair of polymorph effects disable each of the others. I believe what I've currently written is enough to get the basic kinks hammered out, though.
Code:
FIRST/20001
~ If the hero doesn't have this ability, ignore the following.
doneif (tagis[Helper.ShowSpec] = 0)
~ Determine the hero's polymorph effects and flag them to work with Polymeld.
foreach pick in hero where "Custom.NoPolymeld"
perform eachpick.delete[Custom.NoPolymeld]
nexteach
~ Determine which two polymorph effects are active.
var polycount as number
var polymorph1 as string
var polymorph2 as string
foreach pick in hero where "Custom.ActivePoly"
if (polycount = 0) then
if (eachpick.field[usrIsCheck].value <> 0) then
polymorph1 = eachpick.idstring
polycount += 1
endif
elseif (polycount = 1) then
if (eachpick.field[usrIsCheck].value <> 0) then
polymorph2 = eachpick.idstring
polycount += 1
endif
endif
nexteach
~ Set the hero's modifiers.
hero.child[aSTR].field[aStartMod].value += maximum(polymorph1.field[abValue].value, polymorph2.field[abValue].value)
hero.child[aDEX].field[aStartMod].value += maximum(polymorph1.field[abValue2].value, polymorph2.field[abValue2].value)
hero.child[aCON].field[aStartMod].value += maximum(polymorph1.field[abValue3].value, polymorph2.field[abValue3].value)
hero.child[ArmorClass].field[tACNatural].value += polymorph1.field[abValue4].value + polymorph2.field[abValue4].value
The error I'm getting is for the line where I attempt to set the attributes, and it says "Error parsing parameter 1 of function". My guess is that it doesn't like my using a variable as only part of the address of a field. Is that correct? If I get the variable to hold the entirety of the address, will it like it better?
Further, I'm going off the assumption that my looping tricks from my QBasic days in middle school will work with foreach statements, but I guess I don't know for sure. With a foreach statement, the code cycles through each match one at a time, allowing me to flag results the way I'm attempting, right? Is there a better way of doing this?
And for reference, here is an example of one of the abilities its drawing from (they all have similar code).
Code:
FIRST/20000
~ Determine the size modifiers for the chosen size category.
var sizetarget as number
if (field[usrIndex].value = 0) then
field[abValue].value = 4
field[abValue3].value = 2
field[abValue4].value = 4
sizetarget = 0
elseif (field[usrIndex].value = 1) then
field[abValue].value = 6
field[abValue3].value = 4
field[abValue4].value = 6
sizetarget = 1
elseif (field[usrIndex].value = 2) then
field[abValue].value = 10
field[abValue3].value = 8
field[abValue4].value = 8
sizetarget = 2
endif
~ If polymeld is overwriting this ability, ignore the following.
doneif (tagis[Custom.NoPolymeld] = 0)
~ If this ability hasn't been activated, ignore the following.
doneif (field[usrIsCheck].value = 0)
~ Set the hero's size category and modifiers.
hero.child[aSTR].field[aStartMod].value += field[abValue].value
hero.child[aCON].field[aStartMod].value += field[abValue3].value
hero.child[ArmorClass].field[tACNatural].value += field[abValue4].value
call SetSizeTo
This obviously isn't complete. I still need to setup a size category menu on the Polymeld ability to allow the user to select the size category of their final form. And I need to have each polymorph ability disable each of the others when selected UNTIL polymeld comes online, at which point I need to have each pair of polymorph effects disable each of the others. I believe what I've currently written is enough to get the basic kinks hammered out, though.
Last edited: