Full Version : Adding animations and sayings onto items
xmlspawner >>Scripting Support >>Adding animations and sayings onto items


<< Prev | Next >>

Odee- 02-12-2006
Ive been on a few shards that once you equiped an item, it would send you a message on the screen like "The power of the dragon surges through you". It also showed the animation of a flamestrike spell on the person equipping WITHOUT hurting them and without the spell being cast. How can I do this? If somone could give me an example and where to get the Animation tags that would be cool. Thanks a lot!

I was on RunUO and they helped quite a bit...I just need to know this -
How do I script this? This is what I want ---

CODE


   m.PlaySound( 0x202 );
   m.FixedParticles( 0x376A, 1, 62, 9923, 3, 3, EffectLayer.Waist );
   m.FixedParticles( 0x3779, 1, 46, 9502, 5, 3, EffectLayer.Waist );


Saying

CODE

m.SendMessage("The power of *** surges through you");


Can somone please give me an example to work off of? I know this has somethign to do with OnEquip, but I just dont know how to do this. Thanks for any help smile.gif





ArteGordon- 02-12-2006
that is the code, just add it to the OnEquip method of the item.

The 'm' variable is the mobile. Look at what the equivalent mobile variable is that is passed into the OnEquip method, and refer to that instead of 'm' when you add it.

CODE

 public override bool OnEquip( Mobile from )
 {
// add your code
  return base.OnEquip( from );
 }

Odee- 02-12-2006
Correct me if Im wrong. Heres what I got

CODE

public override bool OnEquip( Mobile from )

{
    OnEquip.PlaySound( 0x202 );
    OnEquip.FixedParticles( 0x376A, 1, 62, 9923, 3, 3, EffectLayer.Waist );
    OnEquip.FixedParticles( 0x3779, 1, 46, 9502, 5, 3, EffectLayer.Waist );
    OnEquip.SendMessage("My Msg Here");
    return base.OnEquip( from );
}



Sorry if I totally messed up. Im not that good at this. Thanks for the help smile.gif

ArteGordon- 02-12-2006
you need to change references like

OnEquip.PlaySound( 0x202 );

to

from.PlaySound( 0x202 );

Those are methods that are defined in the Mobile class, which is why you refer to them like that.

Odee- 02-12-2006
Okay....here goes again. Sorry for stupidity, just trying to learn. I appreciate the help.

CODE

public override bool OnEquip( Mobile from )

{
   from.PlaySound( 0x202 );
   from.FixedParticles( 0x376A, 1, 62, 9923, 3, 3, EffectLayer.Waist );
   from.FixedParticles( 0x3779, 1, 46, 9502, 5, 3, EffectLayer.Waist );
   from.SendMessage("My Msg Here");
   return base.OnEquip( from );
}


Lets hope this time its right laugh.gif I appreciate the help

ArteGordon- 02-12-2006
that looks pretty reasonable.

Odee- 02-12-2006
Error log

CODE

RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (13 errors, 0 warnings)
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS151
9: (line 37, column 3) Invalid token '{' in class, struct, or interface member d
eclaration
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS151
9: (line 38, column 18) Invalid token '(' in class, struct, or interface member
declaration
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS151
9: (line 39, column 23) Invalid token '(' in class, struct, or interface member
declaration
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS151
9: (line 39, column 70) Invalid token ')' in class, struct, or interface member
declaration
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS151
9: (line 40, column 26) Invalid token '(' in class, struct, or interface member
declaration
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS151
9: (line 40, column 73) Invalid token ')' in class, struct, or interface member
declaration
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS151
9: (line 41, column 23) Invalid token '(' in class, struct, or interface member
declaration
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS152
0: (line 42, column 19) Class, struct, or interface method must have a return ty
pe
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS100
1: (line 42, column 33) Identifier expected
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS151
8: (line 47, column 10) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS151
8: (line 51, column 19) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS151
8: (line 57, column 19) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Customs\Weapons & Armor\AlastarsBreastplateofJustice.cs: CS102
2: (line 63, column 1) Type or namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.


Script

CODE

using System;
using Server.Items;

namespace Server.Items
{
[FlipableAttribute( 0x1415, 0x1416 )]
public class AlastarsBreastplateofJustice : PlateChest
{
 public override int BasePhysicalResistance{ get{ return 5; } }
 public override int BaseFireResistance{ get{ return 3; } }
 public override int BaseColdResistance{ get{ return 2; } }
 public override int BasePoisonResistance{ get{ return 3; } }
 public override int BaseEnergyResistance{ get{ return 2; } }

 public override int InitMinHits{ get{ return 50; } }
 public override int InitMaxHits{ get{ return 65; } }

 public override int AosStrReq{ get{ return 95; } }
 public override int OldStrReq{ get{ return 60; } }

 public override int OldDexBonus{ get{ return -8; } }

 public override int ArmorBase{ get{ return 40; } }

 public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Plate; } }

 [Constructable]
 public AlastarsBreastplateofJustice() : base( 0x1415 )
 {
  Weight = 10.0;
  Name = "Alastars Breastplate of Justice";

 
 }
 
 public override bool OnEquip( Mobile from );
 {
  from.PlaySound( 0x202 );
  from.FixedParticles( 0x376A, 1, 62, 9923, 3, 3, EffectLayer.Waist );
     from.FixedParticles( 0x3779, 1, 46, 9502, 5, 3, EffectLayer.Waist );
     from.SendMessage("The Virtue of Justice flows through your veins as you equip the Breastplate");
     return base.OnEquip( from );
 }

 

 public AlastarsBreastplateofJustice( 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();
 }
}
}



This is the part I just added in

public override bool OnEquip( Mobile from );
{
from.PlaySound( 0x202 );
from.FixedParticles( 0x376A, 1, 62, 9923, 3, 3, EffectLayer.Waist );
from.FixedParticles( 0x3779, 1, 46, 9502, 5, 3, EffectLayer.Waist );
from.SendMessage("The Virtue of Justice flows through your veins as you equip the Breastplate");
return base.OnEquip( from );
}


Any help would be awesome. Thanks happy.gif

ArteGordon- 02-12-2006
public override bool OnEquip( Mobile from );

no semicolon at the end of that

Odee- 02-12-2006
Okay. Fixed. Scripts will load.

Only problem is that when I try to add the item in-game, it will show this
CODE

Usage:
AlastarsBreastplateofJustice


It will not add the item in-game either.

Heres what RunUO is reading

CODE

RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...done (0 errors, 0 warnings)
Scripts: Compiling VB.net scripts...no files found.
Scripts: Verifying...done (1749 items, 516 mobiles)
World: Loading...done (22 items, 2 mobiles) (1.1 seconds)

UO Architect Server Beta 2.5 is listening on port 2594
Reports: Loading...done
Regions: Loading...done
Address: 127.0.0.1:2593
Address: 192.168.1.101:2593
Client: 127.0.0.1: Connected. [1 Online]
Login: 127.0.0.1: Invalid password for '***'
Client: 127.0.0.1: Disconnected. [1 Online]
Client: 127.0.0.1: Connected. [1 Online]
Login: 127.0.0.1: Valid credentials for '***'
Login: 127.0.0.1: Account '***' at character list
System.NullReferenceException: Object reference not set to an instance of an obj
ect.
  at Server.Items.BaseArmor.GetProperties(ObjectPropertyList list) in c:\Games\
RunUO\RunUO 1.0\Scripts\Items\Armor\BaseArmor.cs:line 1394
  at Server.Item.get_PropertyList()
  at Server.Item.SendInfoTo(NetState state)
  at Server.Item.MoveToWorld(Point3D location, Map map)
  at Server.Scripts.Commands.Add.Build(Mobile from, Point3D start, Point3D end,
ConstructorInfo ctor, Object[] values, String[,] props, PropertyInfo[] realProp
s, ArrayList packs) in c:\Games\RunUO\RunUO 1.0\Scripts\Commands\Add.cs:line 331


CODE

System.NullReferenceException: Object reference not set to an instance of an obj
ect.
  at Server.Items.BaseArmor.GetProperties(ObjectPropertyList list) in c:\Games\
RunUO\RunUO 1.0\Scripts\Items\Armor\BaseArmor.cs:line 1394
  at Server.Item.get_PropertyList()
  at Server.Item.SendInfoTo(NetState state)
  at Server.Item.MoveToWorld(Point3D location, Map map)
  at Server.Scripts.Commands.Add.Build(Mobile from, Point3D start, Point3D end,
ConstructorInfo ctor, Object[] values, String[,] props, PropertyInfo[] realProp
s, ArrayList packs) in c:\Games\RunUO\RunUO 1.0\Scripts\Commands\Add.cs:line 331

I dont know wtf this means. Please help. Thanks smile.gif

ArteGordon- 02-12-2006
the base class for your armor is the PlateChest class.

public AlastarsBreastplateofJustice() : base( 0x1415 )

when you do this, you are calling the PlateChest class constructor with an argument.

There is no such valid constructor. You just end up calling the serial constructo when you do that, and that creates the error.

Your constructor should just look like


public AlastarsBreastplateofJustice()

Odee- 02-12-2006
Cool, your right. All is good now. Just have to add props to the item.

One more quick question = Can I put more than one animation onto it?

Thanks for all the help Arte. smile.gif Ill make sure to make a Rar file and post it once I finished everything for the set. I also have to make the mobile(s) too.

ArteGordon- 02-12-2006
yes, it is possible to add more than one animation.

Odee- 02-12-2006
Okay thats a TON dude. I appreciate it a lot happy.gif