Watch
-
Add Favorite
Changed to another method, this time it should actually work.
( Previous Versions )
Description
Using this script as a module other scripts can add their own event info modifiers to alter event variables at will.
The modified event variables are only visible for Python scripts, ESS scripts only get the original event variables.
Note that this script does not actually change the function itself that triggered the event, only allows faking the event variables for other Python addons.
If you load this as a script addon (es_load modevents), an example event modifier is applied. This example modifier adds dmg_health event variable to hold the value that event variable damage contains in case the game is Day of Defeat: Source.
Any Python script can add their own event modifiers by importing modevents module as in
To add event modifier to specific event, use add_modder function, for example:
To remove the event modifier, use del_modder function, for example:
The actual event modifier receives one parameter that acts like event_var instance but can be modified as a normal dictionary to change or add event variables. Deleting existing event variables is not possible, but you may set an existing event variable to empty string to simulate it being deleted, for example:
If the event modifier function returns False, then the event is not triggered at all for Python scripts. Be careful with that ;)
The modified event variables are only visible for Python scripts, ESS scripts only get the original event variables.
Note that this script does not actually change the function itself that triggered the event, only allows faking the event variables for other Python addons.
If you load this as a script addon (es_load modevents), an example event modifier is applied. This example modifier adds dmg_health event variable to hold the value that event variable damage contains in case the game is Day of Defeat: Source.
Any Python script can add their own event modifiers by importing modevents module as in
import modevents |
To add event modifier to specific event, use add_modder function, for example:
modevents.add_modder('player_death', my_player_death_modifier) |
To remove the event modifier, use del_modder function, for example:
modevents.del_modder('player_death', my_player_death_modifier) |
The actual event modifier receives one parameter that acts like event_var instance but can be modified as a normal dictionary to change or add event variables. Deleting existing event variables is not possible, but you may set an existing event variable to empty string to simulate it being deleted, for example:
def my_player_death_modifier(event_var): |
If the event modifier function returns False, then the event is not triggered at all for Python scripts. Be careful with that ;)
Installation
Download and extract.Version Notes For beta (Announce this update)
Updated on: 2008-07-13 08:02:12 ESTChanged to another method, this time it should actually work.
( Previous Versions )
Find Servers
Servers running this addon.
Addon Details
Upload Addon