leozelig
May 15th, 2015, 12:25
Hey,
I am having trouble getting my spell cast scripts to behave... I have templates set up for the controls and scripts very similar to the attack roll scripts in 3.5E. Instead of checking for melee or ranged, I want to check for class (cleric or wizard) when building the roll.
Here is the template:
<template name="number_charbasespellcheck">
<number_chartotal>
<rollable />
<displaysign />
<modifiersize>mini</modifiersize>
<script>
function action(draginfo)
local rActor, rSpellCast = CharManager.getBaseSpellCastRollStructures(window. getDatabaseNode(), self.description[1].text[1]);
Debug.Console(rSpellCast);
ActionSpell.performRoll(draginfo, rActor, rSpellCast);
return true;
end
function onDragStart(button, x, y, draginfo)
return action(draginfo);
end
function onDoubleClick(x,y)
return action();
end
</script>
</number_chartotal>
</template>
<template name="number_charbasespellcheckcleric">
<number_charbasespellcheck>
<description><text>Base Spell Check</text></description>
<modifierfield>spellcheck.cleric.temporary</modifierfield>
<source><name>level</name><op>+</op></source>
<source><name>abilities.personality.bonus</name><op>+</op></source>
</number_charbasespellcheck>
</template>
<template name="number_charbasespellcheckwizard">
<number_charbasespellcheck>
<description><text>Base Spell Check</text></description>
<modifierfield>spellcheck.wizard.temporary</modifierfield>
<source><name>level</name><op>+</op></source>
<source><name>abilities.intelligence.bonus</name><op>+</op></source>
</number_charbasespellcheck>
</template>
Here is the getBaseSpellCastRollStructures script in the character manager:
function getBaseSpellCastRollStructures(nodeChar, sSpellCast)
local rCreature = ActorManager.getActor("pc", nodeChar);
local rSpellCast = {};
rSpellCast.type = "cast";
rSpellCast.label = sSpellCast;
215 local sSpellClass = DB.getValue(rCreature, "class", "");
Debug.console(sSpellClass);
if string.match(string.lower(sSpellClass), "cleric") then
rSpellCast.modifier = DB.getValue(nodeChar, "spellcheck.cleric.total", 0);
rSpellCast.stat = "personality";
else
rSpellCast.modifier = DB.getValue(nodeChar, "spellcheck.wizard.total", 0);
rSpellCast.stat = "intelligence";
end
return rCreature, rSpellCast;
end
Here is the error I am getting:
Script Error: [string "campaign/scripts/manager_char.lua"]:215: getValue: Invalid parameter 1
Anyone know what I am doing wrong?
I did confirm that rCreature is the correct databasenode for class, and the class field is where it should be in the db.xml file. Somehow, it does not want to retrieve the string value for class.
I am having trouble getting my spell cast scripts to behave... I have templates set up for the controls and scripts very similar to the attack roll scripts in 3.5E. Instead of checking for melee or ranged, I want to check for class (cleric or wizard) when building the roll.
Here is the template:
<template name="number_charbasespellcheck">
<number_chartotal>
<rollable />
<displaysign />
<modifiersize>mini</modifiersize>
<script>
function action(draginfo)
local rActor, rSpellCast = CharManager.getBaseSpellCastRollStructures(window. getDatabaseNode(), self.description[1].text[1]);
Debug.Console(rSpellCast);
ActionSpell.performRoll(draginfo, rActor, rSpellCast);
return true;
end
function onDragStart(button, x, y, draginfo)
return action(draginfo);
end
function onDoubleClick(x,y)
return action();
end
</script>
</number_chartotal>
</template>
<template name="number_charbasespellcheckcleric">
<number_charbasespellcheck>
<description><text>Base Spell Check</text></description>
<modifierfield>spellcheck.cleric.temporary</modifierfield>
<source><name>level</name><op>+</op></source>
<source><name>abilities.personality.bonus</name><op>+</op></source>
</number_charbasespellcheck>
</template>
<template name="number_charbasespellcheckwizard">
<number_charbasespellcheck>
<description><text>Base Spell Check</text></description>
<modifierfield>spellcheck.wizard.temporary</modifierfield>
<source><name>level</name><op>+</op></source>
<source><name>abilities.intelligence.bonus</name><op>+</op></source>
</number_charbasespellcheck>
</template>
Here is the getBaseSpellCastRollStructures script in the character manager:
function getBaseSpellCastRollStructures(nodeChar, sSpellCast)
local rCreature = ActorManager.getActor("pc", nodeChar);
local rSpellCast = {};
rSpellCast.type = "cast";
rSpellCast.label = sSpellCast;
215 local sSpellClass = DB.getValue(rCreature, "class", "");
Debug.console(sSpellClass);
if string.match(string.lower(sSpellClass), "cleric") then
rSpellCast.modifier = DB.getValue(nodeChar, "spellcheck.cleric.total", 0);
rSpellCast.stat = "personality";
else
rSpellCast.modifier = DB.getValue(nodeChar, "spellcheck.wizard.total", 0);
rSpellCast.stat = "intelligence";
end
return rCreature, rSpellCast;
end
Here is the error I am getting:
Script Error: [string "campaign/scripts/manager_char.lua"]:215: getValue: Invalid parameter 1
Anyone know what I am doing wrong?
I did confirm that rCreature is the correct databasenode for class, and the class field is where it should be in the db.xml file. Somehow, it does not want to retrieve the string value for class.