FFX Callback functions
Sometimes its desirable (or even necessary for mission flow) to get a mission-specific event happen in response to an FFX event - for this reason Ive included several callback functions in the guts of FFX. These are all triggered as RegTimer events - so if you dont provide the callback nothing will happen and no error gets generated.
The callback response functions can be placed in either a single mission or in a library file for your mod, as long as the library file is included in the mission files.
OnInitialiseLevelCB(event)
Useful for mod specific per-level initialisation, such as setting up various Strangers speicifc code to deal with their specially scripted powers.
OnInitialiseCharCB(event)
event.object=name of the character who's just been spawned
Useful for adding non-FFX specific special abilities to mod characters. This is called whenever a new character is spawned (with a delay of up to a second or two) and could be used to implement special mod-specific abilities.
Example: Chaos in the Strangers gains a few extra abilities due to the random material type selected. This behaviour isn't covered in FFX, but is done in a callback like this. This guarantees that the code will trigger if she appears mid-mission, or at the start, etc., and even applies to clones of her if any get created.
OnMorph(event)
event.object=template that the character is turning into
event.string=name of the newly created form
Called whenever a character morphs from one form to another. This can be useful for restoring mission commands to a character who may be a shapechanger, or even just getting a character to speak a line of dialog the first time they transform.
Example: In the Hell mission in the Strangers, Devil Doll was given special commands to SEAL the giant doors. Since she may well morph due to her mimic ability, a callback was put in to restore the correct commands every time she changes.
Similarly, if you have a builtin shapeshifter/mimic and want a mission where they mustn't fall, then it will be necessary to call regDeath in this function each time they morph to trigger the mission lose case correctly.
Finally, in the final missions with the Connection, there was special case code to mental blank Devil Doll briefly (and speak a line of dialog) if she morphed into a copy of the Connection, due to her suddenly gaining its vast sensory abilities. This too was accomplished using this callback.
onDisperseCB(event)
event.object=name of the character who's just dispersed
Called whenever a character disperses temporarily due to the DISPERSED STRUCTURE attribute. Useful for modifying the bahviour of this function under specific circumstances.
Example: Special case code was used via this callback to stop the Conection from losing HP when it dispersed, and to get it to change form periodically.
The following are included mainly to allow a bit of custom dialog to be thrown in (gloating or custom cries for help). The list here is a bit arbitrary - if any mod-makers want more callbacks for specific events, let me know.
Check out the sayOnce() command in ffx.py to limit a speech tag to once per mission.
OnStormCB(event)
event.object=name of the character who's summoned the storm
Example: hero with weather control saying 'you cannot withstand the power of the elements!" the first time they use a power on a mission.
OnTransmuteCB(event)
event.object=name of the character who's been transmuted
event.string=name of the character who's doing the transmuting
Example: target some nearby minions in the level to attack the transmuted hero object. (named 't'+heros name eg 'thero_1')
OnShrinkCB(event)
event.object=name of the character who's been shrunk
event.string=name of the character who's doing the shrinking
OnMagnetiseCB(event)
event.object=name of the character who's been magnetised
event.string=name of the character who's doing the magnetising
OnPsychicLinkCB(event)
event.object=name of the character who's taken extra damage
event.string=name of the character who's been dmaaged normally and transmitted it
Example: team leader comments on the newly perceived weakness of the opposition. Possibly play some custom FX on the characters here as well?
OnSummonCB(event)
event.object=name of the summoner
event.string=name of the summoned creature
Example: possibly add some custom FX to the summoned creatures (satanic hex symbols or green sparkles or whatever)
OnIcewallCB(event)
event.object=name of the character creating the ice wall
OnIcepatchCB(event)
event.object=name of the character creating the ice patch
OnPoltergeistCB(event)
event.object=name of the character whose just released the poltergeists under rage/panic
OnAngstriddenCB(event)
event.object=name of the character whose been overcome by angst
Example: have a variety of sayings picked at random for the moping builtin hero (or exasperated taunts or words of encouragement from teammates?)
OnExplodeCB(event)
event.object=name of the character whose just exploded and dispersed themselves
Exmaple: check for nearby scientists and have them say: "Great Scott! He just dispersed his loose molecular jelly!" the first time an enemy explodes (using some custom AI code?)
OnStockpileCB(event)
event.object=name of the character whose blown up using the NUCLEAR STOCKPILE attribute