Category: Script
Since engine version: 9.0 OC
AddFunction
Description
Adds a function from a proplist, effect, definition, or object to the calling context.
Syntax
nil AddFunction(func call, bool override);
Parameters
- call:
- This is the function that should be added.
- override:
- [opt] Overriding an existing function in the target context is not allowed and will lead to a FatalError if this is set to
false
(default).
Remark
When using this function be sure that you know what you are doing. Replacing functions can have unintended side effects.
Example
// Make a specific rock explode if it hits with high velocity! var boom = CreateObject(Rock); boom->AddFunction(Firestone.Hit2);
This script makes a rock explode like a firestone. Note that only this one specific function is copied, so there will be no fuse effect, for example.
See also: AddFunctions, GetFunctionName