|
||
|
|||||||
| Server Support on Windows Get (and give) support on general questions related to the RunUO server itself. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#3 (permalink) |
|
Join Date: Mar 2005
Age: 17
Posts: 132
|
I've been trying for 2 days to take it out...so much errors all the time.
Can you tell me which part should I remove or edit,please? I don't know what to do with GoodiesTimer. Thank you in advanced, Take Care -Edit- I'd like to keep the fireworks animation just no gold around the champs' corpse. |
|
|
|
|
|
#5 (permalink) |
|
Join Date: Apr 2005
Age: 23
Posts: 46
|
I recommend all low bandwidth servers do this! Especially when you have 35 players on average all of which enjoy running the champs. That many items and effects going on at once can cause a lag spike. =-) (Every little thing can help) (Unfortunatelly I have spells which use a lot of bandwidth) And thanks Geezer you get Rep!
|
|
|
|
|
|
#6 (permalink) |
|
Forum Expert
Join Date: Oct 2003
Location: Minnesota... somewhere in the boonies
Age: 29
Posts: 1,171
|
Bleach is right about this one, I just changed it to give all players a percentage of the gold (based upon how much damage they have done) as a check in their packs.
__________________
Signatures are tools of the devil... |
|
|
|
|
|
#8 (permalink) |
|
Forum Expert
|
%RUODirectory%/scripts/mobiles/special is a good place to start looking
![]()
__________________
In the end we are faced with ourself. Look in the mirror and you see a reflection of the obvious, look through it and past the reflection to see the truth. Can you see it? What is it telling you? |
|
|
|
|
|
#9 (permalink) |
|
Join Date: Mar 2005
Age: 17
Posts: 132
|
Erm THANKS GUYS!
Though ummm how do I comment out codes? I have 1% knowledge in coding...and that is to open them with notepad and scratch my head. can anyone kindly please teach me this?I hope it won't take long to learn.... Thanks in advanced again ! |
|
|
|
|
|
#10 (permalink) |
|
Forum Novice
Join Date: Apr 2005
Age: 39
Posts: 233
|
Commenting out code can be done a couple of ways. It tells the compiler to ignore any lines which are not needed, or allows the scripter to put notes in the script so he/she knows what is going on.
To comment out a single line, you simply put // at the beginning of the line. The compiler will ignore anything that follows // on that line of the script. This also means you can add // after the ; at the end of the line to make a comment for yourself. Example. Code:
from.SendMessage( "This text will be shown to the mobile from." );
// from.SendMessage( "This line is commented out and wont be compiled." );
from.SendMessage( "This will show.'); // But this bit will be ignored.
Enclosing the section in /* and */ tells the compiler to ignore everything between those marks. This can be text or script, it doesn't matter. Example. Code:
/* This text will be ignored because it is contained within the marks
as shown above.
Anything can be placed between them, as long as there are a complete
set of opening and closing marks.
*/
SetDamageType( ResistanceType.Physical, 100 );
SetDamageType( ResistanceType.Cold, 100 );
SetResistance( ResistanceType.Physical, 35, 40 );
/*
SetResistance( ResistanceType.Fire, 25, 35 );
SetResistance( ResistanceType.Cold, 100, 100 );
SetResistance( ResistanceType.Poison, 25, 35 );
SetResistance( ResistanceType.Energy, 25, 35 );
*/
|
|
|
|
|
|
#11 (permalink) |
|
Join Date: Mar 2005
Age: 17
Posts: 132
|
Hello
Thanks for teaching me how to comment out stuff. I commented this out: Code:
//Gold g = new Gold( 500, 1000 ); //g.MoveToWorld( new Point3D( m_X, m_Y, z ), m_Map ); Code:
RunUO - [www.runuo.com] Version 1.0.0, Build 36918 Scripts: Compiling C# scripts...failed (10 errors, 0 warnings) - Error: Scripts\Mobiles\Special\BaseChampion.cs: CS0246: (line 188, column 58) The type or namespace name 'g' could not be found (are you missing a using dire ctive or an assembly reference?) - Error: Scripts\Mobiles\Special\BaseChampion.cs: CS0246: (line 188, column 70) The type or namespace name 'g' could not be found (are you missing a using dire ctive or an assembly reference?) - Error: Scripts\Mobiles\Special\BaseChampion.cs: CS0103: (line 189, column 27) The name 'g' does not exist in the class or namespace 'Server.Mobiles.BaseChamp ion.GoodiesTimer' - Error: Scripts\Mobiles\Special\BaseChampion.cs: CS0246: (line 189, column 30) The type or namespace name 'g' could not be found (are you missing a using dire ctive or an assembly reference?) - Error: Scripts\Mobiles\Special\BaseChampion.cs: CS0246: (line 195, column 58) The type or namespace name 'g' could not be found (are you missing a using dire ctive or an assembly reference?) - Error: Scripts\Mobiles\Special\BaseChampion.cs: CS0246: (line 195, column 70) The type or namespace name 'g' could not be found (are you missing a using dire ctive or an assembly reference?) - Error: Scripts\Mobiles\Special\BaseChampion.cs: CS0103: (line 196, column 27) The name 'g' does not exist in the class or namespace 'Server.Mobiles.BaseChamp ion.GoodiesTimer' - Error: Scripts\Mobiles\Special\BaseChampion.cs: CS0246: (line 196, column 30) The type or namespace name 'g' could not be found (are you missing a using dire ctive or an assembly reference?) - Error: Scripts\Mobiles\Special\BaseChampion.cs: CS0246: (line 202, column 58) The type or namespace name 'g' could not be found (are you missing a using dire ctive or an assembly reference?) - Error: Scripts\Mobiles\Special\BaseChampion.cs: CS0246: (line 202, column 70) The type or namespace name 'g' could not be found (are you missing a using dire ctive or an assembly reference?) Scripts: One or more scripts failed to compile or no script files were found. - Press return to exit, or R to try again. ![]() |
|
|
|
|
|
#13 (permalink) |
|
Join Date: Mar 2005
Age: 17
Posts: 132
|
Hello again,
I'm sorry for the uber late reply! I was busy lately ![]() So here's my Base Champion.cs Code:
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Engines.CannedEvil;
namespace Server.Mobiles
{
public abstract class BaseChampion : BaseCreature
{
public BaseChampion( AIType aiType ) : this( aiType, FightMode.Closest )
{
}
public BaseChampion( AIType aiType, FightMode mode ) : base( aiType, mode, 18, 1, 0.1, 0.2 )
{
}
public BaseChampion( Serial serial ) : base( serial )
{
}
public abstract ChampionSkullType SkullType{ get; }
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 void GivePowerScrolls()
{
if ( Map != Map.Felucca )
return;
ArrayList toGive = new ArrayList();
ArrayList rights = BaseCreature.GetLootingRights( this.DamageEntries, this.HitsMax );
for ( int i = rights.Count - 1; i >= 0; --i )
{
DamageStore ds = (DamageStore)rights[i];
if ( ds.m_HasRight )
toGive.Add( ds.m_Mobile );
}
if ( toGive.Count == 0 )
return;
// Randomize
for ( int i = 0; i < toGive.Count; ++i )
{
int rand = Utility.Random( toGive.Count );
object hold = toGive[i];
toGive[i] = toGive[rand];
toGive[rand] = hold;
}
for ( int i = 0; i < 6; ++i )
{
int level;
double random = Utility.RandomDouble();
if ( 0.1 >= random )
level = 20;
else if ( 0.4 >= random )
level = 15;
else
level = 10;
Mobile m = (Mobile)toGive[i % toGive.Count];
PowerScroll ps = PowerScroll.CreateRandomNoCraft( level, level );
m.SendLocalizedMessage( 1049524 ); // You have received a scroll of power!
m.AddToBackpack( ps );
if ( m is PlayerMobile )
{
PlayerMobile pm = (PlayerMobile)m;
for ( int j = 0; j < pm.JusticeProtectors.Count; ++j )
{
Mobile prot = (Mobile)pm.JusticeProtectors[j];
if ( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( m, prot ) )
continue;
int chance = 0;
switch ( VirtueHelper.GetLevel( prot, VirtueName.Justice ) )
{
case VirtueLevel.Seeker: chance = 60; break;
case VirtueLevel.Follower: chance = 80; break;
case VirtueLevel.Knight: chance = 100; break;
}
if ( chance > Utility.Random( 100 ) )
{
prot.SendLocalizedMessage( 1049368 ); // You have been rewarded for your dedication to Justice!
prot.AddToBackpack( new PowerScroll( ps.Skill, ps.Value ) );
}
}
}
}
}
public override bool OnBeforeDeath()
{
if ( !NoKillAwards )
{
GivePowerScrolls();
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 )
c.DropItem( new ChampionSkull( SkullType ) );
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( 500, 1000 );
//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;
}
}
}
}
}
}
}
![]() |
|
|
|
|
|
#14 (permalink) |
|
Forum Novice
Join Date: Apr 2005
Age: 39
Posts: 233
|
OK, the completed script is below.
The red sections are what I changed. Code:
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Engines.CannedEvil;
namespace Server.Mobiles
{
public abstract class BaseChampion : BaseCreature
{
public BaseChampion( AIType aiType ) : this( aiType, FightMode.Closest )
{
}
public BaseChampion( AIType aiType, FightMode mode ) : base( aiType, mode, 18, 1, 0.1, 0.2 )
{
}
public BaseChampion( Serial serial ) : base( serial )
{
}
public abstract ChampionSkullType SkullType{ get; }
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 void GivePowerScrolls()
{
if ( Map != Map.Felucca )
return;
ArrayList toGive = new ArrayList();
ArrayList rights = BaseCreature.GetLootingRights( this.DamageEntries, this.HitsMax );
for ( int i = rights.Count - 1; i >= 0; --i )
{
DamageStore ds = (DamageStore)rights[i];
if ( ds.m_HasRight )
toGive.Add( ds.m_Mobile );
}
if ( toGive.Count == 0 )
return;
// Randomize
for ( int i = 0; i < toGive.Count; ++i )
{
int rand = Utility.Random( toGive.Count );
object hold = toGive[i];
toGive[i] = toGive[rand];
toGive[rand] = hold;
}
for ( int i = 0; i < 6; ++i )
{
int level;
double random = Utility.RandomDouble();
if ( 0.1 >= random )
level = 20;
else if ( 0.4 >= random )
level = 15;
else
level = 10;
Mobile m = (Mobile)toGive[i % toGive.Count];
PowerScroll ps = PowerScroll.CreateRandomNoCraft( level, level );
m.SendLocalizedMessage( 1049524 ); // You have received a scroll of power!
m.AddToBackpack( ps );
if ( m is PlayerMobile )
{
PlayerMobile pm = (PlayerMobile)m;
for ( int j = 0; j < pm.JusticeProtectors.Count; ++j )
{
Mobile prot = (Mobile)pm.JusticeProtectors[j];
if ( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( m, prot ) )
continue;
int chance = 0;
switch ( VirtueHelper.GetLevel( prot, VirtueName.Justice ) )
{
case VirtueLevel.Seeker: chance = 60; break;
case VirtueLevel.Follower: chance = 80; break;
case VirtueLevel.Knight: chance = 100; break;
}
if ( chance > Utility.Random( 100 ) )
{
prot.SendLocalizedMessage( 1049368 ); // You have been rewarded for your dedication to Justice!
prot.AddToBackpack( new PowerScroll( ps.Skill, ps.Value ) );
}
}
}
}
}
public override bool OnBeforeDeath()
{
if ( !NoKillAwards )
{
GivePowerScrolls();
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 )
c.DropItem( new ChampionSkull( SkullType ) );
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;
// Set gold amount to 1 so it wouldn't show up
Gold g = new Gold( 1,1 );
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;
}
}
}
g.Delete(); // Deleted the 1 piece of gold }
}
}
}
We could have edited loads more code and got the same effect, but that's just silly Hope that's what you wanted. ![]() |
|
|
|
|
|
#17 (permalink) |
|
Forum Expert
Join Date: May 2005
Age: 23
Posts: 274
|
hello i need help on this champ spawn thing how can i set the amount of gold? Here is rikktor
using System; using System.Collections; using Server; using Server.Items; using Server.Spells; using Server.Engines.CannedEvil; namespace Server.Mobiles { public class Rikktor : BaseChampion { public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Power; } } [Constructable] public Rikktor() : base( AIType.AI_Melee ) { Body = 172; Name = "Rikktor"; SetStr( 701, 900 ); SetDex( 201, 350 ); SetInt( 51, 100 ); SetHits( 3000 ); SetStam( 203, 650 ); SetDamage( 28, 55 ); SetDamageType( ResistanceType.Physical, 25 ); SetDamageType( ResistanceType.Fire, 50 ); SetDamageType( ResistanceType.Energy, 25 ); SetResistance( ResistanceType.Physical, 80, 90 ); SetResistance( ResistanceType.Fire, 80, 90 ); SetResistance( ResistanceType.Cold, 30, 40 ); SetResistance( ResistanceType.Poison, 80, 90 ); SetResistance( ResistanceType.Energy, 80, 90 ); SetSkill( SkillName.Anatomy, 100.0 ); SetSkill( SkillName.MagicResist, 140.2, 160.0 ); SetSkill( SkillName.Tactics, 100.0 ); Fame = 22500; Karma = -22500; VirtualArmor = 130; } public override void GenerateLoot() { AddLoot( LootPack.UltraRich, 3 ); } public override Poison PoisonImmune{ get{ return Poison.Lethal; } } public override ScaleType ScaleType{ get{ return ScaleType.All; } } public override int Scales{ get{ return 20; } } public override void OnGaveMeleeAttack( Mobile defender ) { base.OnGaveMeleeAttack( defender ); if ( 0.1 >= Utility.RandomDouble() ) Earthquake(); } public void Earthquake() { Map map = this.Map; if ( map == null ) return; ArrayList targets = new ArrayList(); foreach ( Mobile m in this.GetMobilesInRange( 8 ) ) { if ( m == this || !CanBeHarmful( m ) ) continue; if ( m is BaseCreature && (((BaseCreature)m).Controled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team) ) targets.Add( m ); else if ( m.Player ) targets.Add( m ); } PlaySound( 0x2F3 ); for ( int i = 0; i < targets.Count; ++i ) { Mobile m = (Mobile)targets[i]; double damage = m.Hits * 0.6; if ( damage < 10.0 ) damage = 10.0; else if ( damage > 75.0 ) damage = 75.0; DoHarmful( m ); AOS.Damage( m, this, (int)damage, 100, 0, 0, 0, 0 ); if ( m.Alive && m.Body.IsHuman && !m.Mounted ) m.Animate( 20, 7, 1, true, false, 0 ); // take hit } } public override int GetAngerSound() { return Utility.Random( 0x2CE, 2 ); } public override int GetIdleSound() { return 0x2D2; } public override int GetAttackSound() { return Utility.Random( 0x2C7, 5 ); } public override int GetHurtSound() { return 0x2D1; } public override int GetDeathSound() { return 0x2CC; } public Rikktor( 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(); } } } |
|
|
|
|
|
#18 (permalink) |
|
Forum Novice
|
Well shadow from what I've seen there isn't really anything in the script to edit to change the gold drop... either I'm just blind or stupid or you're in the wrong script.. even though it seems to me that you shouldn't be.. lmao..
But please.. do us all a favor and type [c ode] in front of the "using System;" line and type [/c ode] at the end of the script.. BUT remove the spaces.... I only added the spaces so that it wouldn't put the command into effect... PS. This turns your massively large post into one with your script having a scollbar to make it smaller.... It'd be of better help.. lolThanks |
|
|
|
|
|
#19 (permalink) | |
|
Forum Expert
Join Date: Mar 2004
Location: NorthCentral IL, USA
Age: 35
Posts: 3,848
|
its in BaseChampion not in the champions themselves.
__________________
Quote:
Just a Simple Staff Tool You can leave me messages. Ernest Gary Gygax - Quote "I would like the world to remember me as the guy who really enjoyed playing games and sharing his knowledge and his fun pastimes with everybody else." |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|