RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

UOSA Packet 0x70 to make Flash Effect

Andreew

Wanderer
UOSA Packet 0x70 to make Flash Effect

I found a SA packet responsible for screen flash effect. Please include this nice feature to RunUO svn :) Also to EffectController.

PHP:
public enum FlashType : byte
{
 FadeOut,
 FadeIn,
 LightFlash,
 FadeInOut,
 BlackFlash
}

public sealed class FlashEffect : Packet
{

 public FlashEffect( FlashType flashType ) : base( 0x70, 28 )
 {
  m_Stream.Write( ( byte)4 );//effectType
  m_Stream.Write( ( int )0 );//fromSerial
  m_Stream.Write( ( int )0 );//toSerial
  m_Stream.Write( ( ushort )flashType );//in regular 0x70 ItemID is here
  m_Stream.Fill( 16 );

 /* all this properties below are not used in Flash
 m_Stream.Write( ( short )0 );//fromX
 m_Stream.Write( ( short )0 );//fromY
 m_Stream.Write( ( sbyte )0 );//fromZ
 m_Stream.Write( ( short )0 );//toX
 m_Stream.Write( ( short )0 );//toY
 m_Stream.Write( ( sbyte )0 );//toZ
 m_Stream.Write( ( byte )0 );//speed
 m_Stream.Write( ( byte )0 );//duration
 m_Stream.Write( ( short )0 );
 m_Stream.Write( ( bool )0 );//fixeddirection
 m_Stream.Write( ( bool )0 );//explodes
 */
 }
}
 

Pure Insanity

Sorceror
I see, thanks for the video. It's a pretty neat effect, would be something good to add with a lightening bolt. Would just give a better over-all effect. Would be neat to be able to use this, perhaps someone will take the info and incorporate it into RunUO.
 

Jeff

Lord
Looks like that is the Enhanced client, can you confirm this flash happens on the standard client? Chances are it does not, and RunUO only supports the standard client.
 

Andreew

Wanderer
EC on this video? No! 0x70, also known as 'Graphical Effect' works for both clients. I checked it empirically. OSI use it for all types effects (also regular types 0x00 - 0x03 - moving, location etc) where hue doesn't matter, because data sent via this packet doesn't support it.
 

Peoharen

Sorceror
Missed this before. Excellent work Andreew.

Have a block of cleaned code.
Code:
public enum FlashType : byte
{
    FadeOut,
    FadeIn,
    LightFlash,
    FadeInOut,
    BlackFlash
}

public sealed class FlashEffect : Packet
{
    public FlashEffect( FlashType flashType ) : base( 0x70, 28 )
    {
        m_Stream.Write( (byte) 4 ); //effectType
        m_Stream.Write( (int) 0 ); //fromSerial
        m_Stream.Write( (int) 0 ); //toSerial
        m_Stream.Write( (ushort) flashType ); //in regular 0x70 ItemID is here
        
        m_Stream.Fill( 16 );

        /* all this properties below are not used in Flash
        m_Stream.Write( ( short )0 );//fromX
        m_Stream.Write( ( short )0 );//fromY
        m_Stream.Write( ( sbyte )0 );//fromZ
        m_Stream.Write( ( short )0 );//toX
        m_Stream.Write( ( short )0 );//toY
        m_Stream.Write( ( sbyte )0 );//toZ
        m_Stream.Write( ( byte )0 );//speed 
        m_Stream.Write( ( byte )0 );//duration
        m_Stream.Write( ( short )0 );
        m_Stream.Write( ( bool )0 );//fixeddirection
        m_Stream.Write( ( bool )0 );//explodes
        */
    }
}
 

fwiffo

Sorceror
This works even with client 6.0.5.0 - 2D of course. (Tested!)

Proof of concept code (A quick quirk just to test):

Code:
using System;
using Server;
using Server.Mobiles;
using Server.Items;
using Server.Network;
using Server.Engines.Craft;
 
namespace Server.Items
{
    public class FlashGlobe : Item
    {
        private FlashType m_Type;
     
        [CommandProperty(AccessLevel.GameMaster)]
        public FlashType Type{get{return m_Type;} set{m_Type=value;}}
     
        [Constructable]
        public FlashGlobe() : this(1)
        {
        }
     
        [Constructable]
        public FlashGlobe(int flashtype_1_to_5) : base( 0x1047 )
        {
            base.Weight = 0.5;
            LootType = LootType.Newbied;
            Movable=false;
            if(flashtype_1_to_5 <= 5 && flashtype_1_to_5 > 0)
            {
            switch (flashtype_1_to_5)
            {
                case 1: m_Type=FlashType.BlackFlash; Name = "Black Flash"; Hue = 0x3; break;
                case 2: m_Type=FlashType.FadeIn; Name = "Fade In"; Hue = 0x35; break;
                case 3: m_Type=FlashType.FadeInOut; Name = "Fade InOut"; Hue = 0x40; break;
                case 4: m_Type=FlashType.FadeOut; Name = "Fade Out"; Hue = 0x22; break;
                case 5: m_Type=FlashType.LightFlash; Name = "LightFlash"; Hue = 0x80E; break;
            }
            }
            else m_Type=FlashType.BlackFlash;
        }
 
        public FlashGlobe( Serial serial ) : base( serial )
        {
            base.Weight = 0.5;
            LootType = LootType.Newbied;
            Name = "Globo di Meditazione";
            switch (m_Type)
            {
                case FlashType.BlackFlash: Hue = 0x3; break;
                case FlashType.FadeIn: Hue = 0x35; break;
                case FlashType.FadeInOut: Hue = 0x40; break;
                case FlashType.FadeOut: Hue = 0x22; break;
                case FlashType.LightFlash: Hue = 0x80E; break;
            }
        }
 
        public override void OnDoubleClick( Mobile from )
        {
            if( from.Player && from.NetState != null )
            {
                FlashEffect flash = new FlashEffect(m_Type);
                from.NetState.Send(flash);
            }
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
            writer.Write( (int)m_Type );
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
            m_Type=(FlashType)reader.ReadInt();
        }
    }
}
 

WarUO

Sorceror
Not sure if it really matters, but the first time I saw this on OSI was when Mag got invaded. The light demons did that exact attack only with white flames. They also used the screen flash when destroying building.
 

Corpsecrank

Sorceror
Yeah the whole blackrock event where mag was destroyed was the point where they introduced a lot of this. The blockrock machine had this effect it flashed and faded and did things throughout the event. I was still playing at that time. It was also used to mask changes taking place with objects. The machine would change during the flash and you would not see the changes because the flash went off. It made for a nice illusion to deal with the limits of such an old game. You really got to hand it to some of the guys who came up with a lot of the event stuff from that period forward. A lot of abstract thinking went into designing that stuff and trying to reproduce some of the effects they came up with is not easy. I had been working on just that before I left UO about 2 years ago.
 

Acronis

Sorceror
Awesome! I saw a video of one of the newer dragons and it does a flash effect, guessing this is the packet to do it with! Thanks for sharing.
 

Vorspire

Knight
[syntax]
public enum ScreenEffectType
{
FadeOut = 0x00,
FadeIn = 0x01,
LightFlash = 0x02,
FadeInOut = 0x03,
DarkFlash = 0x04
}

public class ScreenEffect : Packet
{
public ScreenEffect(ScreenEffectType type)
: base(0x70, 28)
{
m_Stream.Write((byte)0x04);
m_Stream.Fill(8);
m_Stream.Write((short)type);
m_Stream.Fill(16);
}
}

public sealed class ScreenFadeOut : ScreenEffect
{
public ScreenFadeOut()
: base(ScreenEffectType.FadeOut)
{ }
}

public sealed class ScreenFadeIn : ScreenEffect
{
public ScreenFadeIn()
: base(ScreenEffectType.FadeIn)
{ }
}

public sealed class ScreenFadeInOut : ScreenEffect
{
public ScreenFadeInOut()
: base(ScreenEffectType.FadeInOut)
{ }
}

public sealed class ScreenLightFlash : ScreenEffect
{
public ScreenLightFlash()
: base(ScreenEffectType.LightFlash)
{ }
}

public sealed class ScreenDarkFlash : ScreenEffect
{
public ScreenDarkFlash()
: base(ScreenEffectType.DarkFlash)
{ }
}
[/syntax]
 

ASayre

RunUO Developer
Added the above to Packets.cs with some small tweaks. This was not added to EffectController as EffectController displays things that are visible to all people around, depending on the configuration, while ScreenEffect is for the viewer only.
 
I know this is late to post here, but isn't there a board in Doom that when double-clicked your screen flashes white and you get a message about a Void or something? At least that's what it was on OSI.
 
Top