Перейти к содержимому

Фотография

No scripting skills . . need script to make placeable explode and cause dmg


  • Пожалуйста, авторизуйтесь, чтобы ответить
11 ответов в этой теме

#1
Arianna0

Arianna0
  • Members
  • 20 сообщений

Trying to make a script that   causes  a placeable to  explode  when  player tries to break it and do them damage like a trap would.  

 

Tried just  making it trapped but that did not work like I wanted it to

 

Tried using the Lilac soul  script  but it won't compile for me

 

void main()
{
    object oSelf = OBJECT_SELF;
    effect eVFX;
    effect eDamage;

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

    // Only fire once per PC.
    if ( GetLocalInt(OBJECT_SELF, "DO_ONCE__" + ObjectToString(oPC)) )
        return;
    SetLocalInt(OBJECT_SELF, "DO_ONCE__" + ObjectToString(oPC), TRUE);

    // Cause damage.
    eDamage = EffectDamage(d10(3), DAMAGE_TYPE_ELECTRICAL);
    eVFX = EffectVisualEffect(VFX_IMP_LIGHTNING_S);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC)
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX   , oPC)

    // Destroy an object (not fully effective until this script ends).
    DestroyObject(oSelf);
}

 

 it first gives me errors  at       ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX   , oPC)

and if I remove that it  errors at      DestroyObject(oSelf);

 

so not sure what I need to do    I have 12  of these items around a room that the players may need to deal with



#2
kamal_

kamal_
  • Members
  • 5 235 сообщений

Exploding barrels script, works a treat, I've used it myself:

 

http://neverwinterva...plosive-barrels



#3
Tchos

Tchos
  • Members
  • 5 030 сообщений

I second Kamal's suggestion.  I used them in my campaign, too.  3 sizes of explosion to choose from, debris, knockdown, etc.



#4
Arianna0

Arianna0
  • Members
  • 20 сообщений

Ok   . . . so . .

 

How would I go about changing the damage type from  fire to   electrical  ?

 

and make it so that  only the  PC  damaging the item  is  zapped ?



#5
kevL

kevL
  • Members
  • 4 052 сообщений
this is working pretty good for me in events
on Melee Attacked
on Spell Cast At

// 'plc_explode'

void main()
{
    if (!GetLocalInt(OBJECT_SELF, "done"))
    {
        object oPC = GetLastHostileActor();
        if (GetIsObjectValid(oPC))
        {
            SetLocalInt(OBJECT_SELF, "done", TRUE);

            AssignCommand(oPC, ClearAllActions(TRUE));

            effect eVis1 = EffectBeam(VFX_BEAM_LIGHTNING, OBJECT_SELF, BODY_NODE_CHEST);
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis1, oPC, 2.5f);

            effect eVis2 = EffectVisualEffect(VFX_HIT_SPELL_LIGHTNING);
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis2, oPC, 2.5f);

            effect eElec = EffectDamage(d10(3), DAMAGE_TYPE_ELECTRICAL, DAMAGE_POWER_ENERGY);
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eElec, oPC);

            DestroyObject(OBJECT_SELF);
        }
    }
}

notes:
- no check for distance
- no save

It's getting pretty dark in my part of the woods, zzzz for now.

#6
Tchos

Tchos
  • Members
  • 5 030 сообщений

That's probably more efficient than removing all of the area of effect code and changing the visual effects and damage types of the Markshire ones.



#7
Sabranic

Sabranic
  • Members
  • 306 сообщений

Ahhh I can use this!  Thanks!



#8
Arianna0

Arianna0
  • Members
  • 20 сообщений

Oh   thanks  very much   that looks  exactly like what I need

 

Would I put it in the  on death or  the ondamaged section?



#9
kevL

kevL
  • Members
  • 4 052 сообщений
try
- onMeleeAttacked
- onSpellCastAt

only. And that should cover it.

#10
Tchos

Tchos
  • Members
  • 5 030 сообщений

Just so there's no confusion, the script slots on the placeable in its properties are called "On Melee Attacked Script" and "On Spell Cast At Script", with spaces between the words, not concatenated and in CamelCase like a function, so don't go looking for a function.



#11
Arianna0

Arianna0
  • Members
  • 20 сообщений

Works great thanks 

 

 

 

Now I just need to figure out how to make  my  Monsters  go hostile  when a PC  walks over a trigger  . . .  all my attempts end up with the rest of the server  faction going hostile as well  or   nothing happening



#12
kevL

kevL
  • Members
  • 4 052 сообщений
maybe start a new thread. Describe what you have set up so far.