Jump to content

[Script Help] Arcane Warrior Taunt


algun

Recommended Posts

hello,

 

I try to put the warrior's taunt in the arcane warrior template and I think i have a problem with the script.

- I have the taunt icon in the arcane warrior template

- I have the visual effect when I cast

- ... Mobs stay on my followers :(

 

If someone can help me

 

#include "log_h"

#include "abi_templates"

#include "combat_h"

#include "talent_constants_h"

#include "achievement_core_h"

#include "ai_threat_h"

#include "spell_constants_h"

 

 

void _ApplySpellEffects(struct EventSpellScriptImpactStruct stEvent, object oTarget)

{

float fScaledValue;

effect eEffect;

 

switch (stEvent.nAbility)

{

case ABILITY_TALENT_TAUNT:

{

// if hostile

if (IsObjectHostile(stEvent.oCaster, oTarget) == TRUE)

{

float fThreat = TAUNT_THREAT_INCREASE;

 

if (HasAbility(stEvent.oCaster, ABILITY_TALENT_FRIGHTENING) == TRUE)

{

fThreat += FRIGHTENING_TAUNT_BONUS;

}

SetLocalInt(oTarget, AI_THREAT_TARGET_SWITCH_COUNTER, 0);

AI_Threat_UpdateCreatureThreat(oTarget, stEvent.oCaster, fThreat);

}

 

break;

}

}

}

void _ApplyImpactDamageAndEffects(struct EventSpellScriptImpactStruct stEvent)

{

// only work for sphere spells

int nAoEType = GetM2DAInt(TABLE_ABILITIES_SPELLS, "aoe_type", stEvent.nAbility);

if (nAoEType == 1)

{

// location impact vfx

if (stEvent.oTarget != OBJECT_INVALID)

{

stEvent.lTarget = GetLocation(stEvent.oTarget);

}

Ability_ApplyLocationImpactVFX(stEvent.nAbility, stEvent.lTarget);

 

float fRadius = GetM2DAFloat(TABLE_ABILITIES_SPELLS, "aoe_param1", stEvent.nAbility);

 

// get objects in area of effect

object[] oTargets = GetObjectsInShape(OBJECT_TYPE_CREATURE, SHAPE_SPHERE, stEvent.lTarget, fRadius);

 

// spell-specific special events

switch (stEvent.nAbility)

{

case ABILITY_TALENT_WAR_CRY:

{

// caster vfx

effect eEffect = EffectVisualEffect(WAR_CRY_CASTER_VFX);

ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eEffect, stEvent.oCaster, 0.0f, stEvent.oCaster, stEvent.nAbility);

 

break;

}

 

case ABILITY_TALENT_CLEANSE_AREA:

{

// glyph of paralysis

object[] oTraps = GetObjectsInShape(OBJECT_TYPE_PLACEABLE, SHAPE_SPHERE, stEvent.lTarget, fRadius);

 

int nCount = 0;

int nMax = GetArraySize(oTraps);

for (nCount = 0; nCount < nMax; nCount++)

{

#ifdef DEBUG

Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, "AoE " + ToString(nCount) + " = " + GetTag(oTraps[nCount]));

#endif

if (GetTag(oTraps[nCount]) == GLYPH_OF_PARALYSIS_TAG)

{

DestroyObject(oTraps[nCount]);

}

}

 

// normal glyphs

oTraps = GetObjectsInShape(OBJECT_TYPE_AREAOFEFFECTOBJECT, SHAPE_SPHERE, stEvent.lTarget, fRadius);

 

nCount = 0;

nMax = GetArraySize(oTraps);

for (nCount = 0; nCount < nMax; nCount++)

{

#ifdef DEBUG

Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, "AoE " + ToString(nCount) + " = " + GetTag(oTraps[nCount]));

#endif

string sTag = GetTag(oTraps[nCount]);

if ((sTag == GLYPH_OF_WARDING_TAG) || (sTag == GLYPH_OF_REPULSION_TAG))

{

DestroyObject(oTraps[nCount]);

}

}

 

break;

}

}

 

// cycle through objects

int nCount = 0;

int nMax = GetArraySize(oTargets);

for (nCount = 0; nCount < nMax; nCount++)

{

// per-spell effects

_ApplySpellEffects(stEvent, oTargets[nCount]);

}

 

// ------------ -------------------

ACH_ProcessAchievementImpactDamageAndEffects(stEvent, oTargets);

// ------------ -------------------

}

}

 

void main()

{

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev); // CAST (directly from engine) or COMMAND_PENDING (re-directed by rules_core)

 

switch(nEventType)

{

case EVENT_TYPE_SPELLSCRIPT_PENDING:

{

// Get a structure with the event parameters

struct EventSpellScriptCastStruct stEvent = Events_GetEventSpellScriptCastParameters(ev);

 

#ifdef DEBUG

Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, GetCurrentScriptName() + ".EVENT_TYPE_SPELLSCRIPT_PENDING", Log_GetAbilityNameById(stEvent.nAbility));

#endif

 

// Setting Return Value

Ability_SetSpellscriptPendingEventResult(COMMAND_RESULT_SUCCESS);

 

break;

}

 

case EVENT_TYPE_SPELLSCRIPT_CAST:

{

// Get a structure with the event parameters

struct EventSpellScriptCastStruct stEvent = Events_GetEventSpellScriptCastParameters(ev);

 

#ifdef DEBUG

Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, GetCurrentScriptName() + ".EVENT_TYPE_SPELLSCRIPT_CAST",Log_GetAbilityNameById(stEvent.nAbility));

#endif

 

// 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);

 

#ifdef DEBUG

Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, GetCurrentScriptName() + ".EVENT_TYPE_SPELLSCRIPT_IMPACT",Log_GetAbilityNameById(stEvent.nAbility));

#endif

 

// AbiAoEImpact(stEvent.lTarget, stEvent.oCaster, stEvent.nAbility);

_ApplyImpactDamageAndEffects(stEvent);

 

break;

}

}

}

Link to comment
Share on other sites

The script looks ok.

 

How did you move the taunt ability to the arcane warrior skill list? Did you create a new GDA row with the same values as the taunt row?

 

If so, then the problem is with the switch block. You have that set to catch the ABILITY_TALENT_TAUNT event which isn't what you're trying to do. In this case, you made a new ability and you have to catch that as well.

 

To fix it, you'll need to make a new constant and set it to the value in the ID row in your GDA file. Such as:

 

const int ARCANEWARRIOR_TAUNT = 12345; (whatever the row value is)

 

.

.

.

 

case ARCANEWARRIOR_TAUNT: <---add this line right above the taunt block.

case ABILITY_TALENT_TAUNT: {

 

 

I'm making several assumptions based on the symptoms you described. Let me know if I'm in error.

Link to comment
Share on other sites

Wow. Not to hijack the thread, but is that whole script for just one spell?

I've been working on a mod to change the AW abilities as well, but most of them are original and would require new scripts. Some don't even have similar counterparts that I could use as a guide... I can't imagine how I could possibly go through all of that with each one, with how little knowledge I have of this game's scripting :pinch:

Please tell me that's not as convoluted as it looks.

 

As for your question, with my knowledge of just general scripting, it sounds like the ability isn't activating the script properly.

My guess would be what Angryman basically said, if I understood him correctly; there's probably an invalid path somewhere linking the spell to the script.

Link to comment
Share on other sites

I'm just stupid...

 

I haven't rename the case "case ABILITY_TALENT_TAUNT" with the name of my spell....

 

Sorry. thanks angryman

 

SD:

 

void _ApplySpellEffects(struct EventSpellScriptImpactStruct stEvent, object oTarget)
{
float fScaledValue;
effect eEffect;

switch (stEvent.nAbility)
{
case ABILITY_TALENT_TAUNT:
{
// if hostile
if (IsObjectHostile(stEvent.oCaster, oTarget) == TRUE)
{
float fThreat = TAUNT_THREAT_INCREASE;

if (HasAbility(stEvent.oCaster, ABILITY_TALENT_FRIGHTENING) == TRUE)
{
fThreat += FRIGHTENING_TAUNT_BONUS;
}
SetLocalInt(oTarget, AI_THREAT_TARGET_SWITCH_COUNTER, 0);
AI_Threat_UpdateCreatureThreat(oTarget, stEvent.oCaster, fThreat);
}

break;
}
}
}

 

This is the script for the spell. Others fonction are generic to apply spell effect

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...