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!

Can you make a static follow a mobile?

Can you make a static follow a mobile?

Can you make a static follow a mobile?

I wanna make an explosion spell follow a balron or something. :p
 

Phantom

Knight
Sure it posssible, as long as it doesn't go against the client, its possible.

1) ie 2 strings in a property list.

Use LocationChange on the item, link the item to the mobile using a Mobile property and make it follow the Mobile.
 

Swaileh

Wanderer
It means link the item to the mobile, and in the Mobile's OnMove override, move the item along with it.. using 'item.Location = this.Location;'
 

Phantom

Knight
A monster that does it?

No there isn't

There is code for OnLocationChange used for other stuff, I had to figured it out for something I was working on.
 
I still don't get it...

I'm still not following... which is why i wanted an example...
[code:1]
OnMove public override Balrogflame.Location = Gothmog.Location
[/code:1]
For the .Location, would i put like (x, y, z) or something? I keep getting 3 errors... and do i put it in the Item's script. Or the Mobile's script...
 

Phantom

Knight
Thats not the method I suggested.

use OnLocationChange

Look at some of the code other classes use. BaseHouse is one :)
 
Help?

No, it's just that, that was the first time someone actually answered my question... i asked for an example it was in.

EDIT:

Okay... here's the code i got...
[code:1]
public override void OnLocationChange( Point3D oldLocation )
{
int x = Balrogflame.Location.X - oldLocation.X;
int y = Balrogflame.Location.Y - oldLocation.Y;
int z = Balrogflame.Location.Z - oldLocation.Z;
if ( m_Balrogflame != null && !m_Balrogflame.Deleted )
m_Balrogflame.Location = new Point3D( m_Balrogflame.X + x, m_Balrogflame.Y + y, m_Balrogflame.Z + z );
}
[/code:1]

And here's the error...
[code:1]
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Custom\Gothmog.cs: CS0507: (line 56, column 24) 'Server.Mobile
s.Gothmog.OnLocationChange(Server.Point3D)': cannot change access modifiers when
overriding 'protected' inherited member 'Server.Mobile.OnLocationChange(Server.
Point3D)'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
[/code:1]

This got me like completely lost... 'Server.Mobile.OnLocationChange(Server.Point3D) I think i'm having it move my Gothmog (The mobile) instead of it's fire...maybe... Can someone please help?
 

Swaileh

Wanderer
[code:1] public override void OnLocationChange( Point3D oldLocation )
{
if ( m_Balrogflame != null && !m_Balrogflame.Deleted )
m_Balrogflame.Location = this.Location;
}
[/code:1]
There you go.. I don't get what you were trying o do subtracted all that mess, as that was a roundabout way of achieving your goal..
 
Thanks!

Thanks a ton! And i'm making the Balrog from Lord of the rings... it's named Gothmog... lol... So i needed fire to follow it... now i can also use this for other things! Like A trash barrel moving around :p lol... Make a ghost town!!! :D lol.
Thanks alot!... But it still dosen't work... :(
[code:1]
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Custom\Gothmog.cs: CS0507: (line 56, column 24) 'Server.Mobile
s.Gothmog.OnLocationChange(Server.Point3D)': cannot change access modifiers when
overriding 'protected' inherited member 'Server.Mobile.OnLocationChange(Server.
Point3D)'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
[/code:1]
 
Here's the code.

Here's the Gothmog.cs code... it's the mobile.

[code:1]
using System;
using Server;
using Server.Items;

namespace Server.Mobiles
{
[CorpseName( "Gothmog's corpse" )]
public class Gothmog : BaseCreature
{
[Constructable]
public Gothmog () : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Name = "Gothmog";
Title = "The strongest of the Demon's of Might";
Body = 40;
Hue = 0x485;
BaseSoundID = 357;

SetStr( 2500, 3500 );
SetDex( 350, 400 );
SetInt( 375, 650 );

SetHits( 750, 1000 );

SetDamage( 25, 40 );

SetDamageType( ResistanceType.Physical, 100 );
SetDamageType( ResistanceType.Fire, 100 );

SetResistance( ResistanceType.Physical, 200, 300 );
SetResistance( ResistanceType.Fire, 250, 550 );
SetResistance( ResistanceType.Cold, 0, 0 );
SetResistance( ResistanceType.Poison, 0 );
SetResistance( ResistanceType.Energy, 25, 50 );

SetSkill( SkillName.Anatomy, 50.0, 95.0 );
SetSkill( SkillName.EvalInt, 100.0, 155.0 );
SetSkill( SkillName.Magery, 100.0, 155.0 );
SetSkill( SkillName.Meditation, 25.0, 90.0 );
SetSkill( SkillName.Tactics, 100.0, 150.0 );
SetSkill( SkillName.Wrestling, 100.0, 150.0 );

Fame = 35000;
Karma = -35000;

VirtualArmor = 150;

PackGold( 5000, 10000 );
PackScroll( 15, 25 );
PackArmor( 10, 10 );
PackWeapon( 15, 15 );
PackWeapon( 15, 15 );
PackSlayer();
}

public override void OnLocationChange( Point3D oldLocation )
{
if ( m_Balrogflame != null && !m_Balrogflame.Deleted )
m_Balrogflame.Location = this.Location;
}
public override bool CanRummageCorpses{ get{ return true; } }
public override Poison PoisonImmune{ get{ return Poison.Deadly; } }
public override int TreasureMapLevel{ get{ return 5; } }
public override int Meat{ get{ return 50; } }

public Gothmog( 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();
}
}
}
[/code:1]
 

Phantom

Knight
public override void OnLocationChange( Point3D oldLocation )
{
if ( m_Balrogflame != null && !m_Balrogflame.Deleted )
m_Balrogflame.Location = base.Location;
}
 
Here's the balrogflame.cs code

It still dosen't work :(... maybe it's with the flame?
[code:1]
using System;
using Server.Network;

namespace Server.Items
{

public class Balrogflame : Item
{
[Constructable]
public Balrogflame() : base( 0x36B1 )
{
Movable = false;
Name = "Balrog's Flame";
}

public Balrogflame( 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();
}
}
}
[/code:1]
Should i change the Movable = false?
 

Ceday

Page
the error says it is not public, it is protected..
just replace "public" with "protected" to get rid of that error. there could be others, i dont know..

btw, where is initializing of m_Balrogflame?
 

Swaileh

Wanderer
He means where is the value m_BalrogFlame set to the corresponding item.. as in, you are lacking 'm_BalrogFlame = someItem;' and you are also lacking 'private BalrogFlame m_BalrogFlame = new BalrogFlame();'
 
Top