id Tech 4 (Doom3/Prey/Q4) > id Tech 4 Engine Coding

calling objects script functions from within the engine code?

(1/1)

argoon:
Hello guys and gals,  i'm trying to call functions from the c++ code, like i used to do using DoomScript but obviously is different on the c++ side, studying the engine code i see id calls scripts like so:


--- Code: ---const function_t *func;

func = Entity->scriptObject.GetFunction("somefuncname");
Thread->CallFunction(frobableEntity, func, true);

--- End code ---

but this just crash's the engine for me and i'm totally clueless why.

Any help is welcome.


 Edit: before posting this i spend more than a hour trying to make this work, after making this thread and going away to try to solve again i did it: :P  :D

This is the necessary code to successfully call object script functions from withing the c++ code:


--- Code: ---const function_t *func;
idThread *Thread;

func = Entity->scriptObject.GetFunction("signalOn");
Thread = new idThread();
Thread->CallFunction(Entity, func, true);
Thread->Start();
--- End code ---

Navigation

[0] Message Index

Go to full version