Author Sticky: Post Working Scripts Here
Frostie Posted: Thursday, 27 June 07:04AM
OK, so a lot of people (myself included) seem to have had problems on applying spell effects to monsters when they are summoned by doing something like opening a chest (I don't think this applies to monsters who join the part, but hostile monsters).
Anyway, I've come up with a solution - it's not really what I wanted, but it's pretty good - and I figure if I use this effect to summon 15 or so Umber Hulks, my first level characters aren't really going to notice the slight imperfection.
Anyway, it works like this

Firstly, you have to create an invisible object, then set its tag to something like INVIS_001. Now, and this is important, go to the invisible objects properties and make sure your UNCHECK the static checkbox, and don't check any of the others.

Now use this script with a chest OnOpen event (or something like that):

NWScript:
void main()

{

   //Get the PC who opened the chest

   object oCreature = GetLastOpenedBy();

   //Get an object reference to the invisible object

   object oLoc = GetObjectByTag("INVIS_001");

   //Make sure the opener is a PC

   if (GetIsObjectValid(oCreature) == TRUE && GetIsPC(oCreature) == TRUE)

   {

    //Apply the effect to the invisible object

    ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), oLoc);

    

    //Wait for a little bit, actually you don't have to do this but I prefer it

    ActionWait(0.5);

    //Set the type of creature you want to create

    string sCreature = "NW_MUMMY";

    //Create the creature right over the invisible object

    object oMonster = CreateObject(OBJECT_TYPE_CREATURE, sCreature, GetLocation(oLoc), FALSE);

    

    //Now have the creature attach the PC, or take this line out if you want the creature to find the PC on their own

    //AssignCommand(oMonster, ActionAttack(oCreature));

   }

}



That's it, give it a try.