-
April 13th, 2025, 03:54 #1
- Join Date
- Nov 2019
- Posts
- 345
Question about IF and IFT and changing them
In 3.5/pathfinder 1e IF and IFT have the following ALIGN, SIZE, TYPE, CUSTOM, healthy, Wounded, bloodied.
If I wanted to add something new to that list where should I start looking on where to add the code to add the new item?
Are the strings and a callback function in someway registered or is it more complicated with replacing functions in multiple managers_ files?
Some simple direction to start looking would be greatly appreciated.
Or if someone knows of an extension for pathfinder 1e that would allow something like the following: IFT: RANGE(>n) or IFT: RANGE(<=n), etc please point me that way.
Thanks.
-
April 13th, 2025, 19:59 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 22,204
Perform a search for those strings in the 3.5E ruleset to find where those are used/checked. I recommend using a text editor that can perform multi-file/folder searching. It would require an extension to override the functions that check those tags.
Regards,
JPG
-
April 13th, 2025, 20:03 #3
- Join Date
- Nov 2019
- Posts
- 345
I wasn't sure even which ruleset they were in, but 3.5 makes sense.
Thanks.
-
April 13th, 2025, 23:37 #4
- Join Date
- Nov 2019
- Posts
- 345
Another couple of questions.
Question 1:
I found the checkConditional function and I can add what I wanted there.
Looking at other items in that function I have rActor and rTarget.
I found in the API documentation the Token object and it's functions getDistanceBetween and getToken.
To use getDistanceBetween I need the token for both rActor and rTarget.
getToken requires containernodename, containerid being passed to it.
What do I need to do to get that information from rActor and rTarget?
Question 2:
getDistanceBetween says, "Returns the distance (in game system units) between two tokens. If the tokens specified are not in the same image value (i.e. map), then zero will be returned."
The return value it says would be, "The distance between the two specified tokens in game system units."
This sounds like it is returning the distance between the outside edges of the two tokens.
So, if both tokens overlap each other or one is completely within the area of the other what would this function return?
For visual within 3.5 or pathfinder you have an ogre that takes up a 10 foot by 10 foot square and a human that is 5 feet by 5 feet. The human could be within the area the ogre takes up.
Or if you have a huge dragon that is taking up 15 feet by 15 feet and the human again could be within the area that the dragon takes up.
Will it return 0 or will it return something that would indicate that there is overlap? like say a negative number?
-
April 14th, 2025, 02:47 #5
Use CombatManager.getTokenFromCT(rActor); to get the token instance.
Have a look at the function getRangeBetween in the PFRPG2 ruleset scripts\manager_action_attack.lua file for example of how to get the range between rActor and rTarget. Hopefully this will get you going in the right direction.
I suggest you test out the various range calculation examples you mention.Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
April 15th, 2025, 00:14 #6
- Join Date
- Nov 2019
- Posts
- 345
Thank you. I figured it out.
I modified the checkConditional function in scripts\manager_effect_35E.lua file.
Code:local sRangeCheck = sLower:match("^range%s*%(([^)]+)%)$"); -- added after the line getting a string for the variable sCustomCheck. -- The following was added after the elseif sCustomCheck then elseif sRangeCheck then if not checkConditionalRangeHelper(rActor, sRangeCheck, rTarget) then bReturn = false; break; end -- The following function was added to the above file. function checkConditionalRangeHelper(source, sEffect, target) if not source or not target then return false; end local sInequality, sRange = sEffect:match("^([<>=]+)(%d+)"); 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 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
-
April 16th, 2025, 05:05 #7
-
April 16th, 2025, 17:53 #8
- Join Date
- Nov 2019
- Posts
- 345
I believe that getTokenFromCT will return nil if either character/npc on the combat tracker are not on a map. Which means that the if not after the getTokenFromCT will return false. This would mean that the IFT is returning fasle and the rest of the effect after it will be ignored.
If both charactyers/npcs are on a map, but not the same one then, looking at the refrence material for the getDistanceBetween it will return zero if the tokens aren't on the same map. Being that zero is also returned for icons that are overlaping the code will end up treating IFT: Range(=0) to be the same as the Tokens not being on the same map.
I think that if both tokens are on a map but they aren't on the same map then the getDistanceBetween should return nil instead of zero as zero also means they are overlapping.Last edited by rmilmine; April 16th, 2025 at 18:00.
-
April 16th, 2025, 18:15 #9
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 22,204
The Token.getDistanceBetween API already does that. I'll update the Image.getDistanceBetween and imagecontrol.getDistanceBetween APIs to do the same.
Regards,
JPG
-
April 16th, 2025, 18:46 #10
- Join Date
- Nov 2019
- Posts
- 345
The reference material for Token.getDistanceBetween is out of date then as it says it returns Zero if the tokens are not on the same Image.
The code I posted then needs to check for nil.
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
Last edited by rmilmine; April 16th, 2025 at 19:19.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks