Skip to content

Override Blueprint Function

hasezoey edited this page Nov 7, 2017 · 3 revisions
// "MyActor" should be replaced with the Blueprint that you want

class MyActor extends Blueprint.Load('/Game/MyActor').GeneratedClass { 
    // "/Game/(Path to BP)" "/Game/" can be seen as Content in Unreal's browser

    Function_To_Override() {

        return; 
    }
}

var MyActor_C = require('uclass')()(global, MyActor);

function main() { //main function thats defined at buttom
    if (GWorld.IsServer) { //executes only on server / host
        var actor = new MyActor_C(GWorld, { X: 1 }); //creates the actor

        return () => {
            actor.DestroyActor();
        }
    }
}

try { //setup / init
    module.exports = () => {
        var t = main();

        return function () {
            t();
        }
    }
}
catch (e) {
    require('bootstrap')('BP_Function_Override'); // replace "BP_Function_Override" with the js file name
}

to return a value, that was defined in the Blueprint Editor:

Function_To_Override() {

        return {
            var_name_from_BP_here: 'value you want to'
        };
    }
  • return does somehow not function when returning in an async function (like in a callback from request)
Clone this wiki locally
You can’t perform that action at this time.