Hi all!
I'm working on a script that will create a visual effect on the player which was the most recent target of a creature, and would want to place this in the "creature heartbeat" area. I'm new to scripting, so I've patched this together from another script I've gotten to work, but I'm having trouble with this one. Can anyone help get me back on track and show me what I'm doing wrong?
Thanks so much!
void main(){
object GetAttackTarget(object oCreature=OBJECT_SELF)object GetAttemptedAttackTarget (object oCreature=OBJECT_SELF;
if (!GetIsPC(oPC)) return;
object oTarget;oTarget = oPC;
int nInt;nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_CRT_RED), oTarget);else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_CRT_RED), GetLocation(oTarget));
oTarget = OBJECT_SELF;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_CRT_RED), oTarget);else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_CRT_RED), GetLocation(oTarget));
}
New to scripting -- can anyone help fix this?
Débuté par
LindsayReynolds
, oct. 21 2012 08:27
#1
Posté 21 octobre 2012 - 08:27
#2
Posté 23 octobre 2012 - 07:57
I'm a bit rusty but maybe you could simplify it with something more like so?:
void main()
{
object oPC = GetAttackTarget();
if (!GetIsObjectValid(oPC)) oPC = GetAttemptedAttackTarget();
if (!GetIsPC(oPC) || !GetIsObjectValid(oPC)) return;
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_CRT_RED), oPC);
}
void main()
{
object oPC = GetAttackTarget();
if (!GetIsObjectValid(oPC)) oPC = GetAttemptedAttackTarget();
if (!GetIsPC(oPC) || !GetIsObjectValid(oPC)) return;
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_CRT_RED), oPC);
}





Retour en haut






