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!

A Contagious Zombie

deides

Traveler
Om problem fixed. Looks like theres some problem with the onbeforedeath distro edit.

I replaced it with
Code:
//Start Zombiex edit

                    Mobile killerx = this.FindMostRecentDamager(true);

                    if (killerx is Zombiex && (this.Map == Map.Felucca))
                    {

                        // Switch to BaseUndead if using Thagoras BaseUndead.cs
                        //What Should the Zombie virus not affect
                        if ( this.Summoned || this is Zombiex || this is AncientLich || this is Bogle || this is LichLord || this is Shade || this is Spectre || this is Wraith || this is BoneKnight || this is Ghoul || this is Mummy || this is SkeletalKnight || this is Skeleton || this is Zombie || this is ShadowKnight || this is DarknightCreeper || this is RevenantLion || this is LadyOfTheSnow || this is RottingCorpse || this is SkeletalDragon || this is AirElemental || this is IceElemental || this is ToxicElemental || this is PoisonElemental || this is FireElemental || this is WaterElemental || this is EarthElemental || this is Efreet || this is SnowElemental || this is AgapiteElemental || this is BronzeElemental || this is CopperElemental || this is DullCopperElemental || this is GoldenElemental || this is ShadowIronElemental || this is ValoriteElemental || this is VeriteElemental || this is BloodElemental )
                        //if (this is BaseUndead || this.Summoned)
                        {
                            return base.OnBeforeDeath();
                        }
                        else
                        {

                            double dhits, dstr;

                            Zombiex zomb = new Zombiex();

                            zomb.Map = this.Map;
                            zomb.Female = this.Female;
                            zomb.Body = this.Body;
                            zomb.Location = this.Location;
                            zomb.Hue = 768;
                            zomb.Name = this.Name;
                            zomb.Title = "*Infected*";

                            zomb.HairItemID = HairItemID;
                            zomb.HairHue = HairHue;
                            zomb.FacialHairItemID = FacialHairItemID;
                            zomb.FacialHairHue = FacialHairHue;

                            dhits = this.HitsMax / 2;
                            dstr = this.Str / 2;
                            for (int i = 0; i < this.Skills.Length; ++i)
                            {
                                zomb.Skills[i].Base = this.Skills[i].Base;
                                zomb.Skills[i].Cap = this.Skills[i].Cap;
                            }

                            for (int i = 0; i < this.Items.Count; i++)
                            {
                                zomb.AddItem(zomb.CloneItem(this.Items[i]));
                            }

                            zomb.HitsMaxSeed = this.HitsMax + (int)dhits;
                            zomb.Hits = this.HitsMax + (int)dhits;
                            zomb.DamageMin = this.DamageMin;
                            zomb.DamageMax = this.DamageMax;
                            zomb.Str = this.Str + (int)dstr;
                            zomb.MoveToWorld (this.Location, this.Map);
                this.Delete();
                        }

                    }

                    //End Zombiex edit

and it works fine now.
 

Thagoras

Sorceror
so I looked at zombiex.cs and found that " Zombiex zomb = new Zombiex();" was commented out, removed the comments and now I get "A local variable named 'zomb' cannot be declared in this scope because it would give a different meaning to 'zomb', which is already used in a 'parent or current' scope to denote something else"
This was commented out because of the edits in BaseCreature and PlayerMobile. In both cases, the edits already create a New zombie. This zombie is then carried over to the Zombiex.cs modules via this line in the playermobile
zomb.PlayerMobileModule(this, zomb);
and the corresponding line in zombiex
public virtual void PlayerMobileModule(Mobile from, Zombiex zomb)
The zomb variable is declared at the beginning of the modules already with a value and so if you create a new zombiex instance and attach the variable zomb, it will error.
The scripts appear correct...minus the Zombiex zomb = new Zombiex(); that you uncommented out.
What should be happening is, ZombieX kills a mobile (playermobile or basecreature). The mobile checks to see what killed it. If it's a Zombiex, then it should spawn another Zombiex which looks exactly like itself. It can only infect another mobile if that mobile dies first. Otherwise, I'm not sure what to tell you.
 

deides

Traveler
This was commented out because of the edits in BaseCreature and PlayerMobile. In both cases, the edits already create a New zombie. This zombie is then carried over to the Zombiex.cs modules via this line in the playermobile
zomb.PlayerMobileModule(this, zomb);
and the corresponding line in zombiex
public virtual void PlayerMobileModule(Mobile from, Zombiex zomb)
The zomb variable is declared at the beginning of the modules already with a value and so if you create a new zombiex instance and attach the variable zomb, it will error.
The scripts appear correct...minus the Zombiex zomb = new Zombiex(); that you uncommented out.
What should be happening is, ZombieX kills a mobile (playermobile or basecreature). The mobile checks to see what killed it. If it's a Zombiex, then it should spawn another Zombiex which looks exactly like itself. It can only infect another mobile if that mobile dies first. Otherwise, I'm not sure what to tell you.

Yes, I gathered that, but no new zombie spawned once a basecreature was killed (using the distros I attached 2 posts above). Zombiex would kill a dog, and the dog would be dead, with a dead body of a dog on the floor, no zombie dog.

I made the change to the old code (no carrying over to zombiex.cs) and now it works. so it seems that there was an issue with the communication between onbeforedeath edit and zombix.cs (with that area commented out that I was referring to before - as you had distributed the file)

I posted my files 2 posts ago - everything done right - but no zombies when basecreature was killed.

i really appreciate the work you did !
 

Thagoras

Sorceror
Ok, had a chance to play with it a bit...and this is all irrelevant if you're using the older version.

Think I may know what's going on. Might this have anything to do with the CanInfect variable? Dogs on my server aren't marked as something that can be infected and so zombies just kill them. When the variable is initialized in BaseCreature, it's set as false, thus requiring you to edit all the basecreatures you WANT to infect by adding the line (in the constructable) CanInfect = true;. You can change this default in the Basecreature where it's initialized to read true instead of false
private bool m_CanInfect = false;

When I added this var, I was going with the belief that not everything should be able to turn zombie.
 

deides

Traveler
Ok, had a chance to play with it a bit...and this is all irrelevant if you're using the older version.

Think I may know what's going on. Might this have anything to do with the CanInfect variable? Dogs on my server aren't marked as something that can be infected and so zombies just kill them. When the variable is initialized in BaseCreature, it's set as false, thus requiring you to edit all the basecreatures you WANT to infect by adding the line (in the constructable) CanInfect = true;. You can change this default in the Basecreature where it's initialized to read true instead of false
private bool m_CanInfect = false;

When I added this var, I was going with the belief that not everything should be able to turn zombie.
fair enough. I made it work with the script above, so i'm happy :)

Now... what about placing one of these bad boys in AN ACTIVE CHAMP SPAWN???

HAR HAR HAR HAR
 

deides

Traveler
Ok, had a chance to play with it a bit...and this is all irrelevant if you're using the older version.

Think I may know what's going on. Might this have anything to do with the CanInfect variable? Dogs on my server aren't marked as something that can be infected and so zombies just kill them. When the variable is initialized in BaseCreature, it's set as false, thus requiring you to edit all the basecreatures you WANT to infect by adding the line (in the constructable) CanInfect = true;. You can change this default in the Basecreature where it's initialized to read true instead of false
private bool m_CanInfect = false;

When I added this var, I was going with the belief that not everything should be able to turn zombie.

I combined this with the monsternest script posted a few days ago and will have a few nests spawn in graveyards. that way, there is a way for people to "remove" the infestation from an area if they destroy the nests.

anyways, I just wanted to know that the issue for me doesnt appear to be the caninfect=false thing. I changed basecreature and changed caninfect=true in the first ditro edit, then spawned a NEW dog after restart and a zombiex. when the zombiex killed the dog, the only difference is that the dog corpse dissapears, but no zombie dog appears.

problem appears to be in the onbeforedeath distro edit

Code:
            Mobile killerx = this.FindMostRecentDamager( true );
            if (killerx is Zombiex)
            {
                Zombiex zomb = new Zombiex();
                zomb.BaseCreatureModule(this, zomb);
            }

ill post my basecreature - I have the old zombiex lines commented out but you can see the onbeforedeath edits done as you described. doesnt seem to create a new zombie for me
 

Attachments

  • BaseCreature.cs
    154.8 KB · Views: 10

Thagoras

Sorceror
Time and time again, everything looks as it should. The system works perfectly on my system. It's time to consider other things interfering with it working correctly. I don't know that the ATS system deletes the mobiles. I have the hunting pack installed on my system and I recall it causing all sorts of issues.
 
Added it to an ML enabled shard, didn't work at first, so enabled the "caninfect" to true in basecreature, which worked.

But I noticed a massive amount of client crashes out of no where, just running around an area with any npc/creature, which is odd.
 

jamesreg

Sorceror
I got a some questions about this script.

1) could this be set up in an area of the shard such as an island or area that one would have to gate or recall r travel by ship to get to something like that.
and not have risk of entire shard being infected? are there expoits players could use in that situration?

2) Would it be possible to spawn the zombies in Felecia with no danger to tram or other facets? again could players exploit this and get
zombies to go to an unintended place?

3) if one wanted to put this on a normal ml/sa enabled shard but limit danger to whole shard being infected what ideal places do you guys have in mind for that?
 

Thagoras

Sorceror
1 and 2 are about the same, so I will answer them as such. I believe, though I may have to look over the code again, that what I submitted made it so only felucca would be affected. One could restrict the area where this could happen either by hard-coding the x,y coordinates into the *ondeath* method (about where I coded it to work just for felucca), or you could restrict it to a region. Everything happens in the *ondeath* method, so this is where all your edits would go. The idea here is, if they're not in the area where you can become a zombiex, you can't become one. It all comes down to the one doing the dying and not the one doing the damage/killing (infecting).

3. um, what do you mean? Where would an ideal spot to place the zombiex spawn look like? It should be a place which is physically cut off from the rest of the map, whether it be a dungeon or an island (or whatever else...there are other ways to cut off areas). It should be a place that can't be marked or gated to/from. Because it utilizes the last damager routine in the ondeath method, there shouldn't be a way to have a zombie do damage to you, you leave and die in an unprotected area (where you could spread it to the whole server). Also remember, there is a rot timer built in...if they don't spread the infection before they drop, the infection is over. BUT if they are brought to a high spawn area...spawners don't know that what they spawned really just changed into a zomebiex and so they could affectively feed the zombies until your server crashes from an over population.... ....perhaps I should look into writing a spawner that keeps this in mind....

***note: actually, I believe, the ondeath method calls a method in the zombiex.cs...and this is what would need to be edited. There are 2 separate methods to edit. One for basecreatures and one for playermobiles.***
 

clark71822

Sorceror
I've been working on modifying this script so that all mobiles have a InfectedByZombie value, plus a custom region setup to check that value before the mobile leaves the region. If the value is true, the mobile dies (basecreature/zombiex) or is unable to walk out, use travel spells, or use travel books to leave (players) until they die or use an antidote. Still working on it though, so I haven't been able to test it. It's my hope with this setup that I could limit the zombie spawns to that particular region and not worry about a full facet or shard outbreak.
 

Crod76

Sorceror
Hope I'm not resurrecting a dead thread here, but I came across this, installed it, and I didn't get any errors (minus the vamp and innocent errors which were okay because I dont have those instances active on my server) But, the ZombieX isnt aggressive. I had a player test it and it killed him, turned him into a Zombie, but even the zombie version of the player just wandered around, non aggressive. Any suggestions?
 

Crod76

Sorceror
Nevermind, I figured it out. But now Im having a similar issue as jamesreg. The Zombie infects the player just fine, but just kills the NPC mobiles...
 

peepeetree

Sorceror
hmm I installed this mod, I used the old one in the past and loved it but when I install the updated version into 2.2 I will get a zombie that only attacks a player, upon death no zombie is created. Worse though when I use deides solution above it somehow corrupts the healer files in my game and can't seem to be repaired. It is a mess to try and fix, I will probably end up just starting a new server so heads up DON'T use deides script above.
 

Miracle99

Squire
This script is insane and pretty awesome.
Couple things i noticed not sure if its because of something else causing the issues
1: When zombiex turns its victim they continue to fight (could be because I // out all the BaseUndead/Vampire/etc because i dont have that stuff installed)
2: When using the KillerPotion on two infected that are fighting eachother it says it kills them but then a new infected spawns instantly and they continue fighting. The potion only seems to truly kill the infected if they are not actively fighting something.

Either way it seems amazing and will be a great event for halloween after some adjustments.
 

peepeetree

Sorceror
Ok this has happened to me 3 times now and I want to bring this up now that I am pretty confident that this script is somehow causing it or conflicting with something else that is causing it. At first I thought my server was corrupted and melting down but this now happened to me on a new clean server that has worked fine for weeks and we are back to the same problem only today when I put zombiex back in. If you edit the ZombieX file, I had it working perfectly but wanted to remove the rot timer so it wouldn't rot on its own in a secluded dungeon I was planning to place them. Once you reboot your server though it breaks your server saying...

Code:
RunUO - [www.runuo.com] Version 2.1, Build 4272.35047
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 6 64-bit processors
Scripts: Compiling C# scripts...done (0 errors, 0 warnings)
Scripts: Skipping VB.NET Scripts...done (use -vb to enable)
Scripts: Verifying...done (2785 items, 764 mobiles) (0.87 seconds)
Regions: Loading...done
World: Loading...An error was encountered while loading a saved object
- Type: Server.Mobiles.Healer
- Serial: 0x00000002
Delete the object? (y/n)

I am not experienced enough to figure out what is causing it but the only way I have found to fix this is to pull files from backups and replace all the healer files, remove zombiex, replace all the files that were edited and say a little prayer. I am running 2.2, if anyone can help figure out what the problem is I would appreciate it. The script is brilliant when it works but I don't want my server constantly crashing because of it.
 

Attachments

  • ZombieX.cs
    10.7 KB · Views: 6
  • BaseCreature.cs
    132.1 KB · Views: 6
  • PlayerMobile.cs
    111.3 KB · Views: 3
  • Corpse.cs
    31.7 KB · Views: 6

Thagoras

Sorceror
What you have is a classic Serialization/Deserialization conflict. The exact issue is this.
Code:
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 17 ); // version

writer.Write( (int)m_CurrentAI );
writer.Write( (int)m_DefaultAI );
This snippit is from your basecreature.cs. What the serializers do is read and write the savefile information. If the reader goes to read a bit of information that it's not expecting it crashes...and then tries to delete all instances of that object...in favor of the new version.
The problem with what you have here is what version of the basecreature you're using. You're telling it to write that it's version 17 but it's reading up to version 18 (just because of how the reader is designed in this instance). It's a simple fix. Just change that 17 to 18 and it SHOULD work alright...it'll be reading and writing correctly anyway.
This goes for anything that has you altering the serializers. Remember to update the version number to whatever version your changes make it.
 

peepeetree

Sorceror
Thank you very much for not only providing a solution but more importantly explaining what was causing the issue. I really appreciate all the work you have done to get this working again and for all the help/support you have provided.
 

The_Man

Sorceror
A
What you have is a classic Serialization/Deserialization conflict. The exact issue is this.
Code:
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
 
writer.Write( (int) 17 ); // version
 
writer.Write( (int)m_CurrentAI );
writer.Write( (int)m_DefaultAI );
This snippit is from your basecreature.cs. What the serializers do is read and write the savefile information. If the reader goes to read a bit of information that it's not expecting it crashes...and then tries to delete all instances of that object...in favor of the new version.
The problem with what you have here is what version of the basecreature you're using. You're telling it to write that it's version 17 but it's reading up to version 18 (just because of how the reader is designed in this instance). It's a simple fix. Just change that 17 to 18 and it SHOULD work alright...it'll be reading and writing correctly anyway.
This goes for anything that has you altering the serializers. Remember to update the version number to whatever version your changes make it.

And how do you know what version something is or should be?
 
Top