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

Erucid

Sorceror
Warning Do not test this on a production shard, If you make the Distro edit this Zombie can copy itself with every kill and could destroy a shard.

I would suggest testing this is a very controlled environment (walled in with no exits!!)

Again, I am not responsible if you release this on a production shard and it re-populates the whole map with zombies that's the point of it.

USE AND YOUR ON RISK!
I'd love to work this into my shard. There are so many nice story lines that could go with this. But I don't want it getting out of control.

My Assumptions:
...that the zombies can only walk.
...that the zombies can't cast spells.
...that the zombies cant talk.

If I put the zombies on an island. Then the only thing to worry about would be players gating the zombie out, or using a boat to transport the zombie. On my shard, I've disabled gate anyway. So that leaves some random player intentionally loading up a zombie on the boat and taking it to land.

Hmmm....
 

Thagoras

Sorceror
Zombies can't use teleporters. Zombies can't go through gates. Your only issue would be if a player was injured by a zombie, left the island and then died on mainland...the zombie being the last one to injure him/her. The script looks for last one to harm mobile (if killer was zombie, then become zombie). They COULD transport them via boat, however. I suppose that you could change the boat script so zombies can't board or exit the boat.
 

Spookyrobert

Sorceror
Hey Thagoras, It's been awhile, I kinda dropped off the face of Britannia but I'm back, for now. Didn't you re-write this zombie a while ago? if so I'd be more than happy to post it at the top of the thread if you e-mail it to me or just posted it here.
 

Pure Insanity

Sorceror
I'd love to work this into my shard. There are so many nice story lines that could go with this. But I don't want it getting out of control.

My Assumptions:
...that the zombies can only walk.
...that the zombies can't cast spells.
...that the zombies cant talk.

If I put the zombies on an island. Then the only thing to worry about would be players gating the zombie out, or using a boat to transport the zombie. On my shard, I've disabled gate anyway. So that leaves some random player intentionally loading up a zombie on the boat and taking it to land.

Hmmm....

You could just create a new region for this area you only want them in, and then add a check in the zombie script that removes any and all zombies not within that region.
 

Thagoras

Sorceror
Hey Thagoras, It's been awhile, I kinda dropped off the face of Britannia but I'm back, for now. Didn't you re-write this zombie a while ago? if so I'd be more than happy to post it at the top of the thread if you e-mail it to me or just posted it here.

I think I have my rewrites in the thread. Looking back, it appears to be page 5. Just fixed a few things that people were having issues with. Client crashes and such. Streamlined a few things. This is still probably my favorite script here.
 

Erucid

Sorceror
You could just create a new region for this area you only want them in, and then add a check in the zombie script that removes any and all zombies not within that region.
No, no i couldn't. I don't have that kind of scripting skills. :)
 

Thagoras

Sorceror
You could hard code it so when a zombie goes out of range of a given 2d point on assigned map, then die.

In OnThink method do something like (fix with your own points)

If (!(this.X > 20 && this.X < 100 && this.Y > 20 && this.Y < 100)) this.Kill();
 

Erucid

Sorceror
You could hard code it so when a zombie goes out of range of a given 2d point on assigned map, then die.

In OnThink method do something like (fix with your own points)

If (!(this.X > 20 && this.X < 100 && this.Y > 20 && this.Y < 100)) this.Kill();
Not seeing an OnThink...
 

Pure Insanity

Sorceror
That's because the zombie file doesn't have an OnThink override. You can always add your own, just make sure it overrides the base, and you still do a basecall to it when you're done. Somethin glike this should work.

Code:
public ovveride void OnThink()
{
	If (!(this.X > 20 && this.X < 100 && this.Y > 20 && this.Y < 100))
	{
		this.Kill();
	}
}

Note: I would suggest actually creating a new region and just seeing if the zombie is in that region any more, if not delete it. Doing something like this for static x and y values isn't recommended. As your locations will be different and what not. But this WILL work if you know all the values for the range you don't want them leaving...still say a new region is a better idea.
 

Thagoras

Sorceror
Note: I would suggest actually creating a new region and just seeing if the zombie is in that region any more, if not delete it. Doing something like this for static x and y values isn't recommended. As your locations will be different and what not. But this WILL work if you know all the values for the range you don't want them leaving...still say a new region is a better idea.

Agreed. This would also give you the option of easily placing other zombie areas on the shard. Doesn't this involve editing the Regions.xml when placing the zombie areas?

I only suggested the hard code because it involves only editing the zombiex.cs. I was going to suggest making an item which, if the zombie got out of range of the item, it would die...but Erucid said he wasn't a skilled scripter and I wanted to keep it simple.
 

Pure Insanity

Sorceror
Yes, it does involve editing the Regions.xml, but it's safer to edit this file then it is to edit distro files such as PlayerMobile. No serialization is involved in this file, just loads regions from this file when the server loads.

Even the newest developer could safely add a new region to the Regions.xml file and not have much if anything to worry about. Hardest part of it is getting the correct range. Especially if the region isn't a square.

If you add a new region, you can then just check to see if the zombie is in "Region Name" and if not's not, kill/delete it. Which brings me to another point...I believe that these zombies will replicate themselves if they are killed? I may be wrong...but I just assumed this is how it worked, didn't look yet. But...if this happens, I would suggest you delete the zombie when it leaves the region, instead of killing it. Or else it would be an infinite loop of killing a mob over and over. But...I could be wrong, not sure how this script was made to work.
 

Thagoras

Sorceror
No, they die as normal. The only way they would continue to replicate would be if a ZombieX kills a ZombieX...and they you're only at a 1 to 1 ratio. They replicate based on the OnDeath method. If the mobile's killer is a ZombieX, then replicate...otherwise (and this goes for the zombies too) die as normal.
 

Pure Insanity

Sorceror
Ah, I see. Well that's good to know, lol. So you can use this.Kill(); and have nothing to worry about. Other then tons of corpses outlining the boundaries of your region, lol.
 

Erucid

Sorceror
So if I went with this...
Code:
public ovveride void OnThink()
{
    If (!(this.X > 20 && this.X < 100 && this.Y > 20 && this.Y < 100))
    {
        this.Kill();
    }
}
Would I just dump right under public ovveride void OnMovement ?

Also, shouldn't it be
Code:
this.X > 20 || this.X < 100 || this.Y > 20 || this.Y < 100
???
 

Pure Insanity

Sorceror
Yes, putting it after the OnMovement would work.

The !() wrapped around it just means that code will only execute when those locations aren't met. It would be easier to remove it when it leaves a location then it would be to remove it when it enters a massive location that is outside of your location. Which is why it would be wrapped like that. So if it's x and y is greater than 20 and less than 100, that code will never run.
 

Pure Insanity

Sorceror
ahh... thanks

Code:
If ( (this.X > 20 && this.X < 100 && this.Y > 20 && this.Y < 100) == false )

Would be the same as
Code:
If (!(this.X > 20 && this.X < 100 && this.Y > 20 && this.Y < 100))

There are multiple ways of doing the same thing, each programmer has their own preference.
 

Pure Insanity

Sorceror
! is just an operator that you can use. It's used in a lot of programming languages. Another example...then back to the actual topic.

Code:
if ( !m_YourVariable )
{
	Write( "This will only happen if m_YourVariable is false." )
}

The variable is used only on bool's, kind of a lazy/shorter way of doing the same old thing another way.

Now...to the actual topic. Did that bit of code work for you? Did you decide to just create a region instead and do it like that? Or did you adapt the code to your x/y locations and just leave it as is?
 

deides

Traveler
I'm trying now to use the script without it. But thanks, anyway... The most important problem is the fact where the Zombie does not infect mobiles...

hi there - lost my previous serve but i'm doing a new one. got the script on page 4 or 5 and installed it with the edits. the edits are all in the right spot - it compiles fine but the zombies don't replicate. 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"

I did have to remove references to vampires and the like which I don't have on my serve, but that shouldnt affect anything since they are just indicators of what the zombie can't attack. The innocent tag also had to be removed as it brought an error.

So i'm not quite sure what the issue is. I installed the original files with the original edits last time (new revised version wasnt out yet) and it worked greeat except for the crash. but now they just don't replicate. I tried looking for the fellucca in zombiex.cs but didnt find it, and I even tried infecting a dog in fel, still didnt replicate.

I'm kind of at a loss here. I will post my basecreature and playermobile and zombiex.

any help would be GREATLY appreciated.. i'm stompted here.

*edit, running SVN 663 with SA and ML
 

Attachments

  • BaseCreature.cs
    151.5 KB · Views: 19
  • PlayerMobile.cs
    160.8 KB · Views: 19
  • ZombieX.cs
    11.7 KB · Views: 30
Top