Tim

Member
Hello i was wanting to create personal trainers other then the cow . I have a personal cow trainer deed i moded to do this but a couple of lines of code i didn't change. Maybe some one could tell me what is happening with the script and if i need to change the word cow so the server would not run into for seen problems? It does work with the way it is though!

using System;
using System.Collections;
using Server.Items;
using Server.Mobiles;
using Server.Misc;
using Server.Network;
namespace Server.Items
{
public class PersonalAgentSmith : Item // Create the item class which is derived from the base item class
{
[Constructable]
public PersonalAgentSmith () : base( 0x14F0 )
{
Weight = 1.0;
Name = "A Personal Trainer AgentSmith Deed";
LootType = LootType.Blessed;
}
public PersonalAgentSmith(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 );
LootType = LootType.Blessed;
int version = reader.ReadInt();
}
public override bool DisplayLootType{ get{ return false; } }
public override void OnDoubleClick( Mobile from ) // Override double click of the deed to call our target
{
if ( !IsChildOf( from.Backpack ) ) // Make sure its in their pack
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
else
{
this.Delete();
from.SendMessage( "You created your Personal Trainer" );
AgentSmith cow = new AgentSmith();
cow.Map = from.Map;
cow.Location = from.Location;

cow.Controlled = false;

}
}
}
}
 
In the code you shared, the word "cow" is a variable, you could change it to ajshdyvnas and as long as you used that same name in each of the locations, it would work the same.

That being said, usually you want your variable names to have some meaning, so when you read the code later you know what type of information they are storing.
 
In the code you shared, the word "cow" is a variable, you could change it to ajshdyvnas and as long as you used that same name in each of the locations, it would work the same.

That being said, usually you want your variable names to have some meaning, so when you read the code later you know what type of information they are storing.
Thank you so much that explains aLot in other scripts also . Thank thank you
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back