Aller au contenu

Photo

Suicide Bomber


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

#1
MokahTGS

MokahTGS
  • Members
  • 946 messages

I'm looking for a script for a creature that will run up to the closest party member and explode into a acid cloud along with a bit of force damage.  

 

Are there any scripts out there like this or could someone whip something like that up?  

 

This of course would be on a hostile creature.



#2
Dann-J

Dann-J
  • Members
  • 3 161 messages

It could be done using a custom AoE on the creature (applied from its OnSpawn script), with the AoE's OnEnter script checking whether GetEnteringObject() is an enemy to them (so they don't blow up neutrals, allies or themselves) and explodifying accordingly. Simply being hostile should cause them to run towards an enemy (like a party member).

 

An even easier option is to emulate the blast skeletons from Icewind Dale, which I did in Shaar Moan. Give them 1HP and an OnDeath script that causes the explosion, so engaging them in melee combat is a bad idea. Shooting them from a distance will detonate them safely.

 

The OnDeath script used by Balors can also be used as a guide. Just replace all the fire damage effects and VFX with acidy ones, and possibly tone down the damage and radius (unless you're looking for an acid armageddon).



#3
MokahTGS

MokahTGS
  • Members
  • 946 messages

So, I'm assuming I missed something and I have no idea about damage numbers so a a little help there would be appreciated.  Here's what I have so far...

// jw_suicide_acd_de
//
// a suicide bomber explodes in acid on death

// JSH-OEI 5/10/07
// EPF 7/13/07 - moving to global
// Modified by MokahTGS 7-21-2015

#include "NW_I0_SPELLS"    
void main()
{
    //Declare major variables
	object oPC = GetFirstPC();
    object oCaster = OBJECT_SELF;
    int nMetaMagic = GetMetaMagicFeat();
    int nDamage;
    float fDelay;
    effect eExplode = EffectNWN2SpecialEffectFile("sp_vitriolic_hit");
    effect eVis = EffectVisualEffect(VFX_IMP_ACID_L);
    effect eDam;
    //Get the spell target location as opposed to the spell target.
    location lTarget = GetLocation(OBJECT_SELF);
    //Limit Caster level for the purposes of damage
    //Apply the fireball explosion at the location captured above.
    ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lTarget);
    //Declare the spell shape, size and the location.  Capture the first target object in the shape.
    object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR);
    //Cycle through the targets within the spell shape until an invalid object is captured.
    while (GetIsObjectValid(oTarget))
    {
       //Fire cast spell at event for the specified target
        SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_VITRIOLIC_SPHERE));
        //Get the distance between the explosion and the target to calculate delay
        fDelay = GetDistanceBetweenLocations(lTarget, GetLocation(oTarget))/50;
        
		//Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
        nDamage = GetReflexAdjustedDamage(100, oTarget, 30, SAVING_THROW_TYPE_ACID);
        //Set the damage effect
        eDam = EffectDamage(nDamage, DAMAGE_TYPE_ACID);
        if(nDamage > 0)
        {
            // Apply effects to the currently selected target.
            DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
            //This visual effect is applied to the target object not the location as above.  This visual effect
            //represents the flame that erupts on the target not on the ground.
            DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
        }
       
       //Select the next target within the spell shape.
       oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR);
    }
	
	SendMessageToPC(oPC, "A formian drone has exploded, sending acid spraying in all directions.");
	ExecuteScript("nw_c2_default7", OBJECT_SELF);
}

This also does nothing as far as the behavior of a suicide bomber, which is what I want.  I'm also looking for scripts making the creature run at the player or nearest player party member and self detonate or in this case just die.



#4
Dann-J

Dann-J
  • Members
  • 3 161 messages

Giving your vitriolic suicide bomber just one hit point would ensure that they died in short order. Just one jab (or shot, or spell) from a player and it's 'sploding time. There doesn't appear to be any check for friend or foe in the above script, which could result in some amusing (not so much for the player) chain reactions if you have multiple bombers within blast range of each other.

 

The custom AoE idea would allow them to self-detonate when they get within range, but that's a slightly more complex approach that requires several more scripts. You'd need to have an OnSpawn script to apply the AoE (essentially an 'aura') to the hostile, and an OnEnter script for the aura itself that kills the bomber (thus triggering their OnDeath script). Or you could have the aura OnEnter script trigger the explosion directly, and rely on the fact that the explosion will also kill the bomber (since there's no check to avoid self-harm in the above script - not that an OnDeath script would ever do so).



#5
MokahTGS

MokahTGS
  • Members
  • 946 messages

Giving your vitriolic suicide bomber just one hit point would ensure that they died in short order. Just one jab (or shot, or spell) from a player and it's 'sploding time. There doesn't appear to be any check for friend or foe in the above script, which could result in some amusing (not so much for the player) chain reactions if you have multiple bombers within blast range of each other.

 

The custom AoE idea would allow them to self-detonate when they get within range, but that's a slightly more complex approach that requires several more scripts. You'd need to have an OnSpawn script to apply the AoE (essentially an 'aura') to the hostile, and an OnEnter script for the aura itself that kills the bomber (thus triggering their OnDeath script). Or you could have the aura OnEnter script trigger the explosion directly, and rely on the fact that the explosion will also kill the bomber (since there's no check to avoid self-harm in the above script - not that an OnDeath script would ever do so).

 

After some internal testing I think I'm going to leave it as is, since they are hostile and run at the player all on their own it works just fine.  I tweaked the numbers a bit and have the script doing a d20x3 roll for damage ATM and as you said this adds for some "fun" when there are multiple bombers bunched up.  Elemental resistance spells should help deal with them and shooting them from range is suggested.



#6
rjshae

rjshae
  • Members
  • 4 485 messages

Now if we just had a good exploskeleton model... :D



#7
Dann-J

Dann-J
  • Members
  • 3 161 messages

Will you be equipping your bombers with some of these beauties? :)

 

I'm currently using one of them on an archivist NPC.



#8
kamal_

kamal_
  • Members
  • 5 240 messages

Bomb beasts!

http://neverwinterva...-2013-oldschool



#9
Dann-J

Dann-J
  • Members
  • 3 161 messages

 

They're just asking to be retextured as killer jack-o-lanterns for a Halloween-themed module.



#10
Tchos

Tchos
  • Members
  • 5 042 messages

I'm currently using one of them on an archivist NPC.

 

I thought you were going to mention this archivist.



#11
Dann-J

Dann-J
  • Members
  • 3 161 messages

I thought you were going to mention this archivist.

 

Love the 'Shush' attack! Although he seems more like an Arcane Scholar of Candlekeep than an Archivist. :)