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] = list of the 'Undead types' currently present in the combat which can be successfully turned.
Parameter [6] = “Yes” if the roll of the 'turning' die was successful. Else “”.
Context
COMBATANT context. Ie: $CombatantContext(). The COMBATANT whose combat options are to be displayed.
Result
The script should return a delimited string with then names of the 'Undead Types' that should be turned.
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. At the time of failure, we will remove the Special Ability. This Special ability will contain a list of the 'Undead Types' already turned during this combat and should therefore start out empty. Each time he succeeds in turning an 'Undead Type', we will add the name of that 'Undead Type' to the list. This Special Ability will also have a script named “Turn Attempt” which will handle the character's attempts to turn. Let us call this Special Ability “Have Already Turned These Undead”. You can probably think of a shorter name.
When the “Turn Attempt” script runs and parameter 6 indicates failure, it will:
Remove the “Have Already Turned These Undead” 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 6 indicates 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 “Have Already Turned These Undead”.
- 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.