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!

[RunUO 2.0 RC1] On-site Dueling System 2.0

Jeff

Lord
On-site Dueling System 2.0

Well the wait is finally over! I finally got some time over the last week to sit down and write out the 2.0 version of my On-site system. With this version I was able to sit down and really take a look at al lthe things i did wrong, all the exploits i saw with the previous version, and all the things i wanted the first version to do but never was able to get around to putting in.

If you have any other scripts that handle Notoreity, you WILL need to combine the two handlers in the scripts into one, if you dont know how to do this, let me know and I will try to help you. Some scripts that I know of that do this are, Milts Auto Tourney system and snicker77s Dueling for Pinks system.

Update 2.04
-Added new procedure that checks for deleted characters in the scoreboard when saving, This should fix a crash bug wit hthe scoreboard when players delete their characters.
-Fixed a bug that didnt allow you to not accept duels.

Update 2.04
-Fixed crash bug that occured when checking if a mobile was in a duel.

Update 2.03
-Fixed crash bug with the points system.

Update 2.02
-Fixed a compile error

Update 2.01
-Added newest global properties to save. I added 3 properties last second and forgot to serialize them.
-Removed debug console.writelines.

Features
-Ability to duel a player, or a team of players(up to 5 vs 5) on the spot.
-All players outside of the duel are invulnerable and vise versa, as long as the duel is in a guarded region.
-The exception to the invulnerability is with monsters. Monsters will still flag grey red or blue and they will still attack you if you are in a duel. This prevents exploit.
-Control system allows for global On-site variables to be changed on the fly and in-game.
-When a duel is started the creator will be allowed to pick from a 1vs1 duel to a 5vs5 duel. Then once all players accept to join the Creator will be able to choose who will be on who's team, then start the duel.
-Players that die in a duel greater then 1vs1 will stay dead. This allows the team time to be able to res their teammate to once again even the odds.
-No one will be able to loot a corpse of a player that is in a duel.
-All items on a players corpse will be returned to the player at the end of the duel.
-The points system is completely seperate from the world save so if things were to happen and it needed to be reset, a simple delete of the save file and ur set.
-I've included a Top 10 Scoreboard that tracks and sorts the top 10 players for each #vs# of duels.
-Players may use [DuelInfo and target a player to see their statistics at anytime.
-The tracked statistics are tracked for each #vs# and are as follows: Wins, Loses, Quickest Duel Win, Quickest Duel Loss, Longest Duel Win and Longest Duel Loss.
-The entire thing is "nearly" drop in and use. I tried as best as i could to make this 100% distro mod free, the problem is the only thing i couldnt do that with was the corpse handling, so sorry in advance that you will have to edit 2 lines in Corpse.cs :)

Installation
-Download, unrar it somewhere in your scripts directory.
-Open Corpse.cs, its located in Scripts\Items\Misc\Corpse
-Find this code somewhere around Line 872
Code:
		public override void OnDoubleClick( Mobile from )
		{
			Open( from, Core.AOS );
		}
-Replace it with this code
Code:
		public override void OnDoubleClick( Mobile from )
		{
                    if( Server.Dueling.DuelController.IsInDuel( m_Owner ) && m_Owner != from )
                    {
                        from.SendMessage( "This person is currently in a duel, you may not loot them" );
                        return;
                    }

			Open( from, Core.AOS );
		}
-Start your server and your all set.


Usage
-As Administrator you can enable disable the system and change some global settings with [OnsiteConfig shown here

A. DuelLengthInSeconds = Length of a duel to timeout and end.
B. Enabled = Enable/Disable the entire system.
C. MaxDistance is the number of tiles the any player in the duel can have between any other player in the same duel before the duel terminates.
D. DuelSetupTimeoutSeconds = Time in which a duel needs to be setup and started before it is canceled by the system.
E. DuelAcceptTimeoutSecond = Time a player has to accept the duel invite before it will cancel.
F. DuelLogoutTimeoutSeconds = Time a player has to reconnect after getting disconnected or logging before they lose the duel.
-To duel someone simply say [Duel and you will recieve these options.

A. Once the duel type is selected, the Creator will recieve a targeting cursor to target every player they want in the duel. Each player targeted will recieve a gump to join or not join the duel like this.

B. Once all the asked members have joined the duel, the Creator will recieve a gump to set which player is on which team. Like this:

C: Once this is done, the duel will begin in 10 seconds and will not end until all of the members of one team are dead.
-Stalemates: to avoid stalemates, if the end of the match ends in a draw or times out, and the count of dead players on each team is the same or no one is dead, The system will total up the health points of all players and figure out who has the most health and declare them the winner. If the health points are the same, it will be a stalemate and no one will recieve points for the duel.
-The scoreboard may be placed anywhere with "[add scoreboard" and to use it simply double click it.
It looks something like this:

-Players can use [duelinfo on another player to pull up a gump that contains all the information about a players dueling stats. Looks like this:


Disclamer
These systems have not been tested in entirety. They are still in a testing phase and I do not recommend placing them on a public server as of yet. If you choose otherwise, it will be at your own risk.

Enjoy,
Jeff
 

Attachments

  • Onsite Duel System.rar
    16 KB · Views: 1,040
I agree the gumps are very well done and I am so looking forward to seeing this in use. I did have a error at start up:

+ customs/On-site Dueling 2.0/On-site Dueling 2.0/Gumps/DuelScoreBoardGump.cs:
CS0168: Line 93: The variable 'wins' is declared but never used
CS0168: Line 94: The variable 'loses' is declared but never used
CS0168: Line 95: The variable 'quickest' is declared but never used
CS0168: Line 96: The variable 'longest' is declared but never used
CS0168: Line 97: The variable 'totalwins' is declared but never used
CS0168: Line 98: The variable 'totalloses' is declared but never used
+ customs/On-site Dueling 2.0/On-site Dueling 2.0/ScoreKeeping/DuelPoints.cs:
CS0162: Line 94: Unreachable code detected
Errors:
+ customs/On-site Dueling 2.0/On-site Dueling 2.0/ScoreKeeping/DuelPoints.cs:
CS0161: Line 90: 'Server.OnsiteDueling.DuelPoints.GetLongestWinTime(int)': n
ot all code paths return a value
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
[/CODE]
 

slithers

Sorceror
Code:
RunUO - [www.runuo.com] Version 2.0, Build 2395.25560
Core: Running on .NET Framework Version 2.0.50727
Core: Running with arguments: -debug
Scripts: Compiling C# scripts...failed (1 errors, 6 warnings)
Warnings:
 + Custom/Levelable Items/Gumps/LevelUpAcceptGump.cs:
    CS0162: Line 23: Unreachable code detected
    CS0162: Line 70: Unreachable code detected
 + Custom/Mail System/Mail System/MailSystem/LetterGump.cs:
    CS0219: Line 33: The variable 'initialState' is assigned but its value is ne
ver used
 + Custom/Mail System/Mail System/MailSystem/WriteLetterGump.cs:
    CS0219: Line 28: The variable 'initialState' is assigned but its value is ne
ver used
 + Custom/Mail System/Mail System/AddressBookGUMP.cs:
    CS0162: Line 163: Unreachable code detected
 + Custom/On-site Dueling 2.0/Gumps/DuelScoreBoardGump.cs:
    CS0168: Line 93: The variable 'wins' is declared but never used
    CS0168: Line 94: The variable 'loses' is declared but never used
    CS0168: Line 95: The variable 'quickest' is declared but never used
    CS0168: Line 96: The variable 'longest' is declared but never used
    CS0168: Line 97: The variable 'totalwins' is declared but never used
    CS0168: Line 98: The variable 'totalloses' is declared but never used
 + Custom/On-site Dueling 2.0/ScoreKeeping/DuelPoints.cs:
    CS0162: Line 94: Unreachable code detected
Errors:
 + Custom/On-site Dueling 2.0/ScoreKeeping/DuelPoints.cs:
    CS0161: Line 90: 'Server.OnsiteDueling.DuelPoints.GetLongestWinTime(int)': n
ot all code paths return a value
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

rev 66 build if it matters
 

Crowley62

Sorceror
Crash

Here is my crash log hope it helps you make this more stable can't wait looks great

Code:
Exception:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Server.OnsiteDueling.DuelPoints.GetLongestWinTime(Int32 players)
   at Server.OnsiteDueling.DuelScoreBoardGump.AddEntry(DuelPoints duelPoints, Int32 i)
   at Server.OnsiteDueling.DuelScoreBoardGump..ctor(Int32 page)
   at Server.OnsiteDueling.ScoreBoard.OnDoubleClick(Mobile from)
   at Server.Mobile.Use(Item item)
   at Server.Network.PacketHandlers.UseReq(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)
 

Jeff

Lord
vash88 said:
you can not fignt in town it does not turn you red or any thing you stay blue:(
do u have another script that handles Noto? like milts touney system, or the dueling for pinks system, if so thats why, you need to combine the noto handlers in the scripts.
 

Jeff

Lord
Crowley62 said:
Here is my crash log hope it helps you make this more stable can't wait looks great

Code:
Exception:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Server.OnsiteDueling.DuelPoints.GetLongestWinTime(Int32 players)
   at Server.OnsiteDueling.DuelScoreBoardGump.AddEntry(DuelPoints duelPoints, Int32 i)
   at Server.OnsiteDueling.DuelScoreBoardGump..ctor(Int32 page)
   at Server.OnsiteDueling.ScoreBoard.OnDoubleClick(Mobile from)
   at Server.Mobile.Use(Item item)
   at Server.Network.PacketHandlers.UseReq(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)
Fixed, thanks.
 

vash88

Wanderer
immortal

Jeff if you can make it so the 2 ppl who are fighting go immortal for like 10 seconds so they wont go gray by accdentally casting casting the last spell? that would be good. and it some things say ppl are in a duel whan they are not.
 

gandul

Sorceror
If you press allow duel invites,you cant put it ON again,you cant close the gump and you cant do anything .V.2.03
 

Crowley62

Sorceror
crash

after your last fix it took players 3 minutes to crash it again. It wasn't even active yet lol
Code:
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Server.OnsiteDueling.DuelController.IsInDuel(Mobile m, Duel& duel)
   at Server.OnsiteDueling.DuelController.IsInDuel(Mobile m)
   at Server.Items.Corpse.OnDoubleClick(Mobile from)
   at Server.Mobile.Use(Item item)
   at Server.Network.PacketHandlers.UseReq(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)
 

Jeff

Lord
vash88 said:
Pets can attack in a duel, which should net be could you help me for it not to do that?
why not, why shouldnt you be able to use pets, if u want rules such as no pets and whatnot, you will need to script that yourself. This version of this will not have rules.
 

Jeff

Lord
Crowley62 said:
after your last fix it took players 3 minutes to crash it again. It wasn't even active yet lol
Code:
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Server.OnsiteDueling.DuelController.IsInDuel(Mobile m, Duel& duel)
   at Server.OnsiteDueling.DuelController.IsInDuel(Mobile m)
   at Server.Items.Corpse.OnDoubleClick(Mobile from)
   at Server.Mobile.Use(Item item)
   at Server.Network.PacketHandlers.UseReq(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)

Please try the new version. Thanks for the crashlog
 

dracana

Sorceror
AllowBeneficial return code

Just noticed the following...

Code:
        private static bool PlayerMobile_AllowBenificial( Mobile from, Mobile target )
        {
            if( from == null || target == null )
                return NotorietyHandlers.Mobile_[B]AllowBeneficial[/B]( from, target ); ;

            Duel fromDuel, targetDuel;
            bool fromInDuel = IsInDuel( from, out fromDuel );
            bool targetInDuel = IsInDuel( target, out targetDuel );

            if( fromInDuel && targetInDuel )
            {
                if( fromDuel == null || targetDuel == null )
                    return NotorietyHandlers.Mobile_AllowBeneficial( from, target );

                return ( fromDuel == targetDuel );
            }
            else if( ( fromInDuel && !targetInDuel ) || ( targetInDuel && !fromInDuel ) )
                if( from.Player && target.Player )
                    return false;
                
           [B][COLOR="Red"] return NotorietyHandlers.Mobile_AllowHarmful( from, target );[/COLOR][/B]
        }

Should this be
Code:
return NotorietyHandlers.Mobile_Allow[B]Benificial[/B]( from, target );
instead?
 

evilfreak

Wanderer
Ok I have your system installed on pretty fresh install of 2.0 now... I was testing out your gumps when I ran into a problem. When you first type in [duel and the gump appears if you uncheck the allow invites box it loops and says you cannot do anything else untill you check that box, then it freezes will not let you recheck the box,close the window, and server restart does not reset the problem same thing when I restart.
 
Top