PDA

View Full Version : Creating a Skill-List & a Stress Die



Oberoten
May 7th, 2007, 11:34
... I seem to be unable to make either heads or tails of this.

What I need (and try to create) is a list of skills that should contain :

Skillname as a string,
Specialization as a string
Cost / Level as a Numbercontrol
A level as a Numbercontrol
And finally a "Cost Total" taken from : Cost * ((Level^2)/2+Level/2)

I'd prefer to have this in a scroll-list adding new lines as one keeps typing in new skills and finally drop a "Total XP Spent" somewhere on the character-sheet but I am thinking once I have the basic framework in place THAT I should at the least be able to do by Trial & Error.

And for some reason my mind seems to be unwilling and unable to wrap itself around how to do this in the LUA, XML combination used in FG2...

The Second problem

I need to create a open-ended Dice that Auto-Sums itself : IE, if the D10 comes down a 10, it should re-roll and then sum the rolls together, if it keeps landing a 10 keep adding and rolling.

... if I have that much I am sure I should be able to add the infamous ArsMagica stress-die. (Well it sure is stressing me when I can't get it to work.)

TarynWinterblade
May 7th, 2007, 20:45
Stress die:
This one is fairly simple (though, of course, this change for it will make it so that every time you roll a d10, you end up getting the open-ended feature)

In chat_chat.lua, you need to modify the following code:


function onDiceLanded(draginfo)
if draginfo.isType("fullattack") then
-- Full attack stuff goes here. Don't change any of this.. right now anyway
elseif draginfo.isType("dice") then
for k, v in pairs(draginfo.getDiceList()) do
if v.type == "d10" and v.result == 10 then
throwDice("dice",{"d10"},draginfo.getNumberData() + 10,"Open-ended d10")
end
end
applyModifierStackToRoll(draginfo);
end
end


What that should do:
(haven't tested the code just yet, but I think that's how I did it last time I was tinkering with it)... every time you roll a d10 (anywhere), and it comes up a 10, it will automatically reroll it until it doesn't come up a 10.


Ways to fix that:
Make a section of... erm... well, actually I have no clue about Ars Magica, so I don't know where you'd want to add it. But... anyway! Somewhere on the character sheet, or the desktop, or somewhere... :confused: ... add in a box:



<genericcontrol>
<script>
function onDrag(button, x, y, draginfo)
draginfo.setType("stress");
draginfo.setDescription("Stress die");
draginfo.setSlot(1);
draginfo.setDieList({ "d10" });
draginfo.setNumberData(0);
return true;
end
</script>
</genericcontrol>

... then, we go to desktop_classes.xml, and add the line in red:



<windowclass name="chat">
<sheetdata>
<chatwindow name="chat">
<droptypes>
<type>dice</type>
<type>number</type>
<type>string</type>
<type>fullattack</type>
<type>stress</type>
</droptypes>
</chatwindow>
</sheetdata>
</windowclass>

... finally, we go back to chat_chat.lua, and modify our earlier code:


function onDiceLanded(draginfo)
if draginfo.isType("fullattack") then
-- Full attack stuff goes here. Don't change any of this.. right now anyway
elseif draginfo.isType("stress") then
for k, v in pairs(draginfo.getDiceList()) do
if v.type == "d10" and v.result == 10 then
throwDice("dice",{"d10"},draginfo.getNumberData() + 10,"Open-ended d10")
end
end
applyModifierStackToRoll(draginfo);
elseif draginfo.isType("dice") then
applyModifierStackToRoll(draginfo);
end
end

... and that should do it.

I hope that helps a little (and I hope that my code actually works... I just woke up. :o).

Oberoten
May 8th, 2007, 08:52
Alas not much luck, and I can't even give a error-message since it has so far managed to crash FG every time I try it.

Maybe I could just do something in the chatmanager.lua with a normal randomizer and skip the graphic dice...

TarynWinterblade
May 9th, 2007, 03:12
*frown*

I wonder which part I screwed up the code on... >.<

Sorry.