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!

Possess Command

Morxeton

Sorceror
Possess Command

Summary:
A possess command that requires the least amount of editting of PlayerMobile.cs as possible. I created this script due to everyone having problems with the current possess commands released in script submissions. This script was written from scratch. "Credit for the idea" goes to whoever written the first possess command (I was informed this was Omega_Red. Thanks for the idea).

Description:
You can type [possess and target a mobile to possess them. You will take on their bodyvalue, basesoundID, hue, name, title, and stats. When you are killed while possessed, you don't actually die. Instead, a duplicate of the creature you possessed will be created and killed. You will return to your previous form... stats, name, title, etc... will return to how they were before you possessed anybody. This duplicate creature will have the exact items on it as the creature you possessed. You never possess their belongings. I saw no point into possessing those. When you type [unpossess, a duplicate of the creature you possessed will be created and spawned at your location. They will have all the same stats, items, etc. as the creature you possessed. Their HP, stamina, and mana will be at the same percentage as yours was before you unpossessed. There is an option with the possess command that allows you to not take on their stats. Type [possess nostatmod to achieve this. Also, [unpossess you can specify whether the creature will take your damage or be at full health when unpossessing. Type [unpossess nodamage to achieve this.

So the commands are:
[possess - Target a mobile to possess. You will take on their stats.
[possess nostatmod - Target a mobile to possess. You will not take on their stats.
[unpossess - Unpossess the creature. They will have your HP, stamina, and mana percent.
[unpossess nodamage - Unpossess the creature. They will be at full health, stamina, and mana.

In order to get away with minimal editting of the PlayerMobile.cs, during every worldsave an XML file is created with all the information for anyone that is possessing a creature. You may customize the XML filename at the top of the script. You may also change the accesslevel required at the top of the script as well. Anyone that does not meet the accesslevel, the script does not even process anything for OnBeforeDeath, it always returns true (which means they will die, same as return base.OnBeforeDeath() ). Anyone that is possessed and the server goes down, if the server saved them while they were possessed, you may unpossess yourself after server has started up again.

NOTE: This currently does not support tamed pets. I suggest not possessing anything tamed until I add it in. I am too busy to do it right now. If you do possess anything tamed, you will screw up the tame and when unpossessing it will no longer be tamed. Also, this does not support players with a bodymod value greater than 0. I will work on that as well.

Installation:
Place the script in your Scripts/Custom directory.

You MUST edit PlayerMobile.cs, but don't worry, it's an EASY edit.

Open PlayerMobile.cs and find this (at line 1008 in an unmodified PlayerMobile.cs):
Code:
return base.OnBeforeDeath();
Change it to:
Code:
return PossessCommand.UnpossessDeath( (Mobile) this );

Fire up your server and enjoy!
 

Attachments

  • Possess.cs
    19.1 KB · Views: 1,640

Razeial

Wanderer
Man tru....kick a guy when he's down...no j/k! GREAT script Mor. I love playing around with the newbies on the shard....now if we can make it to where incoming players see a blue name instead of a purple one :)
 

Morxeton

Sorceror
NOTE: This currently does not support tamed pets. I suggest not possessing anything tamed until I add it in. I am too busy to do it right now. If you do possess anything tamed, you will screw up the tame and when unpossessing it will no longer be tamed. Also, this does not support players with a bodymod value greater than 0. I will work on that as well.

Razeial said:
Man tru....kick a guy when he's down...no j/k! GREAT script Mor. I love playing around with the newbies on the shard....now if we can make it to where incoming players see a blue name instead of a purple one :)

That is possible. It requires a notoriety modification, or I can save the accesslevel of the person using the command then change it temporarily to accesslevel.player. Now, while possessed you would not be able to use any GM commands, but it will give the effect you desire. Accesslevel would be returned upon possessing via by [unpossess or death. I could make a command argument to do this. Thanks for the idea :)
 

Devious

Wanderer
Only one person was having a problem with it. but Thank You for posting this one. One less headache i have answering that guy.
 

Arkryal

Wanderer
Great Idea.

I like it, but still I see much more potential in this script.

Imagine this...

A Necromancer with skill 110+ has an approximate 20% chance that his ghost can possess an NPC/Monster. If he fails to possess, then he can not try again for 2 min. If he succeeds, he possess the npc/monster for a period of 5 min., during wich, the possesed creatures hp will deminish over time down to zero. If the creature he is possessing dies before 5 min. is up, the necromancer returns to ghost form. When 5min is up, and the HP is at zero, the necromancer is revived, all items in tact, and the monster is killed. The necromancer has no credit for the kill and the monster will have no items on it's corpse. ( to prevent abuse, like killing an ancient wyrm or champions ect. in this way. )

A script like this would be a lot of work, but the first to write something like that, I'm sure would gain notariety on these fourms.

Just an Idea I had, ( these scripts have a way of inspiring us, don't they).
 

bluebombs

Wanderer
found a bug

i edited my playermobile added the possess script found out little later that my players could no longer be killed thought i would post this maybe i did something wrong i had to get rid of it all together
 

Morxeton

Sorceror
bluebombs said:
i edited my playermobile added the possess script found out little later that my players could no longer be killed thought i would post this maybe i did something wrong i had to get rid of it all together
Oops, I just noticed I return false instead of true for when their access level is less than the required access level. Bug has been fixed. Thanks for the report.
 

Morxeton

Sorceror
I haven't worked on this lately, been busy with the Mega Spawner System in my spare time. I will take a look at it when I get a chance. Thanks for the bug report.
 

fyggnuuton

Wanderer
here is the errors i got

this is my error, if it helps

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Mobiles.InternalTarget.OnTarget(Mobile from, Object targeted)
at Server.Targeting.Target.Invoke(Mobile from, Object targeted)
at Server.Network.PacketHandlers.TargetResponse(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)
 

Morxeton

Sorceror
Crash has been fixed. The problem was, the script was not checking if the target's backpack was null.
 

Acorath

Wanderer
Client Crash

while possessing a rabbit, I attack another administrator. sometimes this has caused crashing to the client, but the server is fine. Just thought you should know.
 

Morxeton

Sorceror
Acorath said:
while possessing a rabbit, I attack another administrator. sometimes this has caused crashing to the client, but the server is fine. Just thought you should know.
Hmm... strange... what client? 3d?
 

Ravenal

Knight
Does this support Custom monsters and stuff, because I tried on my shard and possess a dog fine, but when it came to doing it to a NPC Mobile it would no possess it correct? I wonder why?
 

Morxeton

Sorceror
awakenlands said:
Does this support Custom monsters and stuff, because I tried on my shard and possess a dog fine, but when it came to doing it to a NPC Mobile it would no possess it correct? I wonder why?
What NPC did you possess? What were the problems you encountered? I haven't worked on this command in a while, but I am compiling a TODO list for fixes/updates and such.
 

Ravenal

Knight
Okay my friend whom got this command and tested it on his test shard, he went in and tested it on both, a NPC MObile*With BodyValue 400 and 401 both* which is male and female.... it did everything it was spose to do... Now when he did it for NPC Monster a dog for example it did it 100% too... The only problem is when i put it on my shard, with custom PlayerMobiles, and over 200 custom NPC mobiles on my shard, when it came to known to try it on a bran custom npc that i happen to try my Barbrian Shaman whom is a Custom script i made for my shard and players to fight, i happen to get into them but everything on my original Administrator was exact Dupe of what i nromally looked and basically showing and it was not working for Regular Bodyvalue 400-401 and so i did try a dog on my shard aand i happen to possess him verly good... Thats what i found odd about it...
 
Top