- Joined
- Mar 27, 2012
- Messages
- 3,232
I've been thinking of a way to make abilities in such a way, that I would rarely have to tinker with them and that I could use them in any way possible (separate from units, for example).
For clarification, I don't suggest this for the spell section, but rather for personal use. If someone else wants to pick it up, then sure, but it shouldn't be an official standard due to the high amount of extra work required.
I would like to know what more I could add to this before starting to convert the abilities.
1. All triggered abilities are based on channel or charge gold/lumber.
2. There are 12 versions of each ability to cover all possible slots.
3. Every ability comes with an objectmerger script line that can be toggled off to prevent it from being remade on every save. This script line creates the ability.
4. Ability scripts are preconfigured to use the IDs that objectmerger assigns to them. Using a utility to generate IDs upon compilation is not allowed, unless it's predictable what IDs it assigns.
5. Abilities support configuration in a separate library, to keep the actual script intact.
6. Each ability slot uses a specific hotkey and order ID, no matter the ability. This is to prevent collisions and promote consistency.
7. Each ability has 102 levels with cooldowns varying from 0-100 and the last being 99999.
8. Configuration inside object editor should be minimized; spells gain most of their attributes from code.
9. Abilities are registered to the system and don't individually check for when they are cast. The system detects which ability is cast and launches the appropriate triggers automatically.
Slots:
M-S-H-A
P-D-F-G
Q-W-E-R
Order IDs:
M - move
S - stop
H - holdposition
A - attack
P - patrol
D - ambush
F - banish
G - corrosivebreath
Q - taunt
W - dispel
E - slow
R - absorbmana
Viable free IDs(easy to trigger their abilities):
absorb
acidbomb
ambush
antimagicshell
banish (through a dummy caster. Duration to be handled internally)
corrosivebreath
taunt
dispel
slow
healingward
lightningshield
evileye(sentry ward)
stasistrap
absorbmana
API:
SetAbilityCooldown(unit,integer) - Each unit has an integer per ability, which defines the cooldown of this specific ability. Upon casting it (SPELL_EFFECT), the system changes the level of ability to this level and returns it back to normal after a 0-second timer. The timer makes it possible to only require the first level of the ability to have a description. Other levels still need to have numeric object data to prevent issues.
SetAbilityManacost(unit,integer) - It can be kept 0 if the ability handles it itself or uses a non-static cost. When the ability is cast it is checked whether the unit has enough mana. If not, then the cooldown and ability effects are prevented(SetAbilityCooldown)
SetAbilityVarInt(unit,whichint,amount)
SetAbilityVarReal(unit,whichreal,amount) - Those 2 are for ability data, such as damage, area of effect, etc.
UnitGrantAbility(unit,ability,slot) - Adding abilities to units through the normal function shouldn't be done, because then each spell would be required to check for 12 ability IDs.
The slots are from left to right and from up to down. If -1 is input for slot, then the first free one is used.
All stats are kept in arrays with unit ID(from indexer) and don't need a function to get them due to this. A simple array read will do.
For clarification, I don't suggest this for the spell section, but rather for personal use. If someone else wants to pick it up, then sure, but it shouldn't be an official standard due to the high amount of extra work required.
I would like to know what more I could add to this before starting to convert the abilities.
1. All triggered abilities are based on channel or charge gold/lumber.
2. There are 12 versions of each ability to cover all possible slots.
3. Every ability comes with an objectmerger script line that can be toggled off to prevent it from being remade on every save. This script line creates the ability.
4. Ability scripts are preconfigured to use the IDs that objectmerger assigns to them. Using a utility to generate IDs upon compilation is not allowed, unless it's predictable what IDs it assigns.
5. Abilities support configuration in a separate library, to keep the actual script intact.
6. Each ability slot uses a specific hotkey and order ID, no matter the ability. This is to prevent collisions and promote consistency.
7. Each ability has 102 levels with cooldowns varying from 0-100 and the last being 99999.
8. Configuration inside object editor should be minimized; spells gain most of their attributes from code.
9. Abilities are registered to the system and don't individually check for when they are cast. The system detects which ability is cast and launches the appropriate triggers automatically.
Slots:
M-S-H-A
P-D-F-G
Q-W-E-R
Order IDs:
M - move
S - stop
H - holdposition
A - attack
P - patrol
D - ambush
F - banish
G - corrosivebreath
Q - taunt
W - dispel
E - slow
R - absorbmana
Viable free IDs(easy to trigger their abilities):
absorb
acidbomb
ambush
antimagicshell
banish (through a dummy caster. Duration to be handled internally)
corrosivebreath
taunt
dispel
slow
healingward
lightningshield
evileye(sentry ward)
stasistrap
absorbmana
API:
SetAbilityCooldown(unit,integer) - Each unit has an integer per ability, which defines the cooldown of this specific ability. Upon casting it (SPELL_EFFECT), the system changes the level of ability to this level and returns it back to normal after a 0-second timer. The timer makes it possible to only require the first level of the ability to have a description. Other levels still need to have numeric object data to prevent issues.
SetAbilityManacost(unit,integer) - It can be kept 0 if the ability handles it itself or uses a non-static cost. When the ability is cast it is checked whether the unit has enough mana. If not, then the cooldown and ability effects are prevented(SetAbilityCooldown)
SetAbilityVarInt(unit,whichint,amount)
SetAbilityVarReal(unit,whichreal,amount) - Those 2 are for ability data, such as damage, area of effect, etc.
UnitGrantAbility(unit,ability,slot) - Adding abilities to units through the normal function shouldn't be done, because then each spell would be required to check for 12 ability IDs.
The slots are from left to right and from up to down. If -1 is input for slot, then the first free one is used.
All stats are kept in arrays with unit ID(from indexer) and don't need a function to get them due to this. A simple array read will do.