PDA

View Full Version : [CoreRPG] Replacing the action_manager.lua



Maspalio
October 16th, 2016, 13:21
Hello all,

Still working on my Ruleset, i have a hard time adding functions depending from the ActionsManager (manager_actions.lua file) without copying the full file.


What i'm trying to do : I have written a new function that changes the rolls slightly and have put it in a new lua file. This file is loaded from base.xml via script name="InsertNameHere" as usual.

To call this function, i need to change the resolveAction function contained in the CoreRPG manager_action.lua file, adding the ref to "InsertNameHere".

So i went from
local rMessage = createActionMessage(rSource, rRoll); to local
rMessage = InsertNameHere.createActionMessage(rSource, rRoll); ... a minor change.


My problem : as i launch the game, i have to reintroduce the entire file, function after function as they are all missing... It's the reverse of the includefile spirit, as i have to duplicate this CoreRPG file for just a line...


I guess i'm doing this wrong. How can i modify the resolveAction alone, without copying a billion other functions i still have in core?


Thanks a ton for your help. Going crazy on that one...

damned
October 16th, 2016, 13:40
create an action_manager2.lua instead of replacing the existing one.
coreRPG will load its one and you run your routines in #2.

Maspalio
October 16th, 2016, 15:06
I did this, but the functions in action_manager.lua skips my functions in action_manager2.lua, and all the dice roll process i write is lost. Maybe is it because some functions share the same name?

Thanks for your reply though.

Maspalio
October 16th, 2016, 15:22
Reply to self : used this and it works perfectly. You made my day !


function onInit()
ActionsManager.registerResultHandler("dice", FunctionToLaunchMyProcess);
end