• Tutorials

  • Home
  • Special Abilities

    See also Special Abilities Scripts

    Where are Special Abilities

    There is a list of 'Special Abilities' associated with each:

    Character (including NPCs and monsters in combat)

    Combatant (initialized at the start of combat to have the single Special Ability named "Competing". This list is separate from the list associated with the character. Ie: there are two lists of special abilities for each character during combat: the list associated with the character and the list associated with the combatant. The combatant list is discarded at the end of combat.

    Spell

    Spellgroup

    Item

    Monster Type (Orc, Skeleton, etc.)

    Race

    Ability

    Class

    Trait

    What are Special Abilities

    A special ability is no more than a name and a parameter. Both are arbitrary strings although you will cause yourself less grief if you avoid using special characters such as the equal-sign, comma, period, quotation-marks, and such. A special ability might be "Takes More Damage At Night" with parameter "10pm-4am". Special abilities are cheap in terms of CPU and memory. An item (or spell or whatever) can have as many special abilities as needed but cannot have two with the same name. Different items can have special abilities with the same name and different parameters. For example, an arrow might have the special ability "DULL" with parameter "4" and a dart might have the special ability "DULL" with the parameter "123".

    In addition to the special ability names and parameters associated with each item, monster, etc. there is also a database of special abilitites. Each special ability in the database has a name (probably the same name as a special ability given to some object) and an arbitrarily long list of arbitrarily-named arbitrary strings. Each if the strings has a type of SCRIPT, CONSTANT, or INCLUDE. For example, the Special Ability "Dozed" might have a SCRIPT named "IsCombatReady". The script would probably declare the holder of the special ability "Dozed" as ineligible for combat. It might also have a script named "CanCastSpells" which would make the holder unable to cast spells while he is dozing. Use of these SCRIPTs, CONSTANTs, and INCLUDEs will be describe a bit more below.

    How Might I Use Special Abilities

    Here is a real-world example. Let us use Special Abilities scripts to implement the Doze spell. When cast, the Doze spell should put its target to sleep for 3 rounds of combat.

    We start by using the spell editor to create a Doze spell. When the spell is invoked, the runtime engine will use the name of each of the spell's Special abilities to examine the Special Abilities database in search of a script named InvokeSpellOnTarget. That script name is wired into the engine and cannot be changed. So we give the spell a special ability. We make up some name that seems to describe the ability. Let us call it "DozeSpell". We give the Special ability a parameter of 3, which we will use later to decide how long our target will sleep. We are done with the spell editor.

    Now we use the Special Abilities editor to define what the Special Ability named "DozeSpell" will do. We add a script to "DozeSpell" named InvokeSpellOnTarget. The script will add a special ability to the Target!!!!. Actually it is more like a 'disability' but we call it a special ability. This 'disability' will prevent the target from participating in the combat. Let us think of a name that might make sense. Let us call it "Sleeping". We copy the parameter from ourselves ("DozeSpell") into the Special ability "Sleeping" which we give to the target of the spell. Now the target has the Special ability "Sleeping" with parameter 3. So now we need to define what the special ability "Sleeping" does.

    We use the Special Abilities editor to define what the Special Ability "Sleeping" does. We add several scripts:

    CanCastSpells

    GetAdjMaxMovement which sets movement to zero

    IsCombatReady which prevents owner from competing

    GetCombatStatus which will display the owner's status. "Sleeping" perhaps.

    GetNumberOfAttacks which will return zero.

    OnStartOfRound which will decrement the parameter (remember that we set it to 3) and delete the Special Ability when the count reaches zero.

    So here is what happens when we cast Doze on an Orc:

    Doze has a Special Ability named "DozeSpell". "DozeSpell" has a script named InvokeSpellOnTarget. InvokeSpellOnTarget gives the Orc a Special Ability named "Sleeping" with parameter 3.

    When the Orc tries to do anything we find that it has a Special Ability name "Sleeping" and we discover that "Sleeping" has several scripts that prevent any actions by the Orc.

    At the start of each round, we discover that the Orc has a Special Ability named "Sleeping" and "Sleeping" has a script named OnStartOfRound which decrements the parameter (representing the time the Orc is supposed to stay asleep), and deletes the "Sleeping" when the parameter gets to zero, allowing the Orc to compete again.