Go Back   RunUO - Ultima Online Emulation > RunUO > Custom Script Release Archive

Custom Script Release Archive This is a pre-script database archive of what our users had released.

 
 
Thread Tools Display Modes
Old 06-21-2006, 05:04 PM   #1 (permalink)
Forum Newbie
 
Join Date: Dec 2005
Location: out of this world
Posts: 13
Send a message via ICQ to Peterson Send a message via MSN to Peterson
Default old attack messages

This is my first script . Just replace this file with your current AttackMessage.cs, what this does is makes it so when someone, or something is being attacked, players within 16 tiles of the player/monster gets a message saying "you see blah attacking blah!" However it only gives this message to players who are not attacking the person or being attacked. the people being attacked, and attacking still get the normal message above the head if they are attacking another player.
Attached Files
File Type: cs AttackMessage.cs (2.1 KB, 48 views)

Last edited by Peterson; 06-26-2006 at 12:45 AM.
Peterson is offline  
Old 06-22-2006, 02:12 AM   #2 (permalink)
Forum Expert
 
Packer898's Avatar
 
Join Date: Dec 2004
Location: Tulsa, Oklahoma
Age: 35
Posts: 2,378
Send a message via ICQ to Packer898 Send a message via MSN to Packer898
Default

I take it this was for version 1.0? It wouldnt compile on 2.0. I changed the arraylist to work with 2.0 and changed the forloop also. The way you had it set it, with !aggressor.Player, it would only display the message if neither aggressor or aggressed was a playermobile. Anyway.

[2.0] RC1 version:
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Network;

namespace Server.Misc
{
	public class AttackMessage
	{
		private const string AggressorFormat = "You are attacking {0}!";
		private const string AggressedFormat = "{0} is attacking you!";
		private const string ViewerFormat = "You see {0} attacking {1}!";
		private const int Hue = 0x22;
		
		private static TimeSpan Delay = TimeSpan.FromMinutes( 1.0 );

		public static void Initialize()
		{
			EventSink.AggressiveAction += new AggressiveActionEventHandler( EventSink_AggressiveAction );
		}

		public static void EventSink_AggressiveAction( AggressiveActionEventArgs e )
		{
			Mobile aggressor = e.Aggressor;
			Mobile aggressed = e.Aggressed;
			
			if ( !CheckAggressions( aggressor, aggressed ) )
			{
				if(aggressed.Player)
					aggressor.LocalOverheadMessage( MessageType.Regular, Hue, true, String.Format( AggressorFormat, aggressed.Name ) );
				if(aggressor.Player)
					aggressed.LocalOverheadMessage( MessageType.Regular, Hue, true, String.Format( AggressedFormat, aggressor.Name ) );
				
				foreach ( Mobile m in aggressor.GetMobilesInRange( 16 ) )
				{
					if( aggressor.Player && aggressed.Player )
						m.SendMessage(String.Format("You see {0} attacking {1}!", aggressor.Name, aggressed.Name));
				}
			}
		}

		public static bool CheckAggressions( Mobile m1, Mobile m2 )
		{
			List<AggressorInfo> list = m1.Aggressors;

			for ( int i = 0; i < list.Count; ++i )
			{
				AggressorInfo info = (AggressorInfo)list[i];

				if ( info.Attacker == m2 && DateTime.Now < (info.LastCombatTime + Delay) )
					return true;
			}

			list = m2.Aggressors;

			for ( int i = 0; i < list.Count; ++i )
			{
				AggressorInfo info = (AggressorInfo)list[i];

				if ( info.Attacker == m1 && DateTime.Now < (info.LastCombatTime + Delay) )
					return true;
			}
			return false;
		}
	}
}
__________________
"We sometimes congratulate ourselves at the moment of waking from a troubled dream; it may be so the moment after death."

~Nathaniel Hawthorne
Packer898 is offline  
Old 06-26-2006, 12:46 AM   #3 (permalink)
Forum Newbie
 
Join Date: Dec 2005
Location: out of this world
Posts: 13
Send a message via ICQ to Peterson Send a message via MSN to Peterson
Default fix

alright. Now it works when monsters and people attack eachother ^^
Peterson is offline  
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5