Can Turn
Turn Attempt
These hooks are called to control a character's attempts to 'Turn Undead' in combat.
There are two questions that need to be answered:
Should the “TURN” option be displayed when the character becomes the active character in combat?
When the player selects the “TURN” option, which monsters should be turned?
CanTurn
This hook answers the first question. It should return an answer starting with 'Y' of it wants the “TURN” option to b displayed. This hook will only be called whether or not the character has the 'Turn' skill and there are monsters that could be turned if the attempt to turn were successful. But the script can simply return parameter[5] and then the option will be displayed only if turning is actually a possibility. Nevertheless, the script could test the player's alertness and allow him to select “TURN” as an impossibility, thereby wasting a move.
Parameters
Parameter[5] will be “Y” if and only if 'Turning' is a possibility. That is if the character has a turning ability that has the capability of turning one or more monster types currently in the combat. Otherwise it will contain an empty string.
Parameter[6] is a Delimited String containing the Monster Types that can be turned.
Result
The “TURN” will appear as a menu item only if this script exists and it returns a value starting with the letter 'Y'. The simplest script that will accomplish normal 'Turning' capabilities is:
$RETURN $GET_HOOK_PARAM(5);
Context
COMBATANT context. Ie: $CombatantContext(). The COMBATANT whose combat options are to be displayed.
TurnAttempt
This hook is called when the player select the “TURN” option from the combat menu. I should return a list of the 'Undead' types that should be 'Turned'.
Parameters
Parameter 5 is a list of the 'Undead types' currently present in the combat for whom the “Unturn Dice Roll” was successful.
Parameter 6 is a list of “Undead Types” currently in the combat for whom the “Unturn Dice Roll” was not successful.
Result
The script should return a delimited string with then names of the 'Undead Types' that should be turned. Normally this would be one of the 'Undead Types' in the Parameter[5] list (or an empty string).
Context
COMBATANT context. Ie: $CombatantContext(). The COMBATANT whose combat options are to be displayed.
Example of use
Let us say that the character should be able to turn one 'Undead Type' each time he takes combat action, until he fails to roll successful 'Turning Dice'.
At the start of combat we should give the COMBATANT a Special Ability which allows him to turn until he fails. This Special Ability will have two scripts.
“CanTurn” - This script enables the “TURN” option on the player's menu. This script will simply return hook parameter [5]. When turning fails, the “TurnAttempt” hook will remove the special ability from the combatant and “TURN” will no longer appear as a menu option.
“TurnAttempt” - This script keeps track of which 'Undead Types' have already been turned and decides which 'Undead Types' should be turned on each attempt. When a “TURN' attempt fails, this script will remove the Special Ability from the combatant, preventing “TURN” from appearing a s menu option.
When the “Turn Attempt” script runs and parameter 5 is empty (indicates failure), it will:
Remove the Special Ability and thereby prevent the “TURN” option from appearing for this COMBATANT during the rest of this combat.
Return an empty string, preventing any turning on this move.
If parameter 5 is non-empty (indicates turn success) then the script will:
Look through parameter 5 for the first Undead Type' that does not appear in the list attached to the Special Ability's list of already turned types.
If it finds none, it will remove the special ability and return an empty string.
If it finds one, it will add that 'Undead Type' to the Special Ability's list and return the name of that 'Undead Type' as a result. If this is the last 'Undead Type' listed in parameter 5 then it should remove the Special Ability in order to prevent the “TURN” option from being displayed for this COMBATANT for the duration of this combat.