Skip to content

Destroy Placeables

ZephiriusZephirius Member Posts: 411
edited June 2021 in Builders - Scripting
I was wondering how you would assure that certain placeables are destroyed by an AOE spell cast by an antagonist?
I tried weakening them so they would explode whaen a fireball hit them, but they just sit there unscathed... :)

I don't want them to vanish, like when you use DestroyObject(), but rather I want them to explode.

Comments

  • sarevok57sarevok57 Member Posts: 5,975
    weird, i had placeables accidently get destroyed by a fireball when i didn't want them to get destroyed haha

    you could set a script on the items that you want destroyed on the "on death" script and set it so it does the "explosion" animation

  • ZephiriusZephirius Member Posts: 411
    Yeah, I've had that happen too, but never when you want it!
  • ZephiriusZephirius Member Posts: 411
    I couldn't find the proper animation to use either?
  • sarevok57sarevok57 Member Posts: 5,975
    void main()
    {
    object oTarget;
    effect eVFX;

    // Get the creature who triggered this event.
    object oPC = GetLastKiller();

    // We are really interested in the ultimate master of the killer.
    while ( GetMaster(oPC) != OBJECT_INVALID )
    oPC = GetMaster(oPC);

    // Destroy an object (not fully effective until this script ends).

    eVFX = EffectVisualEffect(VFX_FNF_GAS_EXPLOSION_FIRE);
    oTarget = GetObjectByTag("*place_object_tag_here*");
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oTarget);
    DestroyObject(oTarget, 3.0);
    }

    now when it comes to scripting i'm actually quite horrible at it, but with this one, if the you place it upon the "on death" script and if the PC destroys the object then it should explode

    now if you are a bit more script savy, you can replace all the oPC stuff with the NPC you are trying to use and hopefully have the same effect

    if not, worse case scenario that last bit with the;

    // Destroy an object (not fully effective until this script ends).

    should hopefully get you started in the right direction
  • ForSeriousForSerious Member Posts: 446
    You've also got the OnSpellCastAt script slot. Add a check if it's a spell that should make it explode, then apply enough extra damage to it to destroy it. Maybe add an explosion effect too.
  • ZephiriusZephirius Member Posts: 411

    ForSerious wrote: »
    You've also got the OnSpellCastAt script slot. Add a check if it's a spell that should make it explode, then apply enough extra damage to it to destroy it. Maybe add an explosion effect too.

    Gotta have some cool splosions. That's for sure.
Sign In or Register to comment.