Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 11-18-2009, 12:23 AM   #26 (permalink)
Forum Novice
 
Join Date: Oct 2009
Age: 24
Posts: 133
Default

I have to agree with murzin on this one it can allow you to make edits with find and replace in a couple ways you cant with white space. however i prefer leaving the white space in because putting it back in once you remove it is not easy.
__________________
Seriously, don't take me seriously, unless i tell you i am being serious, i am not, seriously.
starlazer is offline   Reply With Quote
Old 11-18-2009, 01:03 AM   #27 (permalink)
Lurker
 
Join Date: Aug 2007
Posts: 23
Default

Thanks everyone, it seems like i'm getting errors with more custom scripts along with this one so I made a clean server and added only this script and he works perfectly! Now I just need him to drop some custom loot =D Thanks again everyone but his hits are only 20 =/ how do I set his hits higher or you can just tell me where to add the code haha.. I don't want to cause more work for you guys then I already have.

Edit: Ok so I added a code for hit points but it doesn't seem to be working, Marked the change in blue



Code:
//Made by Firepants11
using System;
using Server.Network;
using Server.Items;
using Server.ContextMenus;
using Server.Misc;
using Server.Engines.CannedEvil;
using System.Collections;
using System.Collections.Generic;
using Server.Network;
using Server;

namespace Server.Mobiles
{
[CorpseName("Corpse of Illidan")]
public class Illidan : BaseCreature
{

      private static bool m_Talked;
          string[]IllidanSay = new string[]
          {
"You are not Prepared!",
"Foolish mortals you think you can defeat me!",
"MUAHAHAHA! You will all die!!",
"I will paint my face with your blood!!",
};

[Constructable]
public Illidan () : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Name = "Illidan";
Body = 755; 
BaseSoundID = 357; 

SetStr (20) ;
SetDex (20) ;
SetInt (2000) ;

SetDamage (150) ;

SetDamageType( ResistanceType.Physical,10) ;
SetDamageType( ResistanceType.Cold,20) ;
SetDamageType( ResistanceType.Fire,20) ;
SetDamageType( ResistanceType.Energy,20) ;
SetDamageType( ResistanceType.Poison,20) ;


SetResistance( ResistanceType.Physical,10) ;
SetResistance( ResistanceType.Cold,20) ;
SetResistance( ResistanceType.Fire,20) ;
SetResistance( ResistanceType.Energy,1) ;
SetResistance( ResistanceType.Poison,10) ;



VirtualArmor = 100;

ControlSlots = 5;



}
	[CommandProperty( AccessLevel.GameMaster )]
	  public override int HitsMax{ get{ 65000 : 30000; } }
          public override bool AlwaysMurderer{ get{ return true; } }
          public override bool Uncalmable{ get{ return true; } }


		public Illidan( 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();
		}
            public override void OnMovement( Mobile m, Point3D oldLocation )
            {

                 if( m_Talked == false )
                 {
                      if ( m.InRange( this, 3 ) && m is PlayerMobile)
                       {

                             m_Talked = true;
                             SayRandom(IllidanSay, this );
                             this.Move( GetDirectionTo( m.Location ) );
                             SpamTimer t = new SpamTimer();
                             t.Start();
                        }
                   }
              }

              private class SpamTimer : Timer
              {
                   public SpamTimer() : base( TimeSpan.FromSeconds( 12 ) )
                   {
                        Priority = TimerPriority.OneSecond;
                   }

                   protected override void OnTick()
                   {
                           m_Talked = false;
                   }
               }

               private static void SayRandom( string[] say, Mobile m )
               {
                    m.Say( say[Utility.Random( say.Length )] );
               }
	        public override bool OnBeforeDeath()	
	        {	
	            	
		
	            if (!NoKillAwards)	
	            {	
		
	                Map map = this.Map;	
		
	                if (map != null)	
	                {	
	                    for (int x = -12; x <= 12; ++x)	
	                    {	
	                        for (int y = -12; y <= 12; ++y)	
	                        {	
	                            double dist = Math.Sqrt(x * x + y * y);	
		
	                            if (dist <= 12)	
	                                new GoodiesTimer(map, X + x, Y + y).Start();	
	                        }	
	                    }	
	                }	
	            }	
		
	            return base.OnBeforeDeath();	
	        }	
		
		
	        public override void OnDeath(Container c)	
	        {	
	            if (Map == Map.Felucca)	
	            {	
	                //TODO: Confirm SE change or AoS one too?	
	                List<DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);	
	                List<Mobile> toGive = new List<Mobile>();	
		
	                for (int i = rights.Count - 1; i >= 0; --i)	
	                {	
	                    DamageStore ds = rights[i];	
		
	                    if (ds.m_HasRight)	
	                        toGive.Add(ds.m_Mobile);	
	                }	
		
	            }	
		
	            base.OnDeath(c);	
	        }	
		
		
	        private class GoodiesTimer : Timer	
	        {	
	            private Map m_Map;	
	            private int m_X, m_Y;	
		
	            public GoodiesTimer(Map map, int x, int y)	
	                : base(TimeSpan.FromSeconds(Utility.RandomDouble() * 10.0))	
	            {	
	                m_Map = map;	
	                m_X = x;	
	                m_Y = y;	
	            }	
		
	            protected override void OnTick()	
	            {	
	                int z = m_Map.GetAverageZ(m_X, m_Y);	
	                bool canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false);	
		
	                for (int i = -3; !canFit && i <= 3; ++i)	
	                {	
	                    canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false);	
		
	                    if (canFit)	
	                        z += i;	
	                }	
		
	                if (!canFit)	
	                    return;	
		
	                Gold g = new Gold(1000, 2000);	
		
	                g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map);	
		
	                if (0.5 >= Utility.RandomDouble())	
	                {	
	                    switch (Utility.Random(3))	
	                    {	
	                        case 0: // Fire column	
	                            {	
	                                Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);	
	                                Effects.PlaySound(g, g.Map, 0x208);	
		
	                                break;	
	                            }	
	                        case 1: // Explosion	
	                            {	
	                                Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044);	
	                                Effects.PlaySound(g, g.Map, 0x307);	
		
	                                break;	
	                            }	
	                        case 2: // Ball of fire	
	                            {	
	                                Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052);	
		
	                                break;	
	                            }	
	                    }	
	                }	
	            }	
	        }	
	}
}

Last edited by firepants11; 11-18-2009 at 01:30 AM.
firepants11 is offline   Reply With Quote
Old 11-18-2009, 04:58 PM   #28 (permalink)
Forum Expert
 
Vorspire's Avatar
 
Join Date: Jan 2005
Location: Newcastle, United Kingdom
Age: 23
Posts: 3,159
Send a message via ICQ to Vorspire Send a message via MSN to Vorspire Send a message via Skype™ to Vorspire
Default

Quote:
Originally Posted by Murzin View Post
its not pointless, it does have merit
Yet you still provide no evidence as to why it has merit?
You seem to do a lot of talking with almost nothing to back it up tbh.

Anyhow, MC, the problem lies in the fact that you didn't return the value properly;
Code:
[CommandProperty( AccessLevel.GameMaster )]
public override int HitsMax{ get{ return 65000; } }
It's going to have to be either 30000 OR 65000, unless you want to describe the special state that would cause it to chose between the two?
__________________
Criticism should not be the cause of anger. -Dominik Seifert
Vorspire is offline   Reply With Quote
Old 11-19-2009, 04:20 PM   #29 (permalink)
Lurker
 
Join Date: Aug 2007
Posts: 23
Default

Thank you Vorspire, and there is no need to fight over something! especially cause it my script (Giving credit to all of you who helped.) And it makes me feel like it my fault
firepants11 is offline   Reply With Quote
Old 11-19-2009, 05:12 PM   #30 (permalink)
Forum Expert
 
Vorspire's Avatar
 
Join Date: Jan 2005
Location: Newcastle, United Kingdom
Age: 23
Posts: 3,159
Send a message via ICQ to Vorspire Send a message via MSN to Vorspire Send a message via Skype™ to Vorspire
Default

Quote:
Originally Posted by firepants11 View Post
Thank you Vorspire, and there is no need to fight over something! especially cause it my script (Giving credit to all of you who helped.) And it makes me feel like it my fault
Don't worry, it's not fighting, it's a debate :P
I know Murzin is capable of providing evidence, I just want to know the benefits myself
__________________
Criticism should not be the cause of anger. -Dominik Seifert
Vorspire is offline   Reply With Quote
Old 11-19-2009, 08:31 PM   #31 (permalink)
Master of the Internet
 
Lord_Greywolf's Avatar
 
Join Date: Dec 2005
Posts: 12,197
Send a message via Yahoo to Lord_Greywolf
Default

well the benifits for me (i do not think i went as far as murzin did) where simple
i removed all rem statements and blocks
changed all "4 spaces" (or 3 spaces) into tabs
and condensed up gets sets to 1 line (uless very long ones lol), derial/deser condensed up, etc

by doing that on my old 2.0 ghz slower computer it changed the compile time from 9 minutes to 8 minutes

even though the compiler ignores rem statements, empty spaces, etc
it still has to read them to know when the end of line is, etc

so by removing them, it has less to read when ever it has to read the script itself

also other benifit of doing it is, everything is now in simular coding style, and makes it easier to follow for me
(you can tell different people coded different parts of the runuo scripts by the style used)

then one other thing i did after that that took off an other minute+ was since i use ML, i wen through and removed all of the if AOS, SE & ML checks
and set them up to just do "its choice" and removed the others

both of them took a little bit of work (easier for rem removal using inforapid, etc) but in long run was worth it
__________________
http://www.AoAUO.com

:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :)
Lord_Greywolf is offline   Reply With Quote
Old 11-19-2009, 08:38 PM   #32 (permalink)
Forum Expert
 
Murzin's Avatar
 
Join Date: Nov 2004
Posts: 2,196
Send a message via AIM to Murzin
Default

yup...

by removing all the "white space" it speeds up compile time.

thats really the only benifit. getting rid of all the non-aos code blocks also speeds it up by a lot, even at run-time as its less checks that need to be run, and less code in the memory footprint that will never be used... as... wait for it... never be executed as the core.aos setting never changes except at compile

every charecter gets compiled and read and interpreted at compile, less charecters it has to read and process, faster it goes. while its not a large amount per charecter ( yes, even carriage returns are charecters ), it does take longer.

and i actually find it much faster to find the code blocks im looking for with it all compact rather than spread out.
Murzin is offline   Reply With Quote
Old 11-19-2009, 09:29 PM   #33 (permalink)
Forum Expert
 
Vorspire's Avatar
 
Join Date: Jan 2005
Location: Newcastle, United Kingdom
Age: 23
Posts: 3,159
Send a message via ICQ to Vorspire Send a message via MSN to Vorspire Send a message via Skype™ to Vorspire
Default

2 pretty good valid points there.

As for removing all the Core.AoS checks and removing the redundant code, I did that too :P

Compile time for me is < 30 seconds usually.
__________________
Criticism should not be the cause of anger. -Dominik Seifert
Vorspire is offline   Reply With Quote
Old 11-19-2009, 09:39 PM   #34 (permalink)
Forum Expert
 
Murzin's Avatar
 
Join Date: Nov 2004
Posts: 2,196
Send a message via AIM to Murzin
Default

also what i have done is instead of making a single script for every mobile/item, what i do is group things up into 1-3 scripts...

like my virtue pack/quest has 3 script files...

1 script = base wyrmguard, 1 custom weapon, base elitewyrmguard + 8 derivitive elite wyrmguards
1 script = base virtuedragon + 3 individual virtue dragons
1 script = 11 virtue arties, 8 virtue sigils, quest npc

so inside 3 scripts i have 20 items, 1 quest npc, 12 mobs for players to fight

doing that with full whitespace would be 3 humongus scripts or about 35 normal scripts... shortening them down, each one is about 300-400 lines, and the individual code blocks/methods are very easy to see in case i want to make a change
Murzin is offline   Reply With Quote
Old 11-19-2009, 10:05 PM   #35 (permalink)
Lurker
 
Join Date: Aug 2007
Posts: 23
Thumbs up

No clue what you guys are talking about so I'll let you discuss it
firepants11 is offline   Reply With Quote
Old 11-19-2009, 11:52 PM   #36 (permalink)
Master of the Internet
 
Lord_Greywolf's Avatar
 
Join Date: Dec 2005
Posts: 12,197
Send a message via Yahoo to Lord_Greywolf
Default

firepants11, basicaly that last thing he was talking about is combining simular things into 1 script
(i use that also, for my own use, but not when "explaining" it out to some one)
a good example for you to learn from is look at the ore or ingot scripts, etc, in items/skills items/blacksmithy

see how all the ore scripts are in 1 script instead of 10+ seperate scripts

so doing that with other things helps out a lot also with how fast the compiling goes

my compilings on my main server (when doing full compiling) is about 3 minutes, but i have 15k+ items scripts and 6k+ mobiles (mobiles take a lot more than items do, well seems that way anyways)
i am running it on a 3ghx 13333 bus speed dual core pentium with 4 gigs ram on xp pro

a lot better than the 10+ minutes on the slower computer

(i also have 5 stages of compiling [not counting vb which there is none] - simular to Loki's core mod or jeff's versioning system)
__________________
http://www.AoAUO.com

:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :)
Lord_Greywolf is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5