PDA

View Full Version : Trying to add new effect in the expireEffect function in manager_effect.lua script



alloowishus
July 17th, 2023, 06:08
For instance, I have added some code that when a custom effect called "Food" expires, I want to add an effect called "Dying" with a certain duration.



the function has the nodeActor and sEffect passed to it, this is my code

if sEffect == "Food" then
local rActor = ActorManager.resolveActor(nodeActor);
local nodeCT = ActorManager.getCTNode(rActor);

EffectManager.addEffect("", "", nodeCT, { sName = "Dying", sApply = "action", nDuration = 1000, nInit = -1, nGMOnly = 0 }, true);

end

I get an error saying "Invalid parameter 1".

Any dieas? Thanks!

Moon Wizard
July 17th, 2023, 06:37
What is the exact error? That will tell you which API function is failing, and then you can add a Debug.chat on the line before it to check all the parameters to make sure they are what you think they should be.

Regards,
JPG

Trenloe
July 17th, 2023, 06:40
When you get errors you'll usually get a line number - this will point to the line where the error is. Examine the code at the line indicated, in this case look at function calls - the first parameter passed to the function call isn't valid for that function.

If this doesn't help we'll need more information - for a start, the full error message and the code that error message points to.

alloowishus
July 21st, 2023, 21:39
Strangely the code worked inside the ruleset but not from the CoreRPG and I realized that's where I should call it from anyway, thanks.