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!

[RUO 2.0 RCX] Stone of Rebirth

greywolf79

Sorceror
Sounds like a cool idea. I will be trying this out when I get a chance, especially the one with the delete function... I like the idea of a reward item to resurect only 1 time (maybe make it craftable somehow for my shards when I add it in). Thanks.

GreyWolf.
 
i was going to put it on a vendor stone for a very..very nice price.

Guess i can go back to figuring out how to fix a gump to this.
another thing i was trying to put on it was for you to be fully healed(mana/stam/hits) but it didnt quite follow the usual way of doing it.
 

rmacham

Sorceror
CB0T;778754 said:
How i put charges on it?

I need 1 charge.

Thanks! :)

You might want to have a look at the runebook.cs file to find out how to put charges on.

I am gonna start messing around with it to see if i can make it where you have to add resurrection scrolls to it for charges like you add recallscrolls to a runebook.

Ill keep you posted.

*Starts having fun scripting*
 

Rob24

Sorceror
I have a Q of this
I know I am lil late but I am trying to get this Script to work on a NPC
and nothing is working for it and I am seeing its runing on PlayerMobile is there a way to get the 1 of the NPC Runing in to the PlayerMobile too?
Or is there away to get this Script to work with a NPC?
 

Vorspire

Knight
Sure, you can make this work for NPC's too...

If you take this copy of the Basic AutoResStone, you can then call the public method "CheckResurrect" for any Mobile, from any script, at any time :) (Example below stone script)


Code:
using System;
using Server;
using Server.Items;
using Server.Mobiles;

namespace Server.Items
{
    public class AutoResStone : Item
    {
        public static void Initialize()
        {
            EventSink.PlayerDeath += new PlayerDeathEventHandler(EventSink_Death);
        }

        private static void EventSink_Death(PlayerDeathEventArgs e)
        {
            CheckResurrect(e.Mobile);
        }

        public static void CheckResurrect( Mobile owner )
        {
            if (owner != null && !owner.Deleted)
            {
                if (owner.Alive)
                    return;

                if (owner.Backpack == null || owner.Backpack.Deleted)
                    return;

                AutoResStone stone = owner.Backpack.FindItemByType(typeof(AutoResStone)) as AutoResStone;

                if (stone != null && !stone.Deleted)
                {
                    owner.SendMessage("Your stone of rebirth has saved you from the farplane.");
                    owner.Resurrect();
                }
            }
        }

        [Constructable]
        public AutoResStone()
            : base(0x1870)
        {
            Name = "Stone Of Rebirth";
            LootType = LootType.Blessed;
        }

        public AutoResStone(Serial serial)
            : base(serial)
        {

        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version 
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                //case 1: { } goto case 0;
                case 0: { } break;
            }
        }
    }
}

Example usage for BaseCreature.cs (Find the OnDeath method) - It may be better to use the OnBeforeDeath method instead, because I'm not too sure how NPC's would handle being resurrected after actually being dead without the Player flag being true..
Code:
public override void OnDeath( Container c )
{
            //Standard OnDeath code, blah blah...

            [B][COLOR="Red"]AutoResStone.CheckResurrect( this );[/COLOR][/B]

            //More Standard OnDeath code, blah blah blah blah...
}
 

Gabriele1021

Wanderer
Working with ResurrectGump...

Hi, Not very Experienced in C#, but I liked spiderleg's idea about bringing up the resurrection gump. Sooo, I attempted it.​
I went to the Ankh script and looked at how it brought up the Gump. You don't have to double click it, so I thought it would work...

So, in the stone script, where it says to resurrect the owner, I replaced it with the script from the ankh:

AutoResStone.cs:
Code:
		m.CloseGump( typeof( ResurrectGump ) );
		m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) );
And changed it to apply to this script:
Code:
                owner.CloseGump(typeof(ResurrectGump));
                owner.SendGump(new ResurrectGump(owner, ResurrectMessage.Healer));
It compiled fine, but it doesn't bring up the Gump, or resurrect me...:mad:

I've tried a number of different ways, and none have proven to work.. Any help is greatly appreciated.:)
 

Rasmenar

Sorceror
Wow, I was just working on a new Set of items that (when all pieces are worn), the Chest does something exactly like this. Thx a million, now I don't have to edit PlayerMobile.
 

Hotshot

Sorceror
Hmmm , I have downloaded a Autoress stone script from awhile back, I do not remember who scripted and posted, It works good with I think 60 seconds of being Invul, so you vcan get your stuff and get away. The only Isues I have with it is, When i add scripts and have to reboot server , It cancels out being asigned to a player. They have to d-click their rezz stones again.
If you can use it to merge it with yours or help you out with yours. I'll post it, Be sure to give props tho to who ever scripted, I cannot remember...lol
Unless you just want to Fix this to where players don't have to d-click after each server restart.
 

Attachments

  • AutoResStone.cs
    2.8 KB · Views: 34

Nockar

Sorceror
With Much help here from others here is a working version that has charges, res's with 100% str, int, dex, and has a timer of 5 seconds.

- charges (-1 charge each rez)
- res 100% str, int, dex
- 5 second timer

Peoples who helped make this
Vorspire (Most of the final code was made by Vorspire)
M_0_h
Lord_Greywolf


Code:
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Prompts;
using Server.Network;
using System.Collections;

namespace Server.Items
{
    public class AutoResStone : Item
    {
        private int m_Charges = 10;

        [CommandProperty( AccessLevel.GameMaster )]
        public int Charges
        {
            get { return m_Charges; }
            set { m_Charges = value; InvalidateProperties(); }
        }

        private Timer m_Timer;
        private TimeSpan m_Delay = TimeSpan.FromSeconds( 5.0 ); /*TimeSpan.Zero*/

        [CommandProperty(AccessLevel.GameMaster)]
        public TimeSpan Delay { get { return m_Delay; } set { m_Delay = value; } }
	
        public static void Initialize()
        {
            EventSink.PlayerDeath += new PlayerDeathEventHandler(EventSink_Death);
        }

        private static void EventSink_Death(PlayerDeathEventArgs e)
        {
            PlayerMobile owner = e.Mobile as PlayerMobile;

            if (owner != null && !owner.Deleted)
            {
                if (owner.Alive)
                    return;

                if (owner.Backpack == null || owner.Backpack.Deleted)
                    return;

                AutoResStone stone = owner.Backpack.FindItemByType(typeof(AutoResStone)) as AutoResStone;

                if (stone != null && !stone.Deleted)
                {
                    stone.CountDown(owner);
                }
            }
        }

        [Constructable]
        public AutoResStone() : this( 1 )
        { }

        [Constructable]
        public AutoResStone(int charges) 
            : base(0x1870) 
        {
            m_Charges = charges;

            Name = "Stone Of Rebirth";
            LootType = LootType.Blessed;
            
            Weight = 1.0;
        }

        public AutoResStone(Serial serial)
            : base(serial)
        { }

        private void CountDown(PlayerMobile owner)
        {
            m_Timer = Timer.DelayCall(m_Delay, new TimerStateCallback(Resurrect_OnTick), new object[] { owner });
        }

        private void Resurrect_OnTick(object state)
        {
            object[] states = (object[])state;
            PlayerMobile owner = (PlayerMobile)states[0];

            if (owner != null && !owner.Deleted)
            {
                if (owner.Alive || m_Charges < 1)
                    return;

                owner.SendMessage("Your stone of rebirth has saved you from the farplane.");
                owner.Resurrect();

                owner.Hits = owner.HitsMax;
                owner.Stam = owner.StamMax;
                owner.Mana = owner.ManaMax; 

                m_Charges--;

                InvalidateProperties();
            }
        }

        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );

            list.Add(String.Format("{0} Charges", m_Charges));
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

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

            writer.Write( (TimeSpan) m_Delay );
            writer.Write( (int) m_Charges );            
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 0: 
                {
                     m_Delay = reader.ReadTimeSpan();
                     m_Charges = reader.ReadInt();
                } break;
            }
        }

    }
}
 

Vorspire

Knight
Nockar;810716 said:
With Much help here from others here is a working version that has charges, res's with 100% str, int, dex, and has a timer of 5 seconds.

- charges (-1 charge each rez)
- res 100% str, int, dex
- 5 second timer

Peoples who helped make this
Vorspire (Most of the final code was made by Vorspire)
M_0_h
Lord_Greywolf

I have updated the main post with this new version, thanks :D
 

M_0_h

Page
Vorspire;810745 said:
That's pretty sweet too, I just finished a nice little system for building Item Sets :D

It works exactly the same as in World of Warcraft



More Info: RunUO - Ultima Online Emulation - Vorspire's Album: Developments - Picture

I like this Idea very much! I already thought about doing something like that, but without level restrictions. But I guess you won't contribute your system to RunUO, would you?^^
 

Nockar

Sorceror
Vorspire;810745 said:
That's pretty sweet too, I just finished a nice little system for building Item Sets :D

It works exactly the same as in World of Warcraft



More Info: RunUO - Ultima Online Emulation - Vorspire's Album: Developments - Picture

I just look at your 7 pics you have up on your profile. Those look VERY cool!! That is a really great idea.

Will you be sharing any of those scripts with the community????? HAHAH I would absolutely love to mess around them!!
 

Vorspire

Knight
I don't know if I would be able to supply these scripts, I use a heavily customized ObjectPropertyList class and custom cliloc.enu edits to make this work properly.

The custom edits for the cliloc.enu file have a value of "~1_NOTHING~" so any text can be used with it.

It would be too much work to supply the ObjectPropertyList stuff, but the base-system can be installed easily.

When I'm totally confident that the ItemSet class I use is perfect and bug-free, I will possibly release it :)
 

M_0_h

Page
Vorspire;810766 said:
When I'm totally confident that the ItemSet class I use is perfect and bug-free, I will possibly release it :)

That would be great! I'm not very satisfied with the ML ItemSets... if you need any help, just let me know ;)

Greetings
 

Erevan

Sorceror
I know this is an older thread.. but I'm certain plenty of people still use this release. Wanted to post an update to the stone that comes with charges. For whatever reason, the version released here does not work correctly, at all (charges are stuck at 1 regardless of setting). Here's an updated copy that works just fine..

Note: this copy auto-deletes the stone once it uses all of its charges. Seemed kinda redundant to have an unusable blessed item that sits in your pack (especially when some servers don't allow trashing of blessed items). I also modified the GetProperties string.. it now displays as Charges: {0}.. instead of just {0} Charges. I have an extra string beneath mine, thus the reason for the change (the old method screwed with the additional string).

Code:
using System;
using Server;
using Server.Items;
using Server.Mobiles;
 
namespace Server.Items
{
    public class AutoResStoneCharged : Item
    {
        private int m_Charges;
 
        [CommandProperty( AccessLevel.GameMaster )]
        public int Charges
        {
            get { return m_Charges; }
            set { m_Charges = value; }
        }
 
        private Timer m_Timer;
        private TimeSpan m_Delay = TimeSpan.FromSeconds ( 5.0 );
 
        [CommandProperty(AccessLevel.GameMaster)]
        public TimeSpan Delay { get { return m_Delay; } set { m_Delay = value; } }
    
        public static void Initialize()
        {
            EventSink.PlayerDeath += new PlayerDeathEventHandler(EventSink_Death);
        }
 
        private static void EventSink_Death(PlayerDeathEventArgs e)
        {
            PlayerMobile owner = e.Mobile as PlayerMobile;
 
            if (owner != null && !owner.Deleted)
            {
                if (owner.Alive)
                    return;
 
                if (owner.Backpack == null || owner.Backpack.Deleted)
                    return;
 
                AutoResStoneCharged stone = owner.Backpack.FindItemByType(typeof(AutoResStoneCharged)) as AutoResStoneCharged;
 
                if (stone != null && !stone.Deleted)
                {
                    stone.CountDown(owner);
                }
            }
        }
 
        [Constructable]
        public AutoResStoneCharged() : this( 1 )
        { }
 
        [Constructable]
        public AutoResStoneCharged(int charges) 
            : base(0x1F1C) 
        {
            Name = "Stone Of Rebirth";
            LootType = LootType.Blessed;
 
            Charges = 15;
 
            Weight = 1.0;
        }
 
        public AutoResStoneCharged(Serial serial)
            : base(serial)
        { }
 
        private void CountDown(PlayerMobile owner)
        {
            m_Timer = Timer.DelayCall(m_Delay, new TimerStateCallback(Resurrect_OnTick), new object[] { owner });
        }
 
        private void Resurrect_OnTick(object state)
        {
            object[] states = (object[])state;
            PlayerMobile owner = (PlayerMobile)states[0];
 
            AutoResStoneCharged stone = owner.Backpack.FindItemByType(typeof(AutoResStoneCharged)) as AutoResStoneCharged;
 
            if (owner != null && !owner.Deleted)
            {
                if (owner.Alive || m_Charges < 1)
                    return;
 
                owner.SendMessage("Your stone of rebirth has saved you from the farplane.");
                owner.Resurrect();
 
                owner.Hits = owner.HitsMax;
                owner.Stam = owner.StamMax;
                owner.Mana = owner.ManaMax; 
 
                m_Charges--;
                if( m_Charges == 0 )
                    stone.Delete();
 
                InvalidateProperties();
            }
        }
 
        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );
 
            list.Add( 1060741, "{0}", Charges.ToString() );
        }
 
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
 
            writer.Write( (int) 0 ); // version
 
            writer.Write( (TimeSpan) m_Delay );
            writer.Write( (int) m_Charges );            
        }
 
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
 
            int version = reader.ReadInt();
 
            switch (version)
            {
                case 0: 
                {
                     m_Delay = reader.ReadTimeSpan();
                     m_Charges = reader.ReadInt();
                } break;
            }
        }
 
    }
}
 
Top