I've been endeavoring to add a new Blood Magic spell, but the script seems to be dead set against compiling.
I'm much more of a java guy than a c+ guy, so it's entirely possible I'm making some idiotic mistake.
Here's the script, any advice and/or suggestions would be greatly appreciated.
// -----------------------------------------------------------------------------
// blood_rend.nss
// -----------------------------------------------------------------------------
#include "log_h"
#include "abi_templates"
#include "sys_traps_h"
#include "spell_constants_h"
const int BLOOD_REND = 666667;
void _HandleImpact(struct EventSpellScriptImpactStruct stEvent)
{
effect eEffect;
int bHostile = TRUE;
// make sure there is a location, just in case
if (IsObjectValid(stEvent.oTarget) == TRUE)
{
stEvent.lTarget = GetLocation(stEvent.oTarget);
}
// -------------------------------------------------------------------------
// Handle Spells
// -------------------------------------------------------------------------
switch (stEvent.nAbility)
{
case BLOOD_REND:
{
float nDamage = (100.0f + GetCreatureSpellPower(stEvent.oCaster)) * 0.36f;
effect eDamage = EffectDamage(nDamage, DAMAGE_TYPE_SPIRIT);
float fheal = (nDamage)(5f);
eEffect = EffectHeal(fHeal);
eEffect = SetEffectEngineInteger(eEffect, EFFECT_INTEGER_VFX, Ability_GetImpactObjectVfxId(stEvent.nAbility));
ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eEffect, stEvent.oCaster, 0.0f, stEvent.oCaster, stEvent.nAbility);
ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eDamage, stEvent.oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility);
break;
}
}
if(bHostile)
SendEventOnCastAt(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility, bHostile);
}
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
switch(nEventType)
{
case EVENT_TYPE_SPELLSCRIPT_PENDING:
{
Ability_SetSpellscriptPendingEventResult(COMMAND_RESULT_SUCCESS);
break;
}
case EVENT_TYPE_SPELLSCRIPT_CAST:
{
// Get a structure with the event parameters
struct EventSpellScriptCastStruct stEvent = Events_GetEventSpellScriptCastParameters(ev);
// Hand this through to cast_impact
SetAbilityResult(stEvent.oCaster, stEvent.nResistanceCheckResult);
break;
}
case EVENT_TYPE_SPELLSCRIPT_IMPACT:
{
// Get a structure with the event parameters
struct EventSpellScriptImpactStruct stEvent = Events_GetEventSpellScriptImpactParameters(ev);
Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, GetCurrentScriptName() + ".EVENT_TYPE_SPELLSCRIPT_IMPACT",Log_GetAbilityNameById(stEvent.nAbility));
// Handle impact
if (CheckSpellResistance(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility) == FALSE)
{
_HandleImpact(stEvent);
} else
{
UI_DisplayMessage(stEvent.oTarget, UI_MESSAGE_RESISTED);
}
break;
}
}
}
Adding a new spell - script problem
Débuté par
Alexandus
, mars 07 2010 10:56
#1
Posté 07 mars 2010 - 10:56
#2
Posté 08 mars 2010 - 01:03
What line is giving you the error when you compile and what is the error?
#3
Posté 08 mars 2010 - 01:06
You need a * and define the float value properly in
You also need to keep the fheal variable consistent across commands (very next line)
float fheal = (nDamage) * (5.0f);
You also need to keep the fheal variable consistent across commands (very next line)
#4
Posté 09 mars 2010 - 12:03
Halleujah! It compiles! Timelord, many thanks.
I can't believe I posted the script without the error and line number...this is why I shouldn't write topics at 3:00 in the morning haha, much less scripts.
Anyway, thank you again.
I can't believe I posted the script without the error and line number...this is why I shouldn't write topics at 3:00 in the morning haha, much less scripts.
Anyway, thank you again.





Retour en haut






