Spell functions - WoutProvost/FCNPC-AI GitHub Wiki
Home ▸ Functions ▸ Spell functions
(name[])
FAI_CreateSpell
- Description: Creates a spell.
- Parameters:
name[]
: See FAI_SetSpellName.- Return values:
Valid spellid
: The function executed successfully.FAI_INVALID_SPELL_ID
: The function failed to execute. FAI_MAX_SPELLS limit was reached before.- Notes: The other settings have the following default values:
castTime
: 2000. See FAI_SetSpellCastTime withkeepCastPercent
false.Float:amount
: 0.0. See FAI_SetSpellAmount.castBarColorDark
: 0x645005ff. See FAI_SetSpellCastBarColorDark.castBarColorLight
: 0xb4820aff. See FAI_SetSpellCastBarColorLight.bool:castBarInverted
: false. See FAI_SetSpellCastBarInverted withinvertProgressMade
false.bool:castTimeInverted
: false. See FAI_SetSpellCastTimeInverted withinvertProgressMade
false.bool:canMove
: false. See FAI_SetSpellCanMove.bool:canAttack
: false. See FAI_SetSpellCanAttack.info[]
:""
, which is an empty string. See FAI_SetSpellInfo.
(spellid, name[], len)
FAI_GetSpellName
- Description: Get a spell's name.
- Parameters:
spellid
: The ID of the spell to get the name of.name[]
: An array into which to store the name, passed by reference.len
: The length of the string that should be stored. Recommended to be FAI_MAX_SPELL_NAME.- Return values:
Name length
: The function executed successfully.-1
: The function failed to execute. An invalid spellid was given.
(spellid, name[])
FAI_SetSpellName
- Description: Set a spell's name which is displayed in a TextDraw 6.
- Parameters:
spellid
: The ID of the spell to set the name of.name[]
: The name to set. Max length is FAI_MAX_SPELL_NAME.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given, or the given name was""
(an empty string).
(spellid)
FAI_GetSpellCastTime
- Description: Get a spell's castTime.
- Parameters:
spellid
: The ID of the spell to get the castTime of.- Return values:
CastTime > 0
: The function executed successfully. The spell is not instant.CastTime == 0
: The function executed successfully. The spell is instant.-1
: The function failed to execute. An invalid spellid was given.
(spellid, castTime, bool:keepCastPercent)
FAI_SetSpellCastTime
- Description: Set a spell's castTime which is displayed in a TextDraw 7.
- Parameters:
spellid
: The ID of the spell to set the castTime of.castTime
: The castTime to set. If a value < 0 was given, it will be reset to 0. If the value is 0, the spell will be instant and FAI_OnStopCasting gets called immediately withcastComplete
true.bool:keepCastPercent
: Should any NPC that is casting this spell his castProgress be adapted? Defaults to false.
true
: This will update any NPC that is casting this spell his castProgress as well so that the NPC keeps the same cast percentage. For example: castTime 500, castProgress 200, percent is 0.4 ➔ castTime set to 1000, castProgress will change to 400, percent is still 0.4.false
:
Value > castProgress
: This will not change the NPC's castProgress. For example: castTime 500, castProgress 200, percent is 0.4 ➔ castTime set to 1000, castProgress is still 200, percent is now 0.2.Value <= castProgress
: This will as well lower the NPC's castProgress to be equal to the value given, because an NPC can't have more castProgress than castTime. For example: castTime 500, castProgress 200, percent is 0.4 ➔ castTime set to 150, castProgress will change to 150, percent is now 1.0. FAI_OnStopCasting gets called immediately withcastComplete
true. Cast bar starts showing extra (if showExtraTime > 0), except ifcastTime
was 0 (instant).- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.
(spellid, &Float:amount)
FAI_GetSpellAmount
- Description: Get a spell's amount.
- Parameters:
spellid
: The ID of the spell to get the amount of.&Float:amount
: The variable into which to store the amount, passed by reference.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.
(spellid, Float:amount)
FAI_SetSpellAmount
- Description: Set a spell's amount.
- Parameters:
spellid
: The ID of the spell to set the amount of.Float:amount
: The amount to set. If a value < 0.0 was given, it will be reset to 0.0.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.
(spellid)
FAI_GetSpellCastBarColorDark
- Description: Get a spell's castBarColorDark.
- Parameters:
spellid
: The ID of the spell to get the castBarColorDark of.- Return values:
Valid color
: The function executed successfully.-1
: The function failed to execute. An invalid spellid was given.
(spellid, color)
FAI_SetSpellCastBarColorDark
- Description: Set a spell's background color which is displayed in a TextDraw 4.
- Parameters:
spellid
: The ID of the spell to set the castBarColorDark of.color
: The castBarColorDark to set.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.
(spellid)
FAI_GetSpellCastBarColorLight
- Description: Get a spell's castBarColorLight.
- Parameters:
spellid
: The ID of the spell to get the castBarColorLight of.- Return values:
Valid color
: The function executed successfully.-1
: The function failed to execute. An invalid spellid was given.
(spellid, color)
FAI_SetSpellCastBarColorLight
- Description: Set a spell's foreground color which is displayed in a TextDraw 5.
- Parameters:
spellid
: The ID of the spell to set the castBarColorLight of.color
: The castBarColorLight to set.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.
(spellid)
FAI_GetSpellCastBarInverted
- Description: Get a spell's castBarInverted.
- Parameters:
spellid
: The ID of the spell to get the castBarInverted of.- Return values: (bool)
true
: CastBarInverted is true.false
: CastBarInverted is false, or an invalid spellid was given.
(spellid, bool:inverted, bool:invertProgressMade)
FAI_SetSpellCastBarInverted
- Description: Set wether the spell's cast bar TextDraw 5 should go from full to empty, instead of the normal empty to full.
- Parameters:
spellid
: The ID of the spell to set the castBarInverted of.bool:inverted
: True to invert the TextDraw, false to do not.bool:invertProgressMade
: Should the NPC's current castProgress be inverted as well? Defaults to false.
true
: This will update any NPC that is casting this spell his castProgress as well so that the bar remains in position. For example: castTime 500, castProgress 450, not inverted ➔ invert, castProgress will change to 50, bar remains in position.false
: This will not update any NPC that is casting this spell his castProgress so that the bar inverts from big to small or vice versa. For example: castTime 500, castProgress 450, not inverted ➔ invert, castProgress will stay 450, bar flips from big to small.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.- Notes: If
invertProgressMade
is true, but the cast bar was already inverted, the progress will not be changed.
(spellid)
FAI_GetSpellCastTimeInverted
- Description: Get a spell's castTimeInverted.
- Parameters:
spellid
: The ID of the spell to get the castTimeInverted of.- Return values: (bool)
true
: CastTimeInverted is true.false
: CastTimeInverted is false, or an invalid spellid was given.
(spellid, bool:inverted, bool:invertProgressMade)
FAI_SetSpellCastTimeInverted
- Description: Set wether the spell's cast bar TextDraw 7 should go from castTime to 0, instead of the normal 0 to castTime.
- Parameters:
spellid
: The ID of the spell to set the castTimeInverted of.bool:inverted
: True to invert the TextDraw, false to do not.bool:invertProgressMade
: Should the NPC's current castProgress be inverted as well? Defaults to false.
true
: This will update any NPC that is casting this spell his castProgress as well so that the displayed castTime remains equal. For example: castTime 500, castProgress 450, not inverted ➔ invert, castProgress will change to 50, castTime remains equal.false
: This will not update any NPC that is casting this spell his castProgress so that the displayed castTime inverts from big to small or vice versa. For example: castTime 500, castProgress 450, not inverted ➔ invert, castProgress will stay 450, displayed castTime flips from big to small.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.- Notes: If
invertProgressMade
is true, but the cast time was already inverted, the progress will not be changed.
(spellid)
FAI_GetSpellCanMove
- Description: Get a spell's canMove.
- Parameters:
spellid
: The ID of the spell to get the canMove of.- Return values: (bool)
true
: CanMove is true.false
: CanMove is false, or an invalid spellid was given.
(spellid, bool:canMove)
FAI_SetSpellCanMove
- Description: Set wether an NPC can move while he is casting the spell.
- Parameters:
spellid
: The ID of the spell to set the canMove of.bool:canMove
: True if the NPC can move while casting, false to do not.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.
(spellid)
FAI_GetSpellCanAttack
- Description: Get a spell's canAttack.
- Parameters:
spellid
: The ID of the spell to get the canAttack of.- Return values: (bool)
true
: CanAttack is true.false
: CanAttack is false, or an invalid spellid was given.
(spellid, bool:canAttack)
FAI_SetSpellCanAttack
- Description: Set wether an NPC can attack while he is casting the spell.
- Parameters:
spellid
: The ID of the spell to set the canAttack of.bool:canAttack
: True if the NPC can attack while casting, false to do not.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.
(spellid, info[], len)
FAI_GetSpellInfo
- Description: Get a spell's info.
- Parameters:
spellid
: The ID of the spell to get the info of.info[]
: An array into which to store the info, passed by reference.len
: The length of the string that should be stored. Recommended to be FAI_MAX_SPELL_INFO.- Return values:
Info length
: The function executed successfully.-1
: The function failed to execute. An invalid spellid was given.
(spellid, info[])
FAI_SetSpellInfo
- Description: Set a spell's info.
- Parameters:
spellid
: The ID of the spell to set the info of.info[]
: The info to set. Max length is FAI_MAX_SPELL_INFO. If""
(an empty string) is given, the system will generate a spellInfo based on the other spell settings.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.
(spellid)
FAI_DestroySpell
- Description: Destroys a spell that was created using one of the FAI_CreateSpell functions.
- Parameters:
spellid
: The ID of the spell to destroy.- Return values:
1
: The function executed successfully.0
: The function failed to execute. An invalid spellid was given.
()
FAI_DestroyAllSpells
- Description: Destroys all spells that were created using one of the FAI_CreateSpell functions. This function gets executed automatically when OnFilterScriptExit is called, if the include is included in a filterscript, or when OnGameModeExit is called, if the include is included in a gamemode.
- Parameters: This function has no parameters.
- Return values: This function always returns 1.
(spellid)
FAI_IsValidSpell
- Description: Checks if a spell is created.
- Parameters:
spellid
: The ID of the spell to check.- Return values: (bool)
true
: The spell is created.false
: The spell is not created, or a spellid < 0 was given, or a spellid > = FAI_MAX_SPELLS was given.
(spellid, string[], len, bool:allowDefaultColors)
FAI_SpellToString
- Description: Get a spell's name + info.
- Parameters:
spellid
: The ID of the spell to get the name + info of.string[]
: An array into which to store the name + info, passed by reference.len
: The length of the string that should be stored. Recommended to be FAI_MAX_SPELL_NAME + FAI_MAX_SPELL_INFO + 15.bool:allowDefaultColors
: Should the string be colored with the system default colors? Defaults to true. The spell name will have color 0xffffffff and the spell info will have color 0xffd517ff.- Return values:
String length
: The function executed successfully.-1
: The function failed to execute. An invalid spellid was given.