Castiel

Member
Looking for help modifying login broadcast script to add death cries. Been running it with death cries in, but we wanted to add what the player was killed by. After adding the section adding to the string what hte player was killed by, we had a server crash. Player was killed by acid trap on the ground, object not set to instance of an object. It seems like it didnt know what to do because they werent killed by a mobile but not sure on that. this is the section we added to broadcast deaths

Code:
public static void EventSink_PlayerDeath(PlayerDeathEventArgs e)
        {
            if (e.Mobile.Player)
            {
                if (e.Mobile.AccessLevel == AccessLevel.Player)
                    CommandHandlers.BroadcastMessage(AccessLevel.Player, m_DeathHue, String.Format(m_DeathMessage, e.Mobile.Name));
                {
                    if (e.Mobile.LastKiller.IsPlayer())
                    {
                        CommandHandlers.BroadcastMessage(AccessLevel.Player, m_DeathHue, String.Format("{0} was killed by {1}!", e.Mobile.RawName, e.Mobile.LastKiller.RawName));
                    }
                    else if (!e.Mobile.LastKiller.IsPlayer())
                    {
                        CommandHandlers.BroadcastMessage(AccessLevel.Player, m_DeathHue, String.Format("{0} was killed by {1}!", e.Mobile.RawName, e.Mobile.LastKiller.RawName));
                    }
                }
            }
        }


any help is greatly appreciated :D
 
Looking for help modifying login broadcast script to add death cries. Been running it with death cries in, but we wanted to add what the player was killed by. After adding the section adding to the string what hte player was killed by, we had a server crash. Player was killed by acid trap on the ground, object not set to instance of an object. It seems like it didnt know what to do because they werent killed by a mobile but not sure on that. this is the section we added to broadcast deaths

Code:
public static void EventSink_PlayerDeath(PlayerDeathEventArgs e)
        {
            if (e.Mobile.Player)
            {
                if (e.Mobile.AccessLevel == AccessLevel.Player)
                    CommandHandlers.BroadcastMessage(AccessLevel.Player, m_DeathHue, String.Format(m_DeathMessage, e.Mobile.Name));
                {
                    if (e.Mobile.LastKiller.IsPlayer())
                    {
                        CommandHandlers.BroadcastMessage(AccessLevel.Player, m_DeathHue, String.Format("{0} was killed by {1}!", e.Mobile.RawName, e.Mobile.LastKiller.RawName));
                    }
                    else if (!e.Mobile.LastKiller.IsPlayer())
                    {
                        CommandHandlers.BroadcastMessage(AccessLevel.Player, m_DeathHue, String.Format("{0} was killed by {1}!", e.Mobile.RawName, e.Mobile.LastKiller.RawName));
                    }
                }
            }
        }


any help is greatly appreciated :D
[doublepost=1547687036][/doublepost]Here is a script i use for my server you should be able to add ({0} was killed by) in one of the cases. hope this helps.
 

Attachments

  • AnnounceDeath.cs
    1.4 KB · Views: 20
ok got the broadcast to change to red so it can be seen now
next I would like for it to tell what mob or boss killed the player any ideas or directions to go in for that

World.Broadcast(0x44B9, true, "{0} Has Died In Style Yet Again By a bossname/or mobname .", args.Mobile.Name);
 

Attachments

  • [ServUO.com]-AnnounceDeath.cs
    1.5 KB · Views: 16
not sure is this is even right . i have not tested but i think it is simply just.....

World.Broadcast(0x44B9, true, "{0} Has Died In Style Yet Again By a {1} .", args.Mobile.Name);

{1} being the mob or player that has killed the player. like i said i have not tested.

I am just a novice scripter. so Hopefully someone that knows more then me will post to this
thread.
 
Last edited:
tried that it crashes
JustUO Version 1.0, Build 2.0
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Framework: 4.0.30319.42000
Time: 1/22/2019 12:30:07 PM
Mobiles: 10371
Items: 385013
Exception:
System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(String format, Object[] args)
at Server.AnnounceDeath.OnDeath(PlayerDeathEventArgs args)
at Server.PlayerDeathEventHandler.Invoke(PlayerDeathEventArgs e)
at Server.EventSink.InvokePlayerDeath(PlayerDeathEventArgs e)
at Server.Mobile.OnDeath(Container c)
at Server.Mobiles.PlayerMobile.OnDeath(Container c)
at Server.Mobile.Kill()
at Server.Mobile.Damage(Int32 amount, Mobile from, Boolean informMount)
at Server.Mobiles.PlayerMobile.Damage(Int32 amount, Mobile from)
at Server.AOS.Damage(Mobile m, Mobile from, Int32 damage, Boolean ignoreArmor, Int32 phys, Int32 fire, Int32 cold, Int32 pois, Int32 nrgy, Int32 chaos, Int32 direct, Boolean keepAlive, Boolean archer, Boolean deathStrike)
at Server.Items.BaseWeapon.OnHit(Mobile attacker, Mobile defender, Double damageBonus)
at Server.Items.BaseWeapon.OnSwing(Mobile attacker, Mobile defender, Double damageBonus)
at Server.Items.Fists.OnSwing(Mobile attacker, Mobile defender)
at Server.Mobile.CombatTimer.OnTick()
at Server.Timer.Slice()
at Server.Core.Main(String[] args)
 
If you figure that out let me know we were trying to do the same.

I tried this script kevin, it works great but still won't work for what we want it for.
The problem is anytime its NOT a mobile it crashes. IE : traps. stepping in acid, etc etc... causes a crash.
 
messing with a couple of scripts to try and get this working for mobs this is UNTESTED as of now ,, I put comments on what I did Hopefuly We can all figure this out lol (We are On JustUO but the serveuo AnnounceDeath.cs dropped in no problems)
[doublepost=1548466072][/doublepost]down to this error now and Im stuck if anybody has ideas or can fix this and clean it up a little or help Me fix it that would be awesome added the file and it has ///comments in as to what We have done getting this to work ,, and it should be a not to hard of a step to include what Asteria is wanting
ERROR
CS0501: Line 28: 'Server.AnnounceDeath1.OnDeath(Server.PlayerDeathEventArgs)' must declare a body because it is not marked abstract, extern, or partial
 

Attachments

  • MobKilledPlayerv1.4.cs
    2.7 KB · Views: 12
Last edited:
This is my take on it which I'm using now on my server. It differentiates between a murder, killed by a mob, owner of a controlled pet, suicide or killed by your own pet or if there is no killer like it was a dungeon chest or something then "killed in a freak accident".
 

Attachments

  • AnnounceDeath.cs
    1.1 KB · Views: 56

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back