Aller au contenu

Photo

Giving the credit to the PC for damaging something...


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Darin

Darin
  • Members
  • 282 messages

I have a number of scripts that are supposed to carry the damaging object over to cause more damage (setting stuff on fire being the most obvious).

 

However, they don't seem to be working...

 

the method I'm using is:

 

object oAttacker = GetLastDamager(OBJECT_SELF);

...

AssignCommand(oAttacker,ApplyEffectToObject(DURATION_TYPE_INSTANT, eHit, oTarget));
 

where eHit is a damage effect (sometimes with visuals, sometimes not, etc.)

 

Any way to make this work better?



#2
Dann-J

Dann-J
  • Members
  • 3 161 messages

As Beyonce might say; if you want it, then you should have put a wrapper 'round it.

 

I've always found that putting the damage-causing part of the script inside a wrapper, then assigning the wrapped void to the player, yields better results.

 

For instance:

 

void DoDamage(object oTarget)

{

effect eHit = [blah blah blah]

ApplyEffectToObject(DURATION_TYPE_INSTANT, eHit, oTarget));

}

 

void Main()

{

object oPC = GetLastDamager(OBJECT_SELF);

AssignCommand(oPC, DoDamage(OBJECT_SELF));

}



#3
Darin

Darin
  • Members
  • 282 messages

that actually worked.



#4
Dann-J

Dann-J
  • Members
  • 3 161 messages

You sound surprised. Should I be offended? :)

 

Just don't ask me *why* it's necessary. ApplyEffectToObject() is supposed to return a void just like a wrapper does, so it should work directly. But clearly it doesn't.



#5
Darin

Darin
  • Members
  • 282 messages

No, C++ or NWN2 should be offended, since the wrapper function workaround should be nonsensical, but yeah, it does work....weird.