Jump to content

Home

Damage Self?


Recommended Posts

Does anyone know a script that will damage the PC who sets off the effect. So far I have

effect nDam=EffectDamage(100,SWFP_DAMAGE_TYPE);

Would it be right if I used this afterwards?

ApplyEffectToObject(DURATION_TYPE_TEMPORARY,nDam,GetFirstPC(),2.0);

Or should I use this?

ApplyEffectToObject(DURATION_TYPE_TEMPORARY,nDam,OBJECT_SELF,2.0);

 

I'm not sure when which applies to which style. I know they mean the same basic thing. It there a general rule to which way it is coded?

 

Thanks!

 

:)

Link to comment
Share on other sites

The two lines target different objects. The first one with GetFirstPC() will always damage the player. OBJECT_SELF will damage the object who is running the script which is what you want, I think. Also, a damage effect can't be a temporary effect. DURATION_TYPE_INSTANT would fit better. If you want the damage to go away after a while as your script indicates then you can apply a delayed heal effect.

effect nDam=EffectDamage(100,SWFP_DAMAGE_TYPE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, nDam, OBJECT_SELF);
DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(100), OBJECT_SELF));

Link to comment
Share on other sites

That was an example of how to apply a delayed healing effect, which would occur after 2 seconds.

 

Another way to write the script to see the parallel between the damaging and the healing:

effect nDam=EffectDamage(100,SWFP_DAMAGE_TYPE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, nDam, OBJECT_SELF);

effect nHeal=EffectHeal(100);
DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, nHeal, OBJECT_SELF));

Link to comment
Share on other sites

So what you are saying is that..:

 

effect nDam=EffectDamage(100,SWFP_DAMAGE_TYPE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, nDam, OBJECT_SELF);

 

Should do the damage part..? And that..:

 

effect nDam=EffectDamage(100,SWFP_DAMAGE_TYPE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, nDam, OBJECT_SELF);

Should then heal it up 2 seconds after the damage came...

 

:)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...