Thread: Help With Spell Cast Scripts
-
May 15th, 2015, 12:25 #1
Help With Spell Cast Scripts
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:
Code:<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>
Code: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
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.DCC Ruleset Wiki: https://github.com/bwgibs/dcc-ruleset/wiki
-
May 15th, 2015, 12:30 #2
Ok, I solved my own problem. Usually it takes typing out my question to get the answer.
local sSpellClass = DB.getValue(rCreature, class, "");
rCreature should have been nodeChar. It now returns the correct value.DCC Ruleset Wiki: https://github.com/bwgibs/dcc-ruleset/wiki
-
May 16th, 2015, 01:43 #3
Post deleted. Spelling apparently matters...
Last edited by leozelig; May 16th, 2015 at 13:19. Reason: Problem solved
DCC Ruleset Wiki: https://github.com/bwgibs/dcc-ruleset/wiki
-
May 16th, 2015, 13:25 #4
The spell cast rolls are working, including critical hit and disapproval/misfire handling. I might set it up to auto-increase disapproval range, but only if the failure cut-off is the same for all spells. I have to check that. Critical hits add the PCs level to the roll, per the rules.
I have some more bugs to fix, and I need to decide which effects I want to keep. I hope to have something ready for play testing soon!DCC Ruleset Wiki: https://github.com/bwgibs/dcc-ruleset/wiki
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks