|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Lurker
Join Date: Aug 2007
Posts: 23
|
Can anyone find why my npc kills me when I attack it, It dies instantly and kills me when it dies. I have searched for a reason but i'm new to scripting
Code:
using System;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 illidanstormrage")]
public class illidanstorms:ChaosDaemon
{
[Constructable]
public illidanstorms() : base()
{
Name = "illidanstormrage";
SetStr (2000) ;
SetDex (2000) ;
SetInt (2000) ;
SetDamage (200) ;
SetDamageType( ResistanceType.Physical,300) ;
SetDamageType( ResistanceType.Cold,20) ;
SetDamageType( ResistanceType.Fire,100) ;
SetDamageType( ResistanceType.Energy,200) ;
SetDamageType( ResistanceType.Poison,200) ;
SetResistance( ResistanceType.Physical,300) ;
SetResistance( ResistanceType.Cold,20) ;
SetResistance( ResistanceType.Fire,100) ;
SetResistance( ResistanceType.Energy,300) ;
SetResistance( ResistanceType.Poison,300) ;
}
public illidanstorms( 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 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(10, 50);
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;
}
}
}
}
}
}
}
|
|
|
|
|
|
#2 (permalink) |
|
Newbie
Join Date: Oct 2009
Posts: 77
|
not sure what you are going for here, but this Line:
public class illidanstorms:ChaosDaemon Makes him a Chaos Daemon, he will attack you because he is a base Monster, and with the stats you gave him a instant kill seems about right. You called him an NPC, so I'm not sure what you want him to do. What kind of NPC is it supposed to be? |
|
|
|
|
|
#4 (permalink) |
|
Newbie
Join Date: Oct 2009
Posts: 77
|
Well, from what I can tell, His Damage has been set to 200, and his strength is 2000, his base damage must be beyond what a normal character is designed for. What is your characters exact HP? If it's not over at least 2200, you will die. Also, his resistances that go over 100 arent necessary. As it stands, only Cold will hurt him as its set to 20. Again, Resists and Damages you have set only need to go to 100, 300% might be multipying the damage, I'd bring those down personally.
|
|
|
|
|
|
#5 (permalink) |
|
Lurker
Join Date: Aug 2007
Posts: 23
|
Ahh ok ok I see I tested it again and he seems to be hitting somewhere around 12million DMG as you said by the multiplying of stats but I still cant find out why he his hitting me when he dies he will only hit me when I kill him
|
|
|
|
|
|
#6 (permalink) |
|
Forum Expert
Join Date: Jan 2006
Location: Look behind you....
Age: 45
Posts: 1,842
|
HHhhmmm.. lets see here..
Code:
SetStr (2000) ; SetDex (2000) ; SetInt (2000) ; SetDamage (200) ; SetDamageType( ResistanceType.Physical,300) ; ![]() May or may not be completely accurate, but I think you get the idea. And I think the Dex can actually be adding to it as well in a way, since at 2k Dex, theres no way the monsters gonna miss anyone. As for the "last gasp" attack, I believe thats normal.
__________________
May you have the strength of eagles' wings, the faith and courage to fly to new heights, and the wisdom of the universe to carry you there. |
|
|
|
|
|
#7 (permalink) |
|
Lurker
Join Date: Aug 2007
Posts: 23
|
I am reducing all the stats and I will begin testing him again, Does anyone know any of the lines the actual Illidan Stormrage (World of Warcraft boss) says. so I can make him say these lines would be nice
Edit: And does anyone know what code I put in to make his hp a certain amount cause he is only at 95 hp... Last edited by firepants11; 11-16-2009 at 10:50 PM. |
|
|
|
|
|
#8 (permalink) |
|
Lurker
Join Date: Aug 2007
Posts: 23
|
Ok here is a new problem I get the error on line 8 heres the error:
RunUO - [www.runuo.com] Version 2.0, Build 2959.20979 Core: Running on .NET Framework Version 2.0.50727 Scripts: Compiling C# scripts...failed (1 errors, 0 warnings) Errors: + Custom/Illidan.cs: CS0116: Line 8: A namespace does not directly contain members such as fields or methods Scripts: One or more scripts failed to compile or no script files were found. - Press return to exit, or R to try again. 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:GargoyleDestroyer
{
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()
{
Name = "Illidan";
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;
}
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;
}
}
}
}
}
}
}
|
|
|
|
|
|
#12 (permalink) |
|
Lurker
Join Date: Aug 2007
Posts: 23
|
Error:
RunUO - [www.runuo.com] Version 2.0, Build 2959.20979 Core: Running on .NET Framework Version 2.0.50727 Scripts: Compiling C# scripts...failed (1 errors, 0 warnings) Errors: + Custom/Illidan.cs: CS0116: Line 7: A namespace does not directly contain members such as fields or methods Scripts: One or more scripts failed to compile or no script files were found. - Press return to exit, or R to try again. Edited code: 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()
{
Name = "Illidan";
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;
}
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;
}
}
}
}
}
}
}
|
|
|
|
|
|
#13 (permalink) |
|
Forum Novice
|
its telling you your not telling it ANYTHING about what it is its speed its AI what it looks like its all empty
[Constructable] public Illidan() : base() //you have to have info in here man { Name = "Illidan"; SetStr (20) ; SetDex (20) ; look at this [Constructable] // this tells it its a mage AI it attacks closest target range is 10 and its speeds public Diablo () : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 ) { Name = "Diablo"; Body = 102; // this is what it looks like you need to get the ID of the mob you want BaseSoundID = 357; // this is the mobs sound it makes Hue = 1157; // this is its color with out this it will be default color all this info has to be present for the script to know what it is how it acts what it does ALSO you have no skills on this monster under this section SetResistance( ResistanceType.Physical,10) ; SetResistance( ResistanceType.Cold,20) ; SetResistance( ResistanceType.Fire,20) ; SetResistance( ResistanceType.Energy,1) ; SetResistance( ResistanceType.Poison,10) ; you need to add something like this SetSkill( SkillName.Anatomy, 100.0, 120.0 ); SetSkill( SkillName.EvalInt, 90.1, 110.0 ); SetSkill( SkillName.Magery, 95.5, 110.0 ); SetSkill( SkillName.Meditation, 65.1, 90.0 ); SetSkill( SkillName.MagicResist, 100.5, 150.0 ); SetSkill( SkillName.Tactics, 100.0, 120.0 ); SetSkill( SkillName.Wrestling, 100.0, 120.0 ); also your resist are low but if thats ment to be thats fine but you can also do something like this.... this will make the resist more random per say phy will be 10-50 could be 36 or what not but thats up to you just a suggestion SetResistance( ResistanceType.Physical,10,50) ; SetResistance( ResistanceType.Cold,20,50) ; SetResistance( ResistanceType.Fire,20,50) ; SetResistance( ResistanceType.Energy,1,10) ; SetResistance( ResistanceType.Poison,10,50) ; this should take care of ya i think |
|
|
|
|
|
#16 (permalink) |
|
Lurker
Join Date: Aug 2007
Posts: 23
|
Mmmm It gave me the same error as last time
I think im just adding the code wrong or messing it up to much ![]() 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;
}
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;
}
}
}
}
}
}
}
|
|
|
|
|
|
#17 (permalink) |
|
Forum Novice
|
hmmm man i dont know i would try to remove your speech bool you can add something like this instead
HTML Code:
{
public static TimeSpan TalkDelay = TimeSpan.FromSeconds( 5.0 ); //the delay between talks is 10 seconds
public DateTime m_NextTalk;
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( DateTime.Now >= m_NextTalk && InRange( m, 4 ) && InLOS( m ) ) // check if it's time to talk & mobile in range & in los.
{
m_NextTalk = DateTime.Now + TalkDelay; // set next talk time
if (m.Hidden == false)
switch ( Utility.Random( 1 ))
{
case 0: Say("Hey" + m.Name + "You are not Prepared!"); //make it say ...
break;
case 0: Say("Foolish mortals you think you can defeat me!"); //make it say ...
break;
case 1: Say("MUAHAHAHA! You will all die!!"); //make it say ...
break;
case 2: Say("Hey" + m.Name + "You are not Prepared!"); //make it say ...
break;
case 2: Say("Ha" + m.Name + "I will paint my face with your blood!!"); //make it say ...
break;
};
}
}
HTML 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
{
public static TimeSpan TalkDelay = TimeSpan.FromSeconds( 5.0 ); //the delay between talks is 5 seconds
public DateTime m_NextTalk;
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( DateTime.Now >= m_NextTalk && InRange( m, 4 ) && InLOS( m ) ) // check if it's time to talk & mobile in range & in los.
{
m_NextTalk = DateTime.Now + TalkDelay; // set next talk time
if (m.Hidden == false)
switch ( Utility.Random( 4 ))
{
case 0: Say("Hey" + m.Name + "You are not Prepared!"); //make it say ...
break;
case 1: Say("Foolish mortals you think you can defeat me!"); //make it say ...
break;
case 2: Say("MUAHAHAHA! You will all die!!"); //make it say ...
break;
case 3: Say("Ha" + m.Name + "I will paint my face with your blood!!"); //make it say ...
break;
};
}
}
[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;
}
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 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;
}
}
}
}
}
}
}
|
|
|
|
|
|
#19 (permalink) |
|
Forum Novice
Join Date: Sep 2009
Location: endtimes.no-ip.biz ;2593
Posts: 237
|
take a preexisting script and start small.
The Chaos Demon script...................... Code:
using System;
using System.Collections;
using Server.Items;
using Server.Targeting;
namespace Server.Mobiles
{
[CorpseName( "a Firepants11 corpse" )]
public class Firepants11 : BaseCreature
{
[Constructable]
public Firepants11() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Name = "Firepants 11";
Body = 689;
BaseSoundID = 0x3E9;
SetStr( 706, 830 );
SetDex( 91, 150 );
SetInt( 156, 180 );
SetHits( 391, 410 );
SetDamage( 44, 57 );
SetDamageType( ResistanceType.Physical, 55 );
SetDamageType( ResistanceType.Energy 15 );
SetDamageType( ResistanceType15 );.Fire 15 );
SetDamageType( ResistanceType15 );.Cold 15 );
SetResistance( ResistanceType.Physical, 50, 80 );
SetResistance( ResistanceType.Fire, 60, 80 );
SetResistance( ResistanceType.Cold, 70, 80 );
SetResistance( ResistanceType.Poison, 20, 30 );
SetResistance( ResistanceType.Energy, 20, 80 );
SetSkill( SkillName.MagicResist, 85.1, 95.0 );
SetSkill( SkillName.Tactics, 70.1, 80.0 );
SetSkill( SkillName.Wrestling, 95.1, 100.0 );
SetSkill( SkillName.Magery, 95.1, 100.0 );
SetSkill( SkillName.EvalInt, 95.1, 100.0 );
SetSkill( SkillName.AnimalLore, 164.0, 200.0 );
SetSkill( SkillName.AnimalTaming, 190.0, 200.0 );
SetSkill( SkillName.Veterinary, 165.0, 188.0 );
Fame = 17000;
Karma = -17000;
VirtualArmor = 65;
Tamable = true;
ControlSlots = 6;
MinTameSkill = 193.9;
}
public override void GenerateLoot()
{
AddLoot( LootPack.Average );
AddLoot( LootPack.Meager );
AddLoot( LootPack.Rich );
AddLoot( LootPack.Gems, 8 );
}
public override bool ReacquireOnMovement{ get{ return !Controlled; } }
public override bool HasBreath{ get{ return true; } } // fire breath enabled
public override bool AutoDispel{ get{ return !Controlled; } }
public override int TreasureMapLevel{ get{ return 4; } }
public override bool CanAngerOnTame { get { return true; } }
public override FoodType FavoriteFood{ get{ return FoodType.SushiRolls; } }
public Firepants11( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
Ended up removing its gaining a weapoin skill move. Added alot of things it couldn't do. Made it tamable with conditions. names it. makes its favorit food. makes it very hungry all the time. start with little tweaks and look at alot of other scripts. Learn to combine them..
__________________
Because sometimes you have to fight the evil, and sometimes you have to be the evil
![]() Last edited by Stygian Stalker; 11-17-2009 at 02:25 AM. |
|
|
|
|
|
#20 (permalink) |
|
Forum Novice
Join Date: Oct 2009
Age: 24
Posts: 133
|
*face palm*
change Code:
using Server.Engines.CannedEvil;; Code:
using Server.Engines.CannedEvil; that is your error 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;
}
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;
}
}
}
}
}
}
}
__________________
Seriously, don't take me seriously, unless i tell you i am being serious, i am not, seriously. |
|
|
|
|
|
#21 (permalink) |
|
Forum Novice
|
HAHA how did i overlook that good find
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; there thats them all fixed you also did not have ; behind server |
|
|
|
|
|
#22 (permalink) |
|
Forum Expert
|
It actually doesn't matter how many of the ';' character there are, it represents a code-escape to the compiler, so having multiple ';' will still compile.
However, not having a ';' as you see, will cause it to throw errors ![]() Here's a tip, if you want to keep your code tidy (when word wrapping is off), whitespace is pretty much completely removed at compile time, so the code below would still compile; Code:
public class MyClass
{
public MyClass()
{ }
public override void ToString()
{
return String.Format("Type: {0} | HashCode: {1}",
this.GetType().FullName,
this.GetHashCode()
);
}
}
Code:
public class MyClass{public MyClass(){}public override void ToString(){return String.Format("Type: {0} | HashCode: {1:X8}",this.GetType().FullName,this.GetHashCode());}}
__________________
[_] The Care Box is empty :( Last edited by Vorspire; 11-17-2009 at 10:51 AM. |
|
|
|
|
|
#23 (permalink) |
|
Forum Expert
|
yup, if you want to see "shorthand" code with a lot of the white space removed, look at my teleport book...
if you expand it all the way out its like 1500 lines, but i have it in like 300 lines all proper indention and line seperation do is make it easier to see where your errors are and the logic flow. once you get all those problems done, you can actually eliminate all the white space |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|