staarsh0werz Posted June 4 Share Posted June 4 for some reason, when i run the following script in modmain and use the backtrek watch, it causes an error and wanda gives her generic pocketwatch_docast actionfail quote even though all this does is save the usual function to a different variable and then runs it under the same function when called. other things i add to the function work such as making her age 8 years, but the main function of teleporting her to the recallmarker doesn't. i originally had code here before the old_spellcast is ran, but i removed it to troubleshoot and can't tell what hte issue is. any help is greatly appreciated! Spoiler AddPrefabPostInit("pocketwatch_recall", function(inst) if not GLOBAL.TheWorld.ismastersim then return end local old_spellcast = inst.components.pocketwatch.DoCastSpell -- save usual recalldocastspell func inst.components.pocketwatch.DoCastSpell = function(inst, doer, target, pos) -- replace with our thing old_spellcast(inst, doer, target, pos) -- run usual func after we do our thang end end) Link to comment https://forums.kleientertainment.com/forums/topic/171938-help-with-addprefabpostinit-on-wandas-backtrek-watch/ Share on other sites More sharing options...
staarsh0werz Posted June 4 Author Share Posted June 4 i fixed it :] i simply added a return true right before the function's end. i think the game just really wants something to return after that function and if you don't return true, lua just treats it like false and the game doesn't let you do anything. the code after fixing it is as follows: Spoiler AddPrefabPostInit("pocketwatch_recall", function(inst) if not GLOBAL.TheWorld.ismastersim then return end local old_spellcast = inst.components.pocketwatch.DoCastSpell -- save usual recalldocastspell func inst.components.pocketwatch.DoCastSpell = function(inst, doer, target, pos) -- replace with our thing old_spellcast(inst, doer, target, pos) -- run usual func after we do our thang return true end end) Link to comment https://forums.kleientertainment.com/forums/topic/171938-help-with-addprefabpostinit-on-wandas-backtrek-watch/#findComment-1869979 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now