Thread: Adding effects via code
-
May 6th, 2019, 21:33 #1
Adding effects via code
Hello
I need some help with adding effects via a code I have some prototype of an extension (I can somehow not add the link to it; it is in the 3.5e forum in the recent threads) which handles situation dependent saves. However, I found out that it only works for saves of NPCs but not for PCs. As far as I can see both are using the modSave function for effects in the manager_action_save.lua. My extension is based on adding an auxiliary effect to the person who has to roll the save using
local sActorType, nodeActor = ActorManager.getTypeAndNode(rActor);
EffectManager.addEffect("", "", nodeActor, rEffectSpell, false);
(where rActor is the one making the save)
For NPCs that works, they get the effect rEffectSpell (in form of a string saved in rEffectSpell.sName). But for players this doesn't work. Does the addEffect works differently there? Or do I need a different command to get the node of a PC?
Thanks in advanceLast edited by Kelrugem; May 6th, 2019 at 21:59.
-
May 6th, 2019, 22:36 #2
Ok, it seemingly depends on the definition of rEffectSpell, isn't it? I just want to add some string to the effects of the actor. So far I have
rEffectSpell.nDuration = 1;
rEffectSpell.nInit = 0;
rEffectSpell.nGMOnly = 1;
rEffectSpell.sApply = "";
and .sName the corresponding string
-
May 6th, 2019, 22:44 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,541
I think that anyone will have a hard time figuring out the situation from the code snippets.
My recommendation is that you use Debug.chat or Debug.console APIs to inspect the parameter variables before you make calls, and inspect the result variables after you make calls. then, you’ll be able to review the variable values to see where the ariables qre different than what you expect.
Regards,
JPG
-
May 6th, 2019, 22:46 #4
-
May 6th, 2019, 23:09 #5
Oh, wow, thank you very much for your advice! I was able to solve it The problem was that I get the charsheet-id with getNode, but I needed the CTnode and for that I have to use rather getCTNode Thanks
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks