DICE PACKS BUNDLE
Page 2 of 2 First 12
  1. #11
    So checkConditionalRangeHelper should look like this:

    Code:
    function checkConditionalRangeHelper(source, sEffect, target)
    	if not source or not target then
    		return false;
    	end
    	local sInequality, sRange = sEffect:match("^([<>=]+)(%d+)");
    	if not sInequality or not sRange then
    		return false;
    	end
    	local nRange = tonumber(sRange);
    	if not nRange then
    		return false;
    	end
    	
    	local sourceNode = ActorManager.getCTNode(source);
    	local targetNode = ActorManager.getCTNode(target);
    
    	if not sourceNode or not targetNode then
    		return false;
    	end;
    	
    	local sourceToken = CombatManager.getTokenFromCT(sourceNode);
    	local targetToken = CombatManager.getTokenFromCT(targetNode);
    
    	if not sourceToken or not targetToken then
    		return false;
    	end
    	
    	nTokenDistance = Token.getDistanceBetween(sourceToken, targetToken);
    	
    	if not nTokenDistance THEN
    		return false;
    	end
    	if sInequality == "=" and nRange == nTokenDistance then
    		return true;
    	elseif sInequality == ">" and nTokenDistance > nRange then
    		return true;
    	elseif sInequality == "<" and nTokenDistance < nRange then
    		return true;
    	elseif sInequality == ">=" and nTokenDistance >= nRange then
    		return true;
    	elseif sInequality == "<=" and nTokenDistance <= nRange then
    		return true;
    	end
    	return false;
    end
    Every variable is now checked after trying to retrieve it's data. If the variables values is nil after doing so the function returns false.
    If all the variables have data in them, then the function returns true based on the if statements at the end, or it returns false if none of the if statements are true.

  2. #12
    Docs updated. Note that the changes for Image/imagecontrol returning nil are only available in v4.7.0+.

    Regards,
    JPG

  3. #13
    Thanks Moon Wizard.

    Again, if you think that having this would be good in the base code for 3.5/Pathfinder or any other game you want it in you are welcome to use this code.

  4. #14
    Appreciate that. Definitely something that I think would be useful; but I was trying to wait until I had time for some of the prototypes I had to allow easier registration of these sorts of checks.

    Regards,
    JPG

  5. #15
    I was thinking that having something that registers effects tags along with say tag type and possibly a call back function would be kinda nice for doing effects. Just not sure how efficient it would be.
    Last edited by rmilmine; April 17th, 2025 at 01:18.

Page 2 of 2 First 12

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
  •  
GI JOE RPG Launch

Log in

Log in