Difference between revisions of "EVENT TYPE ATTACK IMPACT"

From Dragon Age Toolset Wiki
Jump to: navigation, search
m (Fixed fixed template, moved and tweaked example)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{event
 
{{event
|sourcefile=script.ldf
+
|sourcefile   = script.ldf
|when=Exact moment of impact
+
|when         = Exact moment of impact
|from=Engine
+
|from         = Engine
|to=Attacking creature or player
+
|to           = Attacking creature or player
|tocategory1=creature
+
|tocategory1   = creature
|sortkey=ATTACK_IMPACT
+
|sortkey       = ATTACK_IMPACT
|creatordesc=attacker
+
|creatordesc   = attacker
|int0name=nResult
+
|int0name     = nHitResult
|int0desc=hit result (hit, miss, critical etc')
+
|int0desc     = hit result (hit, miss, critical etc')
|int1name=nDamage
+
|int1name     = nEffectId
|int1desc=damage
+
|int1desc     = effect Id
|int2name=nProjectileType
+
|object0name   = oAttacker
|int2desc=
+
|object0desc   = attacker
|object0name=oAttacker
+
|object1name   = oTarget
|object0desc=attacker
+
|object1desc   = target
|object1name=oTarget
+
|location0name = lImpact
|object1desc=target
+
|location0desc = position
|location0name=lImpact
+
|location1name = lMissile
|location0desc=position
+
|location1desc = orientation
|location1name=lMissile
+
|location1desc=orientation
+
 
}}
 
}}
  
 
An attack has impacted the target. This can be melee (sword hit), ranged (arrow hit) or spell (fireball explodes). Used for applying damage, and handling abilities that function on hit (Berserk etc').
 
An attack has impacted the target. This can be melee (sword hit), ranged (arrow hit) or spell (fireball explodes). Used for applying damage, and handling abilities that function on hit (Berserk etc').
  
[[Category:Event types|ATTACK_IMPACT]]
+
== Example ==
[[Category:Creature events|ATTACK_IMPACT]]
+
 
 +
<dascript>
 +
case EVENT_TYPE_ATTACK_IMPACT:
 +
{
 +
    // decompose the attack impact event
 +
    int nEffectId = GetEventInteger(ev, 1);  // effect Id
 +
    object oAttacker = GetEventObject(ev, 0); // attacker
 +
 
 +
    // decompose the impact effect
 +
    effect eImpact = GetAttackImpactDamageEffect(oAttacker, nEffectId);
 +
    object oWeapon = GetEffectObject(eImpact, 0);
 +
    int nAbility = GetEffectInteger(eImpact, 1);
 +
    float fDamage = GetEffectFloat(eImpact, 0);
 +
    int nVfx = GetEffectInteger(eImpact, 0);
 +
    int nDamageType = GetEffectInteger(eImpact, 2);
 +
 
 +
    int nAppearance = GetAppearanceType(oAttacker);
 +
 
 +
    break;
 +
}
 +
</dascript>

Latest revision as of 20:16, 4 May 2011

Source:
script.ldf
Sent when:
Exact moment of impact
Sent from:
Engine
Sent to:
Attacking creature or player
Parameters:
  • Creator: attacker
  • Integer 0: hit result (hit, miss, critical etc')
  • Integer 1: effect Id
  • Object 0: attacker
  • Object 1: target
  • Location 0: position
  • Location 1: orientation

Usage

case EVENT_TYPE_ATTACK_IMPACT:
{
int nHitResult = GetEventInteger(ev, 0); // hit result (hit, miss, critical etc')
int nEffectId = GetEventInteger(ev, 1); // effect Id
object oAttacker = GetEventObject(ev, 0); // attacker
object oTarget = GetEventObject(ev, 1); // target
location lImpact = GetEventLocation(ev, 0); // position
location lMissile = GetEventLocation(ev, 1); // orientation

// insert event-handling code here

break;
}

An attack has impacted the target. This can be melee (sword hit), ranged (arrow hit) or spell (fireball explodes). Used for applying damage, and handling abilities that function on hit (Berserk etc').

Example

case EVENT_TYPE_ATTACK_IMPACT:
{
    // decompose the attack impact event
    int nEffectId = GetEventInteger(ev, 1);   // effect Id
    object oAttacker = GetEventObject(ev, 0); // attacker
 
    // decompose the impact effect
    effect eImpact = GetAttackImpactDamageEffect(oAttacker, nEffectId);
    object oWeapon = GetEffectObject(eImpact, 0);
    int nAbility = GetEffectInteger(eImpact, 1);
    float fDamage = GetEffectFloat(eImpact, 0);
    int nVfx = GetEffectInteger(eImpact, 0);
    int nDamageType = GetEffectInteger(eImpact, 2);
 
    int nAppearance = GetAppearanceType(oAttacker);
 
    break;
}