STAR TREK 2d20
  1. #1

    Weapon properties, possible bug?

    So while working on some documentation I ran across the 5e description of weapon properties.

    The weapon's properties should follow those noted in the PHB so that Fantasy Grounds recognises what they mean, Thus the acceptable properties would be, light, finesse, thrown, heavy, two-handed, reach etc. Also record here whether the weapon is magical or is made from rare materials. Acceptable words are magic, silver, adamantine. Properties should be listed separated by commas e.g light, finesse, silver, magic. Two further properties are available 'crit range x' will determine whether this weapon criticals on a number less than 20 (crit range 19 for crit on 19-20); and 'reroll x' where a weapon rerolls damage dice (for example reroll 2 will reroll any 1's and 2's that come up on the damage dice and take the rerolled values).
    So, that seems to imply adding "magic,finesse" to the property value of a weapon that the weapon would then act like it was magic on damage? It doesn't appear to do that.

    I noticed the same thing in the AD&D ruleset and corrected it. This should work for 5E.

    Location: char_weapon.lua
    Code:
    function onDamageAction(draginfo)
    	local nodeWeapon = getDatabaseNode();
    	local nodeChar = nodeWeapon.getChild("...")
    	local rActor = ActorManager.getActor("pc", nodeChar);
    
    	local aWeaponProps = StringManager.split(DB.getValue(nodeWeapon, "properties", ""):lower(), ",", true);
    	
    	local rAction = {};
    	rAction.bWeapon = true;
    	rAction.label = DB.getValue(nodeWeapon, "name", "");
    	if type.getValue() == 0 then
    		rAction.range = "M";
    	else
    		rAction.range = "R";
    	end
    
    	local sBaseAbility = "strength";
    	if type.getValue() == 1 then
    		sBaseAbility = "dexterity";
    	end
    	
    	-- Check for reroll tag
    	for _,vProperty in ipairs(aWeaponProps) do
    		local nPropReroll = tonumber(vProperty:match("reroll (%d+)")) or 0;
    		if nPropReroll > 0 then
    			rAction.nReroll = nPropReroll;
    		end
    	end
    	
    	rAction.clauses = {};
    	local aDamageNodes = UtilityManager.getSortedTable(DB.getChildren(nodeWeapon, "damagelist"));
    	for _,v in ipairs(aDamageNodes) do
    		local sDmgAbility = DB.getValue(v, "stat", "");
    		if sDmgAbility == "base" then
    			sDmgAbility = sBaseAbility;
    		end
    		local nAbilityBonus = ActorManager2.getAbilityBonus(rActor, sDmgAbility);
    		local nMult = DB.getValue(v, "statmult", 1);
    		if nAbilityBonus > 0 and nMult ~= 1 then
    			nAbilityBonus = math.floor(nMult * nAbilityBonus);
    		end
    		local aDmgDice = DB.getValue(v, "dice", {});
    		local aDmgReroll = nil;
    		if rAction.nReroll then
    			aDmgReroll = {};
    			for kDie,vDie in ipairs(aDmgDice) do
    				aDmgReroll[kDie] = rAction.nReroll;
    			end
    		end
    		local nDmgMod = nAbilityBonus + DB.getValue(v, "bonus", 0);
    		local sDmgType = DB.getValue(v, "type", "");
    		
        -- this will check the properties on the weapon and apply addition damage types found
        local aWeaponDamageTypes = StringManager.split(sDmgType,",",true);
        for _,sProp in ipairs(aWeaponProps) do
          if StringManager.contains(DataCommon.dmgtypes, sProp) and 
              not StringManager.contains(aWeaponDamageTypes, sProp) then
            table.insert(aWeaponDamageTypes, sProp);
          end
        end
        sDmgType = table.concat(aWeaponDamageTypes,", ");
        --    
    		table.insert(rAction.clauses, { dice = aDmgDice, stat = sDmgAbility, statmult = nMult, modifier = nDmgMod, dmgtype = sDmgType, reroll = aDmgReroll });
    	end
    	
    	ActionDamage.performRoll(draginfo, rActor, rAction);
    	return true;
    end

    The bold bit is what I added.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  2. #2
    It doesn't do it dynamically; it only takes those into account when first adding the weapon to the PC sheet and creating the linked weapon entry.

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    It doesn't do it dynamically; it only takes those into account when first adding the weapon to the PC sheet and creating the linked weapon entry.

    Regards,
    JPG
    Oh, so if you manually create a weapon it is not intended to work?
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  4. #4
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    Quote Originally Posted by celestian View Post
    Oh, so if you manually create a weapon it is not intended to work?
    It works - but you would need to drag it off and then back on the charsheet.

  5. #5
    Quote Originally Posted by damned View Post
    It works - but you would need to drag it off and then back on the charsheet.
    If you manually create an attack in 5e actions tab you can't drag/drop it back. There is no shortcut.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  6. #6
    That’s right. It only works if you drag and drop from item records to PC sheet. If you create manually, then you have to set up any property modifications manually too.

    JPG

  7. #7
    Would it work if I created a new Item group, say "Homebrews", create a weapon in there (or drag one there and then modify it) and drag that to a character's inventory? Or create/modify a weapon in a Package? I'm not at my pc right now to check...

    €dit: NM, I just tested (didn't realize I had FG installed on this PC as well, with a demo license) with a newly created weapon: dragged from Equipment sheet to a new Test group in Items, edited that, and dragged that back to the character. Worked like a charm.
    Last edited by Roach; December 28th, 2019 at 07:28.

  8. #8
    In the case of a manually created weapon, you would need to add the magic keyword to the damage type, not the properties. so piercing, magic for the damage type.
    For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e

  9. #9
    Quote Originally Posted by Moon Wizard View Post
    That’s right. It only works if you drag and drop from item records to PC sheet. If you create manually, then you have to set up any property modifications manually too.

    JPG
    If you'd like the feature to work for anything the code snippet included should work for 5e. It won't add it if it already exists so should be sane for manually created or drag/dropped.

    Thanks for the details.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  10. #10
    Zacchaeus's Avatar
    Join Date
    Dec 2014
    Location
    Scotland
    Posts
    20,826
    Quote Originally Posted by mattekure View Post
    In the case of a manually created weapon, you would need to add the magic keyword to the damage type, not the properties. so piercing, magic for the damage type.
    Just for completeness if you create a weapon as a template and add magic as a property; when you combine it in the forge with a mundane weapon it adds magic damage automatically
    Attached Images Attached Images
    If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in