Author Topic: Rise an VFX  (Read 375 times)

Legacy_Nebril2

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Rise an VFX
« on: August 21, 2015, 01:03:33 am »


               

Hi all!


 


I made a spell wich shows a VFX many times between the caster and the target asi if were some kind of beam, but the vfx are made at ground level, so its not seen totally.... how can i do for make the vfx a little higher? I assume using vectors but not sure how.


 


 


 


I show my code:


 



 


void main()


{

 

int nEvent =GetUserDefinedItemEventNumber();

if(nEvent !=  X2_ITEM_EVENT_ACTIVATE)return;

 

 

  object oPC = GetItemActivator();

 

  object oT = GetItemActivatedTarget();

  location lT = GetLocation(oT);

  location lPC = GetLocation(oPC);

  vector vPC = GetPosition(oPC);

  vector vT = GetPosition(oT);

  vector vR = vT-vPC;

 

  float  aAng = VectorToAngle(vR);

 

  //Dibujo

  float nDist = GetDistanceBetween(oPC, oT);

  float nPr = nDist/10;

  ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist, aAng), aAng+180.0));

  DelayCommand(0.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist-nPr, aAng+180.0), aAng)));

  DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist-nPr*2, aAng+180.0), aAng)));

  DelayCommand(1.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist-nPr*3, aAng+180.0), aAng)));

  DelayCommand(2.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist-nPr*4, aAng+180.0), aAng)));

  DelayCommand(2.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist-nPr*5, aAng+180.0), aAng)));

  DelayCommand(3.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist-nPr*6, aAng+180.0), aAng)));

  DelayCommand(3.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist-nPr*7, aAng+180.0), aAng)));

  DelayCommand(4.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist-nPr*8, aAng+180.0), aAng)));

  DelayCommand(4.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist-nPr*9,aAng+180.0), aAng)));

  DelayCommand(5.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), Location(GetArea(oT), GetChangedPosition(GetPosition(oT),nDist-nPr*10, aAng+180.0), aAng)));

 

 

 

}


 



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Rise an VFX
« Reply #1 on: August 21, 2015, 09:54:00 am »


               Raise the PC and target locations by (say) 1 metre off the ground before you do anything else:


vPC.z += 1.0;
vT.z += 1.0;

               
               

               
            

Legacy_Nebril2

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Rise an VFX
« Reply #2 on: August 21, 2015, 04:46:13 pm »


               

Yes! thank you, i understand how that does works now. 


 


Looks nice now.