STAR TREK 2d20
Page 12 of 53 First ... 2101112131422 ... Last
  1. #111
    Quote Originally Posted by nephranka View Post
    Yes. When I only have this ext and the range & flanking ext loaded you get the dbl-count.

    Sadly, I think Kent has been out for a while with no return stated. This is a fairly big deal for me since I have a lot of ranged pcs and keeping track of all that comes with that is a big help, so the range & flanking ext is essential for my table.
    I also use this extension and am getting the same issue. I wish there was a way to gift in the Forge because I would totally gift bmos this so he could figure it out...

  2. #112
    Quote Originally Posted by Rivanknight220 View Post
    I also use this extension and am getting the same issue. I wish there was a way to gift in the Forge because I would totally gift bmos this so he could figure it out...
    Thanks all the same, but nephranka already got me the info I needed.

    Here is the fix:
    open AutomaticFlankingAndRange.ext\campaign\scripts\cha r_weapon_afar.lua
    replace everything from "function customOnAttackAction" to the end of the file with:
    Code:
    function customOnAttackAction(draginfo)
    	--Debug.chat("my customOnAttackAction");
    	local nodeWeapon = getDatabaseNode();
    	local nodeChar = nodeWeapon.getChild("...")
    
    	-- Build basic attack action record
    	local rAction = CharWeaponManager.buildAttackAction(nodeChar, nodeWeapon);
    
    	-- bmos removing redundant ammo counting
    	-- for compatibility with ammunition tracker, make this change in your char_weapon.lua
    	-- this if section replaces the commented out line above: "CharWeaponManager.decrementAmmo(nodeChar, nodeWeapon);"
    	if not AmmunitionManager then
    		CharWeaponManager.decrementAmmo(nodeChar, nodeWeapon);
    	end
    	-- end bmos removing redundant ammo counting
    
    	-- Perform action
    	local rActor = ActorManager.resolveActor(nodeChar);
    	-- ActionAttack.performRoll(draginfo, rActor, rAction);
    	-- return true;
    
    	-- kent adding itemPath to rActor so that when effects are checked we can 
    	-- make compare against action only effects
    	local _, sRecord = DB.getValue(nodeWeapon, "shortcut", "", "");
    	rActor.itemPath = sRecord;
    	-- end kent adding itemPath to rActor so that when effects are checked we can 
    
    	-- bmos only allowing attacks when ammo is sufficient
    	-- for compatibility with ammunition tracker, make this change in your char_weapon.lua
    	-- this if section replaces the two commented out lines above:
    	-- "ActionAttack.performRoll(draginfo, rActor, rAction);" and "return true;"
    	local nMaxAmmo = DB.getValue(nodeWeapon, 'maxammo', 0)
    	local nMaxAttacks = nMaxAmmo - DB.getValue(nodeWeapon, 'ammo', 0)
    	if not AmmunitionManager or (not (nMaxAmmo > 0) or (nMaxAttacks >= 1)) then	
    		ActionAttack.performRoll(draginfo, rActor, rAction);
    		return true;
    	else
    		ChatManager.Message(Interface.getString("char_message_atkwithnoammo"), true, rActor);
    	end
    	-- end bmos only allowing attacks when ammo is sufficient
    end

  3. #113
    Thanks bmos!

    This did totally fix that issue with range & flanking. Had a few more to resolve but it is all working now.

  4. #114
    Worked like a charm. A thousand thank yous good sir!

  5. #115
    Quote Originally Posted by nephranka View Post
    Thanks bmos!

    This did totally fix that issue with range & flanking. Had a few more to resolve but it is all working now.
    If you feel comfortable doing so you can share any compatibility patches for other currently un-maintained extensions here in my thread.

  6. #116
    Quote Originally Posted by bmos View Post
    If you feel comfortable doing so you can share any compatibility patches for other currently un-maintained extensions here in my thread.
    Totally.

    In this case your fixes caught most of the others accept for Advanced effects. Once I used your link to the suggested fix (early in the thread) I was able to fold it into the advanced effects ext while we are waiting for celestian to accept the code. He did respond that he is busy with work stuff, so it might be awhile. Either way, you code worked. So, if you have the most recent version of this ext, the fix for range & flanking, and the advance effects fix then that should cover most issues. I run like 99 exts so I have a good test bed ;P

  7. #117
    Just trying out the extension and I really like the idea! One thing though, it seems like you use the onAttack function? My Nat20 extension does too, but if you don't call the normal onAttack action it bypasses all the Nat20 code. I could try a loadorder change to see if that helps, but your extension looks like it loads in the vault so I can't debug it.

    Thanks!

  8. #118
    Quote Originally Posted by TheoGeek View Post
    Just trying out the extension and I really like the idea!
    Glad you like it and thanks for letting me know about this issue.
    Quote Originally Posted by TheoGeek View Post
    it seems like you use the onAttack function? My Nat20 extension does too, but if you don't call the normal onAttack action it bypasses all the Nat20 code.
    Because of the "hit margin tracking" feature, I need access to some numbers only accessible from inside that function.
    Quote Originally Posted by TheoGeek View Post
    your extension looks like it loads in the vault so I can't debug it.
    Check the first post. All of my code is freely available on GitHub for collaboration, modification, and debugging. If you look at my onAttack function, I have separated out some "compatibility blocks" that make adding support to other extensions easy. Just change this line in your onAttack function:
    Code:
    	Comm.deliverChatMessage(rMessage);
    to this:
    Code:
    	--	bmos adding hit margin tracking
    	--	for compatibility with ammunition tracker, add this here in your onAttack function
    	if AmmunitionManager then
    		local nHitMargin = AmmunitionManager.calculateMargin(nDefenseVal, rAction.nTotal)
    		if nHitMargin then table.insert(rAction.aMessages, "[BY " .. nHitMargin .. "+]") end
    	end
    	--	end bmos adding hit margin tracking
    	
    	Comm.deliverChatMessage(rMessage);
    	
    	--	bmos adding automatic ammunition ticker and chat messaging
    	--	for compatibility with ammunition tracker, add this here in your onAttack function
    	if AmmunitionManager and ActorManager.isPC(rSource) then AmmunitionManager.ammoTracker(rSource, rRoll.sDesc, rAction.sResult, true) end
    	--	end bmos adding automatic ammunition ticker and chat messaging
    If your extension calls the previous onAttack (doesn't need to overwrite it), you can just load after mine (although I don't have a loadorder defined right now). Let me know if a loadorder is necessary to help improve compatibility with your extension.
    Last edited by bmos; September 4th, 2021 at 01:00.

  9. #119
    Thanks bmos...I'll look into that. I think the issue for me right off the bat is that I don't have a "copy" of the onAttack function in my extension, I simply set a local array tracker for a nat20, call the original onAttack, and then generate the message for display. Because of that, I don't have visibility to the rAction struct, and pasting your code into mine wouldn't work.

    In my Nat20 extension, I replaced:

    Code:
        ActionAttack.Nat20_Original_onAttack(rSource, rTarget, rRoll)
    ... with ...

    Code:
        
        if AmmunitionManager then
            AmmunitionManager.onAttack_5e(rSource, rTarget, rRoll)
        else
            ActionAttack.Nat20_Original_onAttack(rSource, rTarget, rRoll)
        end
    but it looks like the Nat20 onAttack isn't even executed if your extension loads after mine, so I also changed the loadorder of Nat20 to "51" and that seems to have fixed things.

    I'll do some more testing and update Nat20 if everything goes well.

    Thanks!

  10. #120
    Ooh...also, since I saw some "suggestions" ...

    How hard would it be to automatically equip and unequip ammo when loaded or unloaded? It would play well with AutomaticEffects that way.

    Thanks for the cool extension!

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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
  •  
5E Character Create Playlist

Log in

Log in