Author Sticky: Post Working Scripts Here
Iskander Posted: Saturday, 22 June 01:42AM
1. Script Name: object_revenge

2. What it does: Kills any PC that attacks a placeable outright. Heh.

3. Notes: Place this script on a plot object's onPhysicallyAttacked and onSpellCastAt events to destroy anyone foolish enough to be hostile. Perhaps I should rename it pavlovs_objects?

3a. More Notes: The [yellow]Could Not Submit: Message contains word with too many characters without a space. Please check your message[/yellow] is a royal pain in the behind. Can you fix the parsing script to ignore between the [.nwscript] tags, please?

Cheers,
Iskander

4. The script:
NWScript:
//:://///////////////////// ////////////////////////

//:: FileName object_revenge

//:://///////////////////// ///////////////////////

//:://///////////////////// ///////////////////////

//:: Created By: Iskander of Plomar

//:: Created On: 6/21/2002 6:32:52 PM

//:://///////////////////// ///////////////////////

//

// A little script to blast any PC that attacks an

// object in my Training dungeon. Hah!

#include "nw_i0_generic"

void main()

{

  object oNaughtyOne = GetLastAttacker( OBJECT_SELF );

  if ((OBJECT_INVALID == oNaughtyOne) && GetLastSpellHarmful()) {

    oNaughtyOne = GetLastSpellCaster();

  }

  if (OBJECT_INVALID == oNaughtyOne) {

    SpeakString("Hmmmm. You should watch what you're doing...");

    return;

  }

  SpeakString("Fool! You would bite the hand that feeds you?");

  ApplyEffectToObject( DURATION_TYPE_INSTANT,

                       EffectDamage( GetMaxHitPoints(oNaughtyOne), DAMAGE_TYPE_DIVINE),

                       oNaughtyOne,

                       0.0f);

}