Vita-Nex: Core

Support => General Support => Topic started by: Sorthious on March 21, 2015, 06:04:40 PM

Title: Effects Help
Post by: Sorthious on March 21, 2015, 06:04:40 PM
I'm new to programming, C#, and scripting.  I learn fairly fast, however, I need help using the effects in script.  Could someone post a simple script of how to call an effect in a script?  Something similar to this but using VitaNex effects:

Code: [Select]
 Effects.SendLocationEffect(m.Location, m.Map, 0x3709, 28, 10, 0x1D3, 5);

I've been searching for examples of how to do the effects but haven't found any....If someone could refer me to examples or post a simple example of the syntax that would be very helpful....Thanks in advance!
Title: Re: Effects Help
Post by: Vorspire on March 21, 2015, 10:23:04 PM
Depending on what you want to do, there is multiple options available, all require this reference:
Code: [Select]
using VitaNex.FX;
and if EffectRender is required:
Code: [Select]
using VitaNex.Network;

To answer your question directly;
Code: [Select]
new EffectInfo( m.Location, m.Map, 0x3709, 0x1D3, 28, 10, EffectRender.SemiTransparent ).Send();

There are pre-defined wave and explosion effects that you can use, which you may have seen in a video or two, or used with the [ExplodeFX and [WaveFX commands; These effects are very easy to write:
Code: [Select]
var effect = new FireExplodeEffect( loc, map, range );

effect.Send();

These are very basic examples, there are many more combinations of arguments and properties to be used, Visual Studio's Intellisense should help you discover these.
Title: Re: Effects Help
Post by: Sorthious on March 21, 2015, 10:56:33 PM
You are awesome Vorspire....I really appreciate you taking the time to answer my trivial question.  I am mainly just looking to do things such as adding effects to existing mobiles, items,etc., and possibly enhancing current effects for spells.  This gives me a nice starting point to learn how to script this.  Thank you very much!
Title: Re: Effects Help
Post by: Sorthious on March 21, 2015, 11:14:45 PM
Have VS 2013 Community now...very helpful...was just looking for a starting point....It opens up many options for me!  8)
Title: Re: Effects Help
Post by: Abracadabra2.0 on December 12, 2016, 10:43:55 PM
What if I wanted a monster to use one of these visual effects in conjunction with a damage effect. Take Sand Vortex, for example. Its using m.FixedParticles( 0x36B0, 10, 25, 9540, 2413, 0, EffectLayer.Waist ); for the visual.
Title: Re: Effects Help
Post by: Vorspire on January 15, 2017, 06:47:33 PM
What if I wanted a monster to use one of these visual effects in conjunction with a damage effect. Take Sand Vortex, for example. Its using m.FixedParticles( 0x36B0, 10, 25, 9540, 2413, 0, EffectLayer.Waist ); for the visual.

You can construct an EffectInfo object for this purpose, but they use the same methods in the Server.Effects class. The convenience of EffectInfo is that you can re-use it multiple times by calling Send() successively.

When it comes to using the explosion effects for dealing damage, it is recommended to provide an effect handler method to be called on each effect in the explosion's queue.

Code: [Select]
var fx = new FireExplodeEffect(target, target.Map, ExplosionRange)
{
EffectHandler = e =>
{
// Don't repeat damage for multiple effects on the same tile
if (e.ProcessIndex != 0)
{
ExplosionDamage(e);
}
}
};

fx.Send();
Code: [Select]
public virtual void ExplosionDamage(EffectInfo info)
{
Effects.PlaySound(info.Source.Location, info.Map, ImpactSound);

foreach (var m in
info.Source.Location.GetMobilesInRange(info.Map, 0)
.Where(m => m != null && !m.Deleted && User.CanBeHarmful(m, false, true)))
{
m.Damage(Utility.RandomMinMax(DamageMin, DamageMax), User, true);
}
}

This code can be found in the ThrowableBomb code in Vita-Nex.