Author Topic: OnEnter/OnSpawn  (Read 319 times)

Legacy_Omega27

  • Sr. Member
  • ****
  • Posts: 255
  • Karma: +0/-0
OnEnter/OnSpawn
« on: August 07, 2011, 10:28:56 am »


                Ok, so i want the spell (Call Lightning) to Apper/Cast  after the player steps on the "Encounter Trigger" to spawn a monster into the area. But not to deal damage to either the monster or the player.
So to fix it up, the player steps on the area where the trigger is, to there far left and right two huge monsters are spawned and when they enter the area thats when i want "Call Lightning" to be Cast/Appear near the area with the monster.
If anyone can help. it would be great.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
OnEnter/OnSpawn
« Reply #1 on: August 07, 2011, 10:59:58 am »


               You do not want to cast the spell, you just want to use the visual effect.

   effect eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_M);
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
OnEnter/OnSpawn
« Reply #2 on: August 07, 2011, 11:39:16 am »


               void main()
{
   object oPC = GetEnteringObject();
   location lSpawn1 = GetLocation(GetWaypointByTag("your_wp_tag1"));
   location lSpawn2 = GetLocation(GetWaypointByTag("your_wp_tag2"));

   if (!GetIsPC(oPC))
       return;

   object oSpawn1 = CreateObject(OBJECT_TYPE_CREATURE, "your_creature_resref", lSpawn1);
   object oSpawn2 = CreateObject(OBJECT_TYPE_CREATURE, "your_creature_resref", lSpawn2);

   /*
       Try the VFX without the delay first. If the timing is off, then comment out the first two lines and uncomment
       the two lines with the Delay. You'll have to adjust the delay timer to suit the effect you are trying to achieve.
   */
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_LIGHTNING_M), oSpawn1);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_LIGHTNING_M), oSpawn2);
   //DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_LIGHTNING_M), oSpawn1));
   //DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_LIGHTNING_M), oSpawn2));
}
               
               

               
            

Legacy_Omega27

  • Sr. Member
  • ****
  • Posts: 255
  • Karma: +0/-0
OnEnter/OnSpawn
« Reply #3 on: August 07, 2011, 10:21:35 pm »


               To  Lightfoot and Pstemarie, im still a bit new at scripting. So with this do i need to make my own script from scratch? Or is there something i needto edit.I have something similar like this with VFX during a conversation.
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
OnEnter/OnSpawn
« Reply #4 on: August 08, 2011, 12:20:02 am »


               Use the script Pstemarie provided add it to a triggers onenter, ensure that you have 2 waypoints laid out and their tags in the indicated spots, also ensure you have the critter resref in the indicated spots  in the above script and you should be good.
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
OnEnter/OnSpawn
« Reply #5 on: August 08, 2011, 12:47:20 am »


               

Baragg wrote...

Use the script Pstemarie provided add it to a triggers onenter, ensure that you have 2 waypoints laid out and their tags in the indicated spots, also ensure you have the critter resref in the indicated spots in the above script and you should be good.


What Baragg said...
               
               

               
            

Legacy_Omega27

  • Sr. Member
  • ****
  • Posts: 255
  • Karma: +0/-0
OnEnter/OnSpawn
« Reply #6 on: August 08, 2011, 04:51:04 am »


               Thanks for the help guys.