Thread: Helperscript for weapon damage.
-
August 1st, 2010, 20:48 #11
- Join Date
- May 2010
- Posts
- 29
I sent you a pm where you can download my version of the GURPS ruleset.
-
August 1st, 2010, 22:08 #12
- Join Date
- Apr 2010
- Location
- Australia
- Posts
- 898
You should try and co ordinate with spyke so that we do not have divergent rulesets for GURPS. These additions are pretty cool.
Timezone: Australian EST (GMT +10).
Systems/Rulesets: GURPS 4th Edition.
Campaigns (Ultimate License Holder)
GURPS Traveller - The Empty Peace
GURPS Shadowrun - Power Plays
GURPS Banestorm - Dark Clouds Rising
-
August 15th, 2010, 22:48 #13
- Join Date
- Jul 2010
- Location
- orlando
- Posts
- 270
this was something I built off of Kuralds awesome work.
added his 3d6 function to the weapon level also showing the weapon level in the output any modifier in the modstack gets applied to that number and the modified target number is shown with the results as such "swings Flail(10-4=6):" then the result.
Code:function onDrag(button, x, y, draginfo) print("Entering function"); local name = ""; name = window.handweapon_name.getValue(); local method = window.handweapon_mode.getValue(); local level = window.handweapon_skilllevel.getValue(); local des= ModifierStack.getDescription(true); local modifier = ModifierStack.getSum(); local equal ="="; if modifier > 0 then des ="+"; end if des == "+" then nulevel = level + modifier; elseif des == "" then nulevel = level + modifier; end if ModifierStack.isEmpty() then modifier=""; equal = ""; nulevel=""; end local dielist = {} --declare dielist for i=1,3 do --fill dielist according to the expression dielist[i]="d6"; end draginfo.setType("dice"); draginfo.setDieList(dielist); draginfo.setDescription(method.."s "..name.."("..level..des..modifier..equal..nulevel.."):"); ModifierStack.reset() return true; end
latter maybe I can add a parsing function to the dice land in the chat lua to state weather the roll is a possible success of failure.
-
August 17th, 2010, 04:28 #14
- Join Date
- Jul 2010
- Location
- orlando
- Posts
- 270
ok i added a parser tothe chat_chat lua ondiceland function it reads the target number to roll and compares it to the result and tells you possible hit if the result is lower than the target. it also detects critical hit or miss on 3 or 18.
Code:local entry = {}; entry.font = "systemfont"; entry.text = draginfo.getDescription(); entry.dice = draginfo.getDieList(); applyModifierStackToRoll(draginfo); entry.diemodifier = draginfo.getNumberData(); -- never hide rolls (for secret rolls use your desktop as it isn't for players anyway) -- entry.dicesecret = false; -- highest roll local bestresult = 0; for k, d in ipairs(entry.dice) do --if d.result > bestresult then bestresult = bestresult + d.result; --end end local target =string.match(entry.text,"%b()"); if target == nil then bestresult=""; else target = string.match(target, "%d+"); bestresult = string.match(bestresult, "%d+"); if target == "" then --do nothing else if tonumber(bestresult)== "3" then bestresult="[Critical Hit!]"; elseif tonumber(bestresult)== "18" then bestresult = "[Critical Miss!]"; else if tonumber(bestresult) <= tonumber(target) then bestresult = "[ Possible Hit! ]"; else bestresult = ""; end end end end entry.text = entry.text.. bestresult; if User.isHost() then entry.sender = GmIdentityManager.getCurrent(); else entry.sender = User.getIdentityLabel(); end if User.isHost() then entry.icon = "portrait_gm_token"; else entry.icon = "portrait_" .. User.getCurrentIdentity() .. "_miniportrait"; end -- Deliver the chat entry deliverMessage(entry); return true;
made "onDragWeaonsSkill.lua"
Code:function onDrag(button, x, y, draginfo) print("Entering function"); local name = ""; name = window.handweapon_name.getValue(); local method = window.handweapon_mode.getValue(); local level = window.handweapon_skilllevel.getValue(); local des= ModifierStack.getDescription(true); local modifier = ModifierStack.getSum(); local equal ="="; if modifier > 0 then des ="+"; end if des == "+" then nulevel = level + modifier; elseif des == "" then nulevel = level + modifier; end nulevel = "("..nulevel..")"; if ModifierStack.isEmpty() then modifier=""; equal = ""; nulevel=""; if nulevel == "" then level = "("..level..")"; end end local dielist = {} --declare dielist for i=1,3 do --fill dielist according to the expression dielist[i]="d6"; end draginfo.setType("dice"); draginfo.setDieList(dielist); draginfo.setDescription(method.."s "..name.." "..level..des..modifier..equal.." "..nulevel..":"); ModifierStack.reset() return true; end
again this is sloppy I'm no lua programmer I figure since you have to still manually enter any modifiers into the stack and manually adjust figures etc. this should still come within the SJgames online policy.
again thanks goes to spyke, Kurald and tarostar.
-
August 17th, 2010, 05:17 #15
- Join Date
- May 2010
- Posts
- 29
you just have to remember that gurps works the other way round. The modifier modify the target number and not the die roll (like most other rpgs and fantasy ground does).
But thank you for sharing your code. I think I'll put it in my ruleset as well.
-
August 17th, 2010, 11:27 #16
- Join Date
- Jul 2010
- Location
- orlando
- Posts
- 270
already thought of that,it is set to when you grab the die ondrag the modifier from the stack in called and reset and then applied to the target number instead of the roll.
-
August 17th, 2010, 23:29 #17
- Join Date
- Jul 2010
- Location
- orlando
- Posts
- 270
found two bugs in the code I submitted.
first where the code finds looks for the unmodified target pattern.
local target =string.match(entry.text,"%b()");
change the "%b()" to "%(%d+%)"
found this bug when using Kuralds ranged weapon damage, since I use spyke's GCA import/export to insert my characters into FG the ranged weapons in the weapon field sometimes look like such: Large Knife (thrown)
causing a conflicting instance of the %b() patern.
next where it looks for critical hits or misses:
tonumber(bestresult)== "3"
and
tonumber(bestresult)== "18"
change the "3" to tonumber('3')
change the 18 to tonumber('18')
these two I have no excuse other than I do not know what I'm doing and getting clueless in my old age.
-
August 19th, 2010, 19:04 #18
Sorry I've been out the loop for a while, guys. Been very busy. I will get round at some point before too long to reviewing the various code contributions and figuring out what I'm comfortable with building into the main ruleset.
SpykeFree GURPS tools for Fantasy Grounds at www.spyke.me.
-
August 28th, 2010, 20:48 #19
- Join Date
- Jul 2010
- Location
- orlando
- Posts
- 270
finally figured out how to get kuralds script to the skills tab. took a while of hacking about.
I discovered that the charsheet_templates.xml was over riding the ondrag function.
so i edited the section for the textlistitemvalue template. by first removing the nodrag tag.
then below the onlosefocus() function, I added the onDrag function.
Code:function onDrag(button, x, y, draginfo) local checker = ""; if not editmode then if hoverontext then draginfo.setType("shortcut"); draginfo.setShortcutData(window[linktarget[1]].getValue()); draginfo.setIcon(window[linktarget[1]].icon[1].normal[1]) return true; else checker = getDatabaseNode().getName(); if checker == "skill_level" then local level = window.getDatabaseNode().getChild("skill_level").getValue(); local name = window.getDatabaseNode().getChild("skill_name").getValue(); local des= ModifierStack.getDescription(true); local modifier = ModifierStack.getSum(); local equal ="="; if modifier > 0 then des ="+"; end if des == "+" then nulevel = level + modifier; elseif des == "" then nulevel = level + modifier; end nulevel = "("..nulevel..")"; if ModifierStack.isEmpty() then modifier=""; equal = ""; nulevel=""; if nulevel == "" then level = "("..level..")"; end end local dielist = {}; for i=1,3 do dielist[i]="d6"; end draginfo.setType("dice"); draginfo.setDieList(dielist); draginfo.setDescription("#"..name.." "..level..des..modifier..equal.." "..nulevel..":"); ModifierStack.reset(); end return true; end end end
note the # in the line:
draginfo.setDescription("#"..name.." "..level..des..modifier..equal.." "..nulevel..":");
so it can be found by the parser in the chat_chat.lua which ws modified to handle messages starting with #.
Code:local entry = {}; entry.font = "systemfont"; entry.text = draginfo.getDescription(); entry.dice = draginfo.getDieList(); applyModifierStackToRoll(draginfo); entry.diemodifier = draginfo.getNumberData(); -- never hide rolls (for secret rolls use your desktop as it isn't for players anyway) -- entry.dicesecret = false; -- highest roll local bestresult = 0; for k, d in ipairs(entry.dice) do --if d.result > bestresult then bestresult = bestresult + d.result; --end end local target =string.match(entry.text,"%(%d+%)"); if target == nil then bestresult=""; else target = string.match(target, "%d+"); bestresult = string.match(bestresult, "%d+"); if target == "" then --do nothing else if tonumber(bestresult)== tonumber('3') then bestresult="[Critical Hit!]"; elseif tonumber(bestresult)== tonumber('18') then bestresult = "[Critical Miss!]"; else if tonumber(bestresult) <= tonumber(target) then bestresult = "[ Possible Hit! ]"; else bestresult = ""; end end end if string.match(entry.text, "%#") and bestresult == "[ Possible Hit! ]" then bestresult = "[Success!]"; entry.text = string.gsub(entry.text, "%#", ""); end if string.match(entry.text, "%#") and bestresult == "" then bestresult = "[Failure!]"; entry.text = string.gsub(entry.text, "%#", ""); end if string.match(entry.text, "%#") and bestresult == "[Critical Hit!]" then bestresult = "[Crtical Success!]"; entry.text = string.gsub(entry.text, "%#", ""); end if string.match(entry.text, "%#") and bestresult == "[Critical Miss!]" then bestresult = "[Crtical Failure!]"; entry.text = string.gsub(entry.text, "%#", ""); end end entry.text = entry.text.. bestresult; if User.isHost() then entry.sender = GmIdentityManager.getCurrent(); else entry.sender = User.getIdentityLabel(); end if User.isHost() then entry.icon = "portrait_gm_token"; else entry.icon = "portrait_" .. User.getCurrentIdentity() .. "_miniportrait"; end -- Deliver the chat entry deliverMessage(entry); return true; end
these are all modifications to Kuralds helper script.
-
March 4th, 2013, 14:35 #20
Damage Modifiers
I wonder if there is some way and if there is how do I make adjustments to damage rolls for different types of attack (cut, pierce, impale).
And I wonder if you can build something that reduces the damage before modifiers.
Example: I have a character with ST 15 and a spear.
He 1d6 + 3 damage, say he attack an NPC with leather armor (DR 2 *). And the damage roll has rolled 6. The damage will be 9 -2 (DR) = 7 +100% = 14
In FG he says I got attacked successfully, roll the damage when he shows the amount and type but in doing the calculations.
I just believe that this would facilitate more life for all, since getting the exact result can already drag for HP (player or NPC) and decrement.
I also believe that it would be no problem, at least in my view.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks