PDA

View Full Version : Advanced Effects, Item Only Effects (action only?)



celestian
October 17th, 2017, 05:45
So, with the addition of the Advanced Effects extension I've been working on you're able to apply effects to item, npcs and player records and when you drag/drop those npc/pcs into the combat tracker it automatically applies the effects.

Sounds great? Well, it is (not because I did it mind you) but there is a little quibble with it. If you give a weapon "ATK: 1" that character now has +1 to hit with ALL weapons, not just that weapon.

So.... I've been pondering how best to deal with that w/o doing a lot of code work and I made a proof of concept run tonight and it worked. Here is how it functions.


When the player attacks the item's path (charsheet.XXXX.inventorylist.id-XXXX) is handed off in rAction as rAction.itemPath.
During the actionAttack mod I then check for .itemPath exists.
If it exists then create rItem.X (matching rSource except for sCTNode)
After I check getEffects*(rSource) I also do a getEffects*(rItem).
The effects are added together and the modifier function returns them all and the attack bonuses are applied.
Walla, attack works and the bonus will ONLY apply if that weapon is used.


Tonight I just copy/pasted a effects.* block into the item so I've got code work to do to manage adding the "action only" effects from Advanced Effects to the item as ".effects.*".

Need more extensive testing but preliminary work seems promising.

Anyone see any holes or have suggestions?

damned
October 17th, 2017, 07:49
So, with the addition of the Advanced Effects extension I've been working on you're able to apply effects to item, npcs and player records and when you drag/drop those npc/pcs into the combat tracker it automatically applies the effects.

Sounds great? Well, it is (not because I did it mind you) but there is a little quibble with it. If you give a weapon "ATK: 1" that character now has +1 to hit with ALL weapons, not just that weapon.

So.... I've been pondering how best to deal with that w/o doing a lot of code work and I made a proof of concept run tonight and it worked. Here is how it functions.


When the player attacks the item's path (charsheet.XXXX.inventorylist.id-XXXX) is handed off in rAction as rAction.itemPath.
During the actionAttack mod I then check for .itemPath exists.
If it exists then create rItem.X (matching rSource except for sCTNode)
After I check getEffects*(rSource) I also do a getEffects*(rItem).
The effects are added together and the modifier function returns them all and the attack bonuses are applied.
Walla, attack works and the bonus will ONLY apply if that weapon is used.


Tonight I just copy/pasted a effects.* block into the item so I've got code work to do to manage adding the "action only" effects from Advanced Effects to the item as ".effects.*".

Need more extensive testing but preliminary work seems promising.

Anyone see any holes or have suggestions?

I have a suggestion. Drink more coffee and keep writing more code.
Thats it.
Seriously - keep writing.
You're doing some awesome stuff.

Bidmaron
October 17th, 2017, 12:34
I don’t see any flaws in your logic, but what about shields and shield bash or can you do this with any item and not just weapons?

How about a screen shot of an item with this effect?

celestian
October 17th, 2017, 15:57
I don’t see any flaws in your logic, but what about shields and shield bash or can you do this with any item and not just weapons?

How about a screen shot of an item with this effect?

It should work for any item with an attack.

I'll finish up a preliminary work up (after my RL job) tonight for my testing and post some images tho honestly it won't be much but a toggle in the Advanced Effects config for the effect.

Ken L
October 17th, 2017, 16:16
I don't believe there is, I've yet to port your extension as my main focus is on SR5e as of late. Regarding what I know of the 3.5/PF ruleset, effects are global and there has to be a work-in to the character sheet for this to work. Some weapons auto-populate attacks if they're configured in a certain manner, I've yet to dig this out, but that's the manner of attack I'd venture for. This is in PF mind you, 5e is more polished so it probably does something similar but in a more integrated manner.

Moon Wizard
October 17th, 2017, 17:10
3.5E /PFRPG will be a little harder, because you have to worry about effect type stacking rules, which you don’t need to worry about for 5E.

JPG

celestian
October 18th, 2017, 05:25
Okay, so... after spending a few hours wacking at this tonight I did get it working but... don't like it. To much hacking/fiddly bits to get it to "merge" with the existing effects...

I'm going to try another direction, something that will apply it like any other effect but the "effect" code will ignore it unless the action was triggered by an item. I'll have to tweak the manager_effect_5E.lua code probably which I was hoping to avoid (means I have to update the extension when new rev comes out) or even deeper, CoreRPG manager_effect.lua code.

Going to think about it and take another pass tomorrow.

celestian
October 19th, 2017, 03:39
Much better direction tonight I think. Got the result I wanted from initial testing and will do more later. I took a SS as promised for the requester. The red indicated areas are "actiononly" style effects or results. All the other effects and results are not. I made a roll to hit with the awl pike and the claymore. The awl pike has no actiononly effects and the claymore does. Claymore included the normal effects plus it's action only.

Progress!

https://i.imgur.com/nmOnRBS.png

celestian
October 19th, 2017, 05:24
Did some more testing and was even able to have a weapon that would only do extra damage to a type, like a "giant". It appears the IF/IFT coding works properly with this new mode.

HOWEVER, I've got a blocker for this to be perfect. Right now I can get the item on effects to work properly except when you drag/drop the dice. This appears to be a draginfo issue (eventually rSource which was rActor doesn't include the .itemPath) and I'm trying to figure out how to resolve. I'm not entirely sure how to inject data into that easily.

Anyone have any experience with that?

Bidmaron
October 19th, 2017, 14:02
Take a look at post #3 of the programmatically copying code thread and you can see how I solved a similar quandary. If you have any questions on the technique I will reply here.

celestian
October 19th, 2017, 16:22
Take a look at post #3 of the programmatically copying code thread and you can see how I solved a similar quandary. If you have any questions on the technique I will reply here.

Okay, I'll check it out. Last night I dug around and found something that I was able to make work.

Had to tweak code in manager_action_attack.lua in the 5E code. This part I'm ok with at this point because I also had to tweak manager_effects_5E.lua for other parts as well.



function performRoll(draginfo, rActor, rAction)
local rRoll = getRoll(rActor, rAction);

if (draginfo and rActor.itemPath and rActor.itemPath ~= "") then
draginfo.setMetaData("itemPath",rActor.itemPath);
end

ActionsManager.performAction(draginfo, rActor, rRoll);
end


Then I used draginfo.setMetaData() and .getMetaData(). The only problem is to make those work I needed to tweak CoreRPG manager_actions.lua.



function decodeActors(draginfo)
local rSource = nil;
local aTargets = {};


for k,v in ipairs(draginfo.getShortcutList()) do
if k == 1 then
rSource = ActorManager.getActor(v.class, v.recordname);
else
local rTarget = ActorManager.getActor(v.class, v.recordname);
if rTarget then
table.insert(aTargets, rTarget);
end
end
end

-- itemPath data filled if itemPath if exists
local sItemPath = draginfo.getMetaData("itemPath");
if (sItemPath and sItemPath ~= "") then
rSource.itemPath = sItemPath;
end
--

return rSource, aTargets;
end



What I'm hoping to do is figure out a way to pull the data out of the draginfo and put it into rSource w/o having to do it in the CoreRPG bit. Right now tho it looks like the "ActionsManager.registerModHandler("attack", modAttack);" call back only hands off rSource,tTarget,rRoll but not draginfo... I'll dig deeper this evening and see if there is something I can fix about that.

Bidmaron
October 19th, 2017, 16:24
I really think what I did in that post will work for you. Let me know if you need any more code posted

celestian
October 19th, 2017, 16:33
I really think what I did in that post will work for you. Let me know if you need any more code posted

You are right! That looks very promising. I'll have to try it out this evening. Looks way easier to deal with than replacing the entire .lua file.

Moon Wizard
October 19th, 2017, 17:14
I haven’t looked closely, but it seems like you would want to store the item path in the roll/action structure, and not the actor structure. This may help prevent needing to modify ActionsManager.

Also, remember to save the originals of the script files you are modifying for easier comparison for future script updates.

Cheers,
JPG

Bidmaron
October 19th, 2017, 19:07
That is the structure I saved in but I did have to override the performaction routine. The override simply stuffed my things into rRoll and invoked performAction. This should be a workable technique for all similar extension situations and compatible. It will be invisible to any given extension that the performAction you are chaining to is actually that of another extension. Ultimately the first extension to have patched performAction will invoke the real original performAction and it will be transparent with only the loss of some stack space and a few clock cycles.

celestian
October 19th, 2017, 19:46
I haven’t looked closely, but it seems like you would want to store the item path in the roll/action structure, and not the actor structure. This may help prevent needing to modify ActionsManager.

Also, remember to save the originals of the script files you are modifying for easier comparison for future script updates.

Cheers,
JPG

I ended up going with the method that Bidmaron suggested. Having it in rAction/rSource (via draginfo) worked out well. All I had to do was swap out the base function for mine instead of the full replacement.

I do save copies for just the reason you suggested. Diff is great cause I won't remember half of what I did 6 months from now.

Got it working over lunch! I'll post the extension in a few for folks to test.

Bidmaron
October 19th, 2017, 20:58
Glad it worked for you. I have to say I am incredibly impressed with the work you have done, and I hope someone ports all your hard work to PF. MW has warned us that the 3.5 and PF stacking rules will make it harder though (as if not hard enough)

celestian
October 20th, 2017, 01:44
Glad it worked for you. I have to say I am incredibly impressed with the work you have done, and I hope someone ports all your hard work to PF. MW has warned us that the 3.5 and PF stacking rules will make it harder though (as if not hard enough)

I wish them the best of luck. PF/3e+ is really just outside of my wheelhouse. ;)