Spookeh creatures

Moderator: Event DM

Post Reply
User avatar
Neve
Prince of Bloated Discourse
Posts: 192
Joined: Mon Apr 14, 2003 4:09 pm
Location: The Netherlands
Contact:

Spookeh creatures

Post by Neve » Tue Aug 26, 2003 5:55 pm

Okay. Another funny thing I made lately. I hope it's usable to anyone. At least it's annoying as hell for wizards as it forces them to go in close combat =) A "ghostly" creature will attack as any other creature, but when it's damaged, it will disappear, and reappear behind the player who damaged it, with the correct amount of HP left. These creatures will only appear at night.

Create a new custom creature, preferrably a Spectre or Shadow, though it will work on every creature, and replace the following scripts :

OnDamaged :

Code: Select all

/*
    August 25, 2003 - Eric Ettes - Raiko - zeiren@hotmail.com
    This script creates a new ghost just behind the player who just damaged it
    Place this script in the OnDamaged slot
*/

location RearLocation(object oPC){
    float  fDistance    = 2.0;
    object oTarget      = (oPC);
    object oArea        = GetArea(oTarget);
    vector vPosition    = GetPosition(oTarget);
    vPosition.z        += 0.5;
    float  fOrientation = -GetFacing(oTarget);
    vector vNewPos      = AngleToVector(fOrientation);
    float  vZ           = vPosition.z;
    float  vX           = vPosition.x - fDistance * vNewPos.x;
    float  vY           = vPosition.y - fDistance * vNewPos.y;
    fOrientation        = -GetFacing(oTarget);
    vX                  = vPosition.x - fDistance * vNewPos.x;
    vY                  = vPosition.y - fDistance * vNewPos.y;
    vNewPos             = AngleToVector(fOrientation);
    vZ                  = vPosition.z;
    vNewPos             = Vector(vX, vY, vZ);

    return Location(oArea, vNewPos, fOrientation);
}

void main(){
    object NewGhost;
    object oAttacker = GetLastDamager();
    string GhostType = GetResRef(OBJECT_SELF);
    int NewHitPoints;

    if(!GetLocalInt(OBJECT_SELF, "Damaged")) SetLocalInt(OBJECT_SELF, "Damaged", 1);
    else{
        NewHitPoints = GetMaxHitPoints() - GetCurrentHitPoints();
        DestroyObject(OBJECT_SELF);
        NewGhost = CreateObject(OBJECT_TYPE_CREATURE, GhostType, RearLocation(oAttacker));
        ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(NewHitPoints), NewGhost);
        AssignCommand(NewGhost, ActionAttack(oAttacker));
    }
}
OnSpawn :

Code: Select all

/*
    August 25, 2003 - Eric Ettes - Raiko - zeiren@hotmail.com
    This script makes the creature spooky and sets a localint used for damage
    Place this script in the OnSpawn slot
*/

#include "NW_I0_GENERIC"

void main(){
    if(GetIsNight()){
        SetLocalInt(OBJECT_SELF, "Damaged", 1);
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_GHOSTLY_VISAGE), OBJECT_SELF);
        SetListeningPatterns();
        WalkWayPoints();
        return;
    }
    DestroyObject(OBJECT_SELF);
}
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
Maelstrom
Lord of Blithering Idiots
Posts: 124
Joined: Thu Jun 12, 2003 5:56 pm
Location: Littleton, CO
Contact:

Post by Maelstrom » Tue Aug 26, 2003 6:04 pm

Why do you need to destroy the creature and create a new one? Can't you just move the creature?
User avatar
Drakuul
Sage
Posts: 2375
Joined: Tue May 20, 2003 3:17 pm
Location: UK, South Wales

Post by Drakuul » Tue Aug 26, 2003 6:36 pm

I would assume it's because if you destroy it and recreate it, all characters in combat have to retarget it - annoying as hell! I like it!
User avatar
Neve
Prince of Bloated Discourse
Posts: 192
Joined: Mon Apr 14, 2003 4:09 pm
Location: The Netherlands
Contact:

Post by Neve » Tue Aug 26, 2003 7:10 pm

Indeed, and you can only hit it once =) Moving the ghost would stop the ghost from attacking, and make it walk to another location while the player could keep bashing it. Aaand, the ghost wouldn't disappear, and promptly appear behind the player, which was the point of the script =) It would just move to another location as if it was walking/floating.

Imagine a wizard casting a fireball which destroys one ghost, but damages all other ghosts. All those damaged ghosts would instantly be in close combat with the wizard, and we all know how good wizards are in Close Combat :twisted:
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
Maelstrom
Lord of Blithering Idiots
Posts: 124
Joined: Thu Jun 12, 2003 5:56 pm
Location: Littleton, CO
Contact:

Post by Maelstrom » Tue Aug 26, 2003 7:37 pm

I guess I was just thinkin' you could use the JumpToLocation function to produce the same effect without having to Destroy the existing creature and Create a new one. It seems to me that you would want to avoid those functions unless absolutely necessary because of the intensive nature of them. Dunno.
User avatar
Neve
Prince of Bloated Discourse
Posts: 192
Joined: Mon Apr 14, 2003 4:09 pm
Location: The Netherlands
Contact:

Post by Neve » Tue Aug 26, 2003 7:39 pm

Ahh gah. I didn't even think of using that function really :P
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
User avatar
maxinion
Team Member; Retired with Honors
Posts: 2778
Joined: Mon Mar 17, 2003 7:44 pm
DM Avatar: Andrinor
Location: Bay Area, CA
Contact:

Post by maxinion » Tue Aug 26, 2003 9:02 pm

I imagine that you wouldn't have to click again, though, because you're still locked in the attack. Their location just moves. The spell won't be broken, the attacker will automatically turn around, etc.
Myk D'vor
Lord of Blithering Idiots
Posts: 111
Joined: Mon Feb 24, 2003 9:05 am

Post by Myk D'vor » Wed Aug 27, 2003 4:32 am

Maxguy25 wrote:I imagine that you wouldn't have to click again, though, because you're still locked in the attack. Their location just moves. The spell won't be broken, the attacker will automatically turn around, etc.
unless you added a AssignCommand(oPC,ClearAllActions(TRUE)); to it...

Just clear the PCs actions, then have the critter jump behind them, they'll have to re-click (the TRUE above is to force the PC to break combat).

Myk D'Vor
Post Reply