I have learnt some of the basic's by creating a new spell based on an existing spell and making that available in game, which was straight forward enough... however i wanted to go one step further and learn how to convert an existing monster ability into a player ability. I have got as far as making the script, ie the difficult bit, and have hit a snag.... i have copied the begining, the ability and main sections and deleted parts which seem to belong to other abilities in the script (See Below).
What im after is for some to spot where im going wrong, im quick at picking things up, i have a big learning curve ahead of me.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "log_h"
#include "abi_templates"
#include "spell_constants_h"
#include "talent_constants_h"
#include "ability_summon_h"
#include "plt_tut_modal"
#include "plt_cod_aow_spellcombo7"
#include "sys_traps_h"
#include "monster_constants_h"
#include "spell_constants_h"
const int CUSTOM_SPELL2 = 777778;
void _HandleImpact(struct EventSpellScriptImpactStruct stEvent)
{
// -------------------------------------------------------------------------
// VAR BLOCK
// -------------------------------------------------------------------------
int nScalingVector = SCALING_VECTOR_DURATION;
int nAttackingValue = PROPERTY_ATTRIBUTE_SPELLPOWER;
int nResistance = RESISTANCE_INVALID;
float fDuration = 0.0f;
float fScaledValue = 0.0f;
int nEffect = 0;
int nHandler = SPELL_HANDLER_CUSTOM;
effect eDamage;
effect eEffect;
effect[] eEffects;
// 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 CUSTOM_SPELL2:
{
Log_Trace_Spell("_ApplyImpactDamageAndEffects","MONSTER_REVENANT_PULL", stEvent.nAbility, stEvent.oTarget);
effect eDamage = EffectDamage(MONSTER_REVENANT_PULL_DAMAGE_PER_LEVEL* GetLevel(stEvent.oCaster), DAMAGE_TYPE_SPIRIT);
ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eDamage, stEvent.oTarget);
// force pull character forward
effect ePull = EffectKnockdown(stEvent.oCaster, 0, ABILITY_TALENT_MONSTER_REVENANT_PULL);
ePull = SetEffectEngineFloat(ePull, EFFECT_FLOAT_KNOCKBACK_DISTANCE, -0.5f);
ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, ePull, stEvent.oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility);
ApplyEffectVisualEffect(stEvent.oCaster, stEvent.oTarget, 1050, EFFECT_DURATION_TYPE_INSTANT, 0.0, stEvent.nAbility);
break;
}
}
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;
}
}
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------



Sign In
Create Account
Back to top








