Handles entity events that occur during collision, within a certain radius, or when the entity is picked.
You can pass an array of event objects to the "parent" arg for events without "parent" or "target" objects.
Arg
Default
Type
parent
entity object or array of event objects
target
character/entity object
The properties in each object within "event_todo" of the "parent" control what happens when the event occurs. Examples can be found in the JSON level format and the test-events.json:
"limit": how many times this event occurs before it is skipped.
"random_max" and "random_min": value range to randomly add to "value".
"set": if modifying a stat or variable, either set its value to "value" or add it.
"stat": the specific character/entity property that will be modified.
"todo": either the ID of the character/entity, the name of the function to call without (), or the name of the variable to modify.
"type": what is being called or modified when this event occurs:
"character": modify the character with the "todo" ID.
"entity": default, modify the entity with the "todo" ID.
"function": call the function with the "todo" name and pass "value" as its args. For JSON levels:
You can call webgl_json_function(args) to run complex functions that don't use variables, such as using "globalThis.window.open()" to open a webpage.
If you need to pass variables to the called function, then currently you should use the "eval()" function with a string value, such as "console.log(webgl_character_count)".
"variable": modify the variable with the "todo" name.
"value": the value to use to modify stats and variables, or the args that are passed to called functions.