The screen shake effect in CO is fucking ridiculously annoying because the client doesn't center the screen after the effect is over >_____>
public class RainSupplier : WeatherSupplier
{
public RainSupplier(GameMap map)
: base(map, 3) // max 3 per quadrant
{
WeatherSpeed = 10000;
BlendFactor = 0.5;
ModifyColor = Color.Gray;
WeatherColor = Color.Cyan;
Direction = 165;
Intensity = 1000;
Type = WeatherType.Rain;
}
protected override void BeginProcess(GameMapArea q, DateTime time)
{
base.BeginProcess(q, time);
// create our effects
int amount = r.Next(1, EffectAmount);
for (int i = 0; i <= amount; i++)
{
int x = q.X + r.Next(0, GameMap.QuadrantSize);
int y = q.Y + r.Next(0, GameMap.QuadrantSize);
SetEffect(i, 1000, 0, x, y);
}
}
protected override void RenderEffects(IEntity entity, DateTime time, int index)
{
base.RenderEffects(entity, time, index);
var strikePos = GetEffectPosition(index);
// to-do: did this entity get hit by the lightning?
}
}
I thought it was only the 'bounce' effect that messed with the screen? o.OQuote:
well i just finished abstracting pcs's weather system (yes, I'm doing minor work with them) got permission from ffc that it's ok to post this code:
so as fang said, the over all idea is super easy lol, just combining a few packets at best; and yeah I haven't found a way to recenter the screen after shaking it either.Code:public class RainSupplier : WeatherSupplier { public RainSupplier(GameMap map) : base(map, 3) // max 3 per quadrant { WeatherSpeed = 10000; BlendFactor = 0.5; ModifyColor = Color.Gray; WeatherColor = Color.Cyan; Direction = 165; Intensity = 1000; Type = WeatherType.Rain; } protected override void BeginProcess(GameMapArea q, DateTime time) { base.BeginProcess(q, time); // create our effects int amount = r.Next(1, EffectAmount); for (int i = 0; i <= amount; i++) { int x = q.X + r.Next(0, GameMap.QuadrantSize); int y = q.Y + r.Next(0, GameMap.QuadrantSize); SetEffect(i, 1000, 0, x, y); } } protected override void RenderEffects(IEntity entity, DateTime time, int index) { base.RenderEffects(entity, time, index); var strikePos = GetEffectPosition(index); // to-do: did this entity get hit by the lightning? } }
if (client.Entity.MapID == 1505)
{
Weather weather = new Weather(true);
weather.WeatherType = Weather.Rain;
weather.Direction = 165;
weather.Intensity = 1000;
weather.Send(client);
}
if (client.Entity.MapID == 1505)
{
_String str = new _String(true);
str.UID = client.Entity.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("Thunder");
client.SendScreen(str, true);
System.Threading.Thread.Sleep(5000);
}
Cast it as an actual spell :O (Since you will be adding damage I presume.Quote:
i have made a exmaple here but i am sure its horible,
idk how to make the thunder effect hit random so i made it this for for testing.
and its was prty fun butCode:if (client.Entity.MapID == 1505) { Weather weather = new Weather(true); weather.WeatherType = Weather.Rain; weather.Direction = 165; weather.Intensity = 1000; weather.Send(client); } if (client.Entity.MapID == 1505) { _String str = new _String(true); str.UID = client.Entity.UID; str.TextsCount = 1; str.Type = _String.Effect; str.Texts.Add("Thunder"); client.SendScreen(str, true); System.Threading.Thread.Sleep(5000); }
just need to fix sending the thunder in different place since the code i used it hitting on you only
Quote:
...
A/B/C are all covered in my posted code... uh?Quote:
I think the issue there is that if you code it as part of the actual weather system there is
A: No way to check where a bolt hits (so nothing dynamic can be done such as hitting specific objects)
B: No way to check WHEN a bolt hits (for sounds)
C: Pretty sure it won't look right (all weather effects blow accross screen rather than a static animation). Could be that you could edit it to work for your needs but it will never look as good or be as useful as casting a spell at random location.
If you don't like the 0 then there are ways to display an effect at X/Y. None of them will look as good but it CAN be done.
Casting spell at X/Y is ideal because it handles the following automatically.
-Proper animation at known location
-Proper sound on activation
-Damage calculations and targeting in small AOE around hit location
You can edit the spell to look/sound however you want (larger spell, ground breaking apart effect, new sounds, etc) but the method they are demonstrating is likely the most effective in the game.
Shaking is likely possible but gets a bit more tricky to do properly is all.
I'm referring to him wanting his lightening to be a custom weather effect rather than spell casts....Quote:
A/B/C are all covered in my posted code... uh?
The 0 can be removed, we're working on it :)
protected override void BeginProcess(GameMapArea q, DateTime time)
{
base.BeginProcess(q, time);
// create our effects
int amount = r.Next(1, EffectAmount);
for (int i = 0; i <= amount; i++)
{
int x = q.X + r.Next(0, GameMap.QuadrantSize);
int y = q.Y + r.Next(0, GameMap.QuadrantSize);
SetEffect(i, 1000, 0, x, y);
}
}
gotcha, yah what i think is better if i make the storm hit the player like you say by using targetUIDQuote:
If the spell is hitting your location then you are using targetUID rather than sending spell with a X/Y value instead.
The code you quoted is taking the entire quadrant of a map and generating a random location within it. It then sends that spell to all clients within visible range of that random location.