First off I know this is ServUO and I hope peeps will understand when I say, I can not get on my runuo account, been waiting for two months for a password reset and still not getting an email to do so, and justuo looks to be abandoned. I'm creating a shard for my 30yr daughter who has Metastatic Breast Cancer, to learn to develop and create take her mind off her situation.

Now the Problem, My server compiles and I have a years worth of work into it. I added FS-ATS Gen2 v2.0.0 it compiled and looked fine till I went to test the kill command. It does not matter what animal or where I am the shard crashes as soon as I add target. It happens when I use the pets gump or when I type all kill and target the prey.

this is the log error I get, same as always
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
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)

I have added the base weapon script I have used, If someone could help me clear this issue I would appreciate it. I'm using JustUOv2

Thanks in advance, for letting me post and trying to give me a hand.
 

Attachments

  • BaseWeapon.cs
    136 KB · Views: 3
Code:
//Vampire
       PlayerMobile player = attacker as PlayerMobile;
       PlayerMobile player2 = defender as PlayerMobile;
       if (VampireSystem.Enabled)
       {
         if (player.IsVampire && ....
the variable "player" and "player2" does not check for null reference.
if the player == BaseCreature type to example, the server will be crashed

Add a check for null:
Code:
if (VampireSystem.Enabled)
{
--- if( player != null && player2 != null)
------- { if (player.IsVampire && ....
 
Thanks Juzzver for the Help, I'm new to scripting and being new I'm unsure of where and what to insert per your Code. Sorry, I know People who script do not like a lot of questions, so bear with me here. I added : if( player != null && player2 != null) in area you entered but it still crashed the server. To Help me Learn If you have time, would you please take my basescript edit it for correction and then // the area so I can see what you did? Its easier for me to see how to correct more situations like that.
 
Compile your server in Debug mode, this will allow you to identify problematic lines of code in crash log.
app.userapi.com_c837121_v837121019_398d1_hTuM0CTlDos.jpg

if you don't know how to compile, use the following method:
-Create a shortcut of your server, invoke the shortcut properties.
-Add in the target field after the full path to the exe file, the option -debug

Example:
"D:\DevGames\UO Projects\ServUO-master\ServUO.exe"
Change to:
"D:\DevGames\UO Projects\ServUO-master\ServUO.exe" -debug

- Run your server, make crash and send new crashlog
 
You have
Code:
[*]//Vampire
[*]       PlayerMobile player = attacker as PlayerMobile;
[*]       PlayerMobile player2 = defender as PlayerMobile;
[*]       if (VampireSystem.Enabled)
[*]       {
[*]         if (player.IsVampire && ..
[*]
[*]change to
[*]
Code:
[*].

[*]//Vampire
[*]       PlayerMobile player = attacker as PlayerMobile;
[*]       PlayerMobile player2 = defender as PlayerMobile;
[*]

[*]	// NullReference

[*]	if (attacker == Null)

[*]	continue;
[*]	if (defender == Null)

[*]	continue;

[*]

[*]       if (VampireSystem.Enabled)
[*]       {
[*]         if (player.IsVampire && ...
I think this is what he means
 
don't ever do that))
I haven't ....but don't ever do what? replace the code with what he has? Anyhow I'm researching JustUO to find out how to create the short cut I get to the part where you add -debug at end of target after "s click ok and it says the name specified in the target box is not valid. Make sure the path and filename are correct... You create the shortcut right in the JustUO master file correct? or do I create shortcut on desktop then go to properties? I have tried everyway I can think of and it still comes back with that. My master file is on the desktop and the path is correct. Any suggestions my friend?
 
Yup,Yup that's what I did got that part down finally, I did a restore of system, my Laptop was acting up. Ok so I ran in debug mode, did a run with kill command on two chickens, shard crashed and rebooted, Did not see anything about the errors and it compiled. Looked at crash report this is what I got ...
 

Attachments

  • Crash 28-5-2017-12-56-42.txt
    1.2 KB · Views: 3
Edit this block:
Code:
            if (VampireSystem.Enabled)
            {
                if (player.IsVampire && player2 is PlayerMobile && !player2.IsVampire && !player2.IsWerewolf && !player2.Young && VampireSystem.VampireBiteChance > Utility.RandomDouble() || player.IsVampire && player2 is PlayerMobile && !player2.IsVampire && !player2.IsWerewolf && !player2.Young && player.AccessLevel > AccessLevel.Player)
                {
                    player.SendMessage(33, "You bite your enemy and drink his blood.");
                    player.VampireBiteTime = TimeSpan.FromHours(2.0);                                                          
                    player2.NonlocalOverheadMessage(MessageType.Regular, 0x21, 1060758, player2.Name);           
                    if (VampireSystem.Enabled && VampireSystem.VampireChance > Utility.RandomDouble() || VampireSystem.Enabled && !player2.IsVampire && player.AccessLevel > AccessLevel.Player)
                    {
                        player2.SendMessage(33, "You feel strange...");
                        player2.IsVampire = true;                      
                        if (VampireSystem.ShowTitles)
                        {
                            player2.Title = "the Vampire";
                        }
                        player2.AddStatMod(new StatMod(StatType.Str, "Vampire Str Bonus", VampireSystem.VampireStr, TimeSpan.Zero));
                        player2.AddStatMod(new StatMod(StatType.Dex, "Vampire Dex Bonus", VampireSystem.VampireDex, TimeSpan.Zero));
                        player2.AddStatMod(new StatMod(StatType.Int, "Vampire Int Bonus", VampireSystem.VampireInt, TimeSpan.Zero));
                    }
                }              
                if (player.IsWerewolf && player2 is PlayerMobile && !player2.IsWerewolf && !player2.IsVampire && !player2.Young && VampireSystem.WerewolfBiteChance > Utility.RandomDouble() || player.IsVampire && player2 is PlayerMobile && !player2.IsVampire && !player2.IsWerewolf && !player2.Young && player.AccessLevel > AccessLevel.Player)
                {
                    player.SendMessage(33, "You bite your enemy");      
                    player2.NonlocalOverheadMessage(MessageType.Regular, 0x21, 1060758, player2.Name);           
                    if (VampireSystem.Enabled && VampireSystem.WerewolfChance > Utility.RandomDouble() || VampireSystem.Enabled && player.AccessLevel > AccessLevel.Player)
                    {
                        player2.SendMessage(33, "You feel strange...");
                        player2.IsWerewolf = true;                      
                        if (VampireSystem.ShowTitles)
                        {
                            player2.Title = "the Werewolf";
                        }
                        player2.AddStatMod(new StatMod(StatType.Str, "Werewolf Str Bonus", VampireSystem.WerewolfStr, TimeSpan.Zero));
                        player2.AddStatMod(new StatMod(StatType.Dex, "Werewolf Dex Bonus", VampireSystem.WerewolfDex, TimeSpan.Zero));
                        player2.AddStatMod(new StatMod(StatType.Int, "Werewolf Int Bonus", VampireSystem.WerewolfInt, TimeSpan.Zero));
                    }
                }
            }


add a null check for player and player2 variables:
Code:
            if (VampireSystem.Enabled)
            {
                if (player != null && player2 != null)
                {
                    if (player.IsVampire && player2 is PlayerMobile && !player2.IsVampire && !player2.IsWerewolf && !player2.Young && VampireSystem.VampireBiteChance > Utility.RandomDouble() || player.IsVampire && player2 is PlayerMobile && !player2.IsVampire && !player2.IsWerewolf && !player2.Young && player.AccessLevel > AccessLevel.Player)
                    {
                        player.SendMessage(33, "You bite your enemy and drink his blood.");
                        player.VampireBiteTime = TimeSpan.FromHours(2.0);
                        player2.NonlocalOverheadMessage(MessageType.Regular, 0x21, 1060758, player2.Name);
                        if (VampireSystem.Enabled && VampireSystem.VampireChance > Utility.RandomDouble() || VampireSystem.Enabled && !player2.IsVampire && player.AccessLevel > AccessLevel.Player)
                        {
                            player2.SendMessage(33, "You feel strange...");
                            player2.IsVampire = true;
                            if (VampireSystem.ShowTitles)
                            {
                                player2.Title = "the Vampire";
                            }
                            player2.AddStatMod(new StatMod(StatType.Str, "Vampire Str Bonus", VampireSystem.VampireStr, TimeSpan.Zero));
                            player2.AddStatMod(new StatMod(StatType.Dex, "Vampire Dex Bonus", VampireSystem.VampireDex, TimeSpan.Zero));
                            player2.AddStatMod(new StatMod(StatType.Int, "Vampire Int Bonus", VampireSystem.VampireInt, TimeSpan.Zero));
                        }
                    }
                    if (player.IsWerewolf && player2 is PlayerMobile && !player2.IsWerewolf && !player2.IsVampire && !player2.Young && VampireSystem.WerewolfBiteChance > Utility.RandomDouble() || player.IsVampire && player2 is PlayerMobile && !player2.IsVampire && !player2.IsWerewolf && !player2.Young && player.AccessLevel > AccessLevel.Player)
                    {
                        player.SendMessage(33, "You bite your enemy");
                        player2.NonlocalOverheadMessage(MessageType.Regular, 0x21, 1060758, player2.Name);
                        if (VampireSystem.Enabled && VampireSystem.WerewolfChance > Utility.RandomDouble() || VampireSystem.Enabled && player.AccessLevel > AccessLevel.Player)
                        {
                            player2.SendMessage(33, "You feel strange...");
                            player2.IsWerewolf = true;
                            if (VampireSystem.ShowTitles)
                            {
                                player2.Title = "the Werewolf";
                            }
                            player2.AddStatMod(new StatMod(StatType.Str, "Werewolf Str Bonus", VampireSystem.WerewolfStr, TimeSpan.Zero));
                            player2.AddStatMod(new StatMod(StatType.Dex, "Werewolf Dex Bonus", VampireSystem.WerewolfDex, TimeSpan.Zero));
                            player2.AddStatMod(new StatMod(StatType.Int, "Werewolf Int Bonus", VampireSystem.WerewolfInt, TimeSpan.Zero));
                        }
                    }
                }
            }
 
ok added, recompiled and tested... same errors plus a few more, gonna try to take out vamp/wolf system and see what happens.. Any how thank you for your time and compassion with my issue.
 

Attachments

  • Crash 28-5-2017-20-58-23.7z
    795 bytes · Views: 5
yes, but I found code missing from several places in 4 different files from download package. Trying to wade through adding it and trying again. After that I give up, 3 days of clearing, adding. Thanks again, I'm taking a break for today!
 
Threw out vampire system. 4 days of messing with it, I give up but at least now pet kill is working. Thanks to Juzzver and Demented for trying to solve my issue for me. Very much appreciated.
 
Back