OfficerLawless
Member
I am attempting to Modify the Explosion FX. My intention is to create a Shrinking Ring where players outside of the ring will take 10 damage per 1 second
The Idea is to work similarly to the Storm in Fortnight)
After seeing the [explosion FX 900 1 1 1 Essentialy 1 Row of fire making a big cicle closing in on itself i realized modifying this script to my needs would probably be the best way to accomplish this. For now i'm working on slowing the animation down dramatically.
What i would like to do is Have the circle shrink by 10 Tiles every 1 minute. During that 1 Minute the animation should Loop in place until closing another 10 tiles and again looping animation in place for 1 full minute... this process should repeat until the circle has closed on itself ( or expanded to max as im only essentually running the animation in reverse)
I have added a Timer to the script that will handle the animation of the explosion. The timer starts with a range of 5 tiles and expands the range by 10 tiles each time it loops. After each loop, it will use the Thread.Sleep(TimeSpan.FromMinutes(1)) method to pause the animation for 1 minute before starting the next loop. The animation will be visible for 1 minute but it will not be continuously expanding during that time. And it will continue this pattern until the range has reached the max range set.
This doent seem to do the trick. The animations Still run in its normal pattern without pausing taking only about 1 minute to complete. The overall goal is to have the animation run for roughly 15 minutes until complete
Below is The part that ive modified..... Any Input or ideas for another method to accomplish this would be helpful please.
The Idea is to work similarly to the Storm in Fortnight)
After seeing the [explosion FX 900 1 1 1 Essentialy 1 Row of fire making a big cicle closing in on itself i realized modifying this script to my needs would probably be the best way to accomplish this. For now i'm working on slowing the animation down dramatically.
What i would like to do is Have the circle shrink by 10 Tiles every 1 minute. During that 1 Minute the animation should Loop in place until closing another 10 tiles and again looping animation in place for 1 full minute... this process should repeat until the circle has closed on itself ( or expanded to max as im only essentually running the animation in reverse)
I have added a Timer to the script that will handle the animation of the explosion. The timer starts with a range of 5 tiles and expands the range by 10 tiles each time it loops. After each loop, it will use the Thread.Sleep(TimeSpan.FromMinutes(1)) method to pause the animation for 1 minute before starting the next loop. The animation will be visible for 1 minute but it will not be continuously expanding during that time. And it will continue this pattern until the range has reached the max range set.
This doent seem to do the trick. The animations Still run in its normal pattern without pausing taking only about 1 minute to complete. The overall goal is to have the animation run for roughly 15 minutes until complete
Below is The part that ive modified..... Any Input or ideas for another method to accomplish this would be helpful please.
Code:
using System;
using System.Collections.Generic;
using Server;
using Server.Commands;
using VitaNex.Network;
#endregion
using System;
using System.Threading;
using System.Timers;
using Server;
using Server.Commands;
using VitaNex.Network;
namespace VitaNex.FX
{
public enum ExplodeFX
{
None = 0,
Random,
Smoke,
Water,
Fire,
Earth,
Air,
Energy,
Poison
}
public static class ExplodeEffects
{
public static void Initialize()
{
CommandSystem.Register(
"ExplodeFXHide",
AccessLevel.GameMaster,
ce =>
{
if (ce == null || ce.Mobile == null)
{
return;
}
var m = ce.Mobile;
if (m.Hidden)
{
m.Hidden = false;
CommandSystem.Entries["ExplodeFX"].Handler(ce);
}
else
{
CommandSystem.Entries["ExplodeFX"].Handler(ce);
m.Hidden = true;
}
});
CommandSystem.Register(
"ExplodeFX",
AccessLevel.GameMaster,
ce =>
{
if (ce == null || ce.Mobile == null)
{
return;
}
var m = ce.Mobile;
ExplodeFX effect;
int range, speed, repeat, reverse, maxRange;
if (ce.Arguments.Length < 1 || !Enum.TryParse(ce.Arguments[0], true, out effect))
{
effect = ExplodeFX.None;
}
if (ce.Arguments.Length < 2 || !Int32.TryParse(ce.Arguments[1], out range))
{
range = 5;
}
if (ce.Arguments.Length < 3 || !Int32.TryParse(ce.Arguments[2], out speed))
{
speed = 10;
}
if (ce.Arguments.Length < 4 || !Int32.TryParse(ce.Arguments[3], out repeat))
{
repeat = 0;
}
if (ce.Arguments.Length < 5 || !Int32.TryParse(ce.Arguments[4], out reverse))
{
reverse = 0;
}
if (ce.Arguments.Length < 6 || !Int32.TryParse(ce.Arguments[5], out maxRange))
{
maxRange = 100;
}
range = Math.Max(0, Math.Min(maxRange, range));
speed = Math.Max(1, Math.Min(10, speed));
repeat = Math.Max(0, Math.Min(100, repeat));
reverse = Math.Max(0, Math.Min(1, reverse));
maxRange = Math.Max(range, maxRange);
var timer = new Timer(1000 - ((speed - 1) * 100));
timer.AutoReset = true;
timer.Elapsed += (sender, args) =>
{
var e = effect.CreateInstance(
m.Location,
m.Map,
range,
repeat,
TimeSpan.FromMilliseconds(1000 - ((speed - 1) * 100)));
if (e != null)
{
e.Reversed = (reverse > 0);
e.Send();
}
range += 10;
if (range > maxRange)
{
timer.Stop();
Thread.Sleep(TimeSpan.FromMinutes(1));
range = 5;
timer.Start();
}
};
timer.Start();
});
}
}