So im trying to make a scroll that gives pets weapon abilitys.
And when i try this it says that BaseVreature dosen't contain weaponability.
Thankful for any help :)
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using System.Collections;
using Server.Gumps;
using Server.Targeting;
using Server.Misc;
using Server.Accounting;
using System.Xml;
using Server.Mobiles;

namespace Server.Items
{
public class BleedingScroll : Item
{
[Constructable]
public BleedingScroll() : base( 0x14F0 )
{
base.Weight = 1.0;
base.Name = "a bleeding scroll";
base.Hue = 0x481;
LootType = LootType.Cursed;
}

public override void OnDoubleClick( Mobile from )
{
if ( IsChildOf( from.Backpack ) )
{
from.Target = new BleedTarget(from, this);
}
else
{
from.SendMessage("That must be in your backpack for you to use it.");
}
}

public BleedingScroll( 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 class BleedTarget : Target
{
private Mobile m_From;
private BleedingScroll m_Deed;

public BleedTarget( Mobile from, BleedingScroll deed ) : base ( 3, false, TargetFlags.None )
{
m_Deed = deed;
m_From = from;
from.SendMessage("Select the companion which you want to enhance.");

}

protected override void OnTarget( Mobile from, object targeted )
{

if (m_Deed.IsChildOf( m_From.Backpack ) )
{
if ( targeted is Mobile )
{
if ( targeted is BaseCreature )
{
BaseCreature creature = (BaseCreature)targeted;
if( !creature.Tamable ){
from.SendMessage("This animal is not tame.");
}
else if( !creature.Controlled || creature.ControlMaster != from ){
from.SendMessage("This is not you animal.");
}
else if( creature.IsDeadPet ){
from.SendMessage("This animal is dead.");
}
else if( creature.Summoned ){
from.SendMessage("You can not enhance a summoned creature defence.");
}
else if( creature.Body.IsHuman ){
from.SendMessage("You can not enhance a humans defence.");
}
else if( creature.IsBonded == false ){
from.SendMessage("You need to bond with your companion to use that.");
}
else if( from.Skills[SkillName.AnimalLore].Base < creature.MinTameSkill ){
from.SendMessage("You do not know enough about your companion to enhance its defence.");
}
else if( creature.WeaponAbility.BleedAttack >= 1 ){
from.SendMessage("You can not enhance your companions anymore.");
}
else{
try{
creature.WeaponAbility.BleedAttack += 1;
from.SendMessage("Your companions defences seems stronger.");
m_Deed.Delete();

Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 );
Effects.PlaySound( from.Location, from.Map, 0x243 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
}
catch{
from.SendMessage("Oh no!");
}
}
}
}
}

}

}

}
 
Weapon Abilities are for Server.Items and not Server.Mobiles. They are applied to weapons and that is why you are getting the error.
 
@Djeryv yes, but they are also present in BaseCreature.
public void SetMagicalAbility(MagicalAbility ability)
{
PetTrainingHelper.GetAbilityProfile(this, true).AddAbility(ability, false);
}

public void SetSpecialAbility(SpecialAbility ability)
{
PetTrainingHelper.GetAbilityProfile(this, true).AddAbility(ability, false);
}

public void SetAreaEffect(AreaEffect ability)
{
PetTrainingHelper.GetAbilityProfile(this, true).AddAbility(ability, false);
}

public void SetWeaponAbility(WeaponAbility ability)
{
PetTrainingHelper.GetAbilityProfile(this, true).AddAbility(ability, false);
}
And in the AbilityProfile under in the pet training folder: Thanks @ParanoiaPhD
using System;
using Server;
using System.Collections.Generic;
using System.Linq;
using Server.Items;

namespace Server.Mobiles
{
[PropertyObject]
public class AbilityProfile
{
[CommandProperty(AccessLevel.GameMaster)]
public MagicalAbility MagicalAbility { get; private set; }

[CommandProperty(AccessLevel.GameMaster)]
public AreaEffect[] AreaEffects { get; private set; }

[CommandProperty(AccessLevel.GameMaster)]
public SpecialAbility[] SpecialAbilities { get; private set; }

[CommandProperty(AccessLevel.GameMaster)]
public WeaponAbility[] WeaponAbilities { get; private set; }

[CommandProperty(AccessLevel.GameMaster)]
public bool TokunoTame { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public int RegenHits { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public int RegenStam { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public int RegenMana { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public int DamageIndex { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public BaseCreature Creature { get; private set; }

public List<object> Advancements { get; private set; }

public AbilityProfile(BaseCreature bc)
{

But i'm still not sure what you mean when you say that they are applied to weapon and that is my i get my error, they can clearly be applied to creatures as well. I'm still greatful for the pointers, i'll keep trying different things :)
 
Is there a way for the animal to equip a weapon, not be given the weapon ability, but the weapon itself? Maybe equip it but not graphically display it?
No idea... probably not... just thinking out loud. :cool:
 
Is there a way for the animal to equip a weapon, not be given the weapon ability, but the weapon itself? Maybe equip it but not graphically display it?
No idea... probably not... just thinking out loud. :cool:
Interesting, but tbh i'm such a programming noob so i woulden't know where to begin with that :)
 
BaseWeapon melee = null;

switch (Utility.Random(2))
{
case 0:
melee = new ColdForgedBlade();
break;
case 1:
melee = new Calm();
break;

}


Theres the code to equip a weapon on the creature, that does not drop with the corpse, tho there is a much easier way to add an ability to a mob.

using Server.Items;

goes into your using and

SetWeaponAbility(WeaponAbility.WhirlwindAttack);
 
Ok, so made a new test one like this:
using System;
using Server;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Misc;
using Server.Mobiles;

namespace Server.Items
{
public class BleedScroll : Item
{
[Constructable]
public BleedScroll() : base( 5360 )
{
base.Weight = 1.0;
base.Name = "An Ancient Pet Attack Scroll";
base.Hue = 0x481;
LootType = LootType.Cursed;
}

public BleedScroll( 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 OnDoubleClick( Mobile from )
{
PlayerMobile mobile = from as PlayerMobile;

if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
else if ( mobile == null || from.Skills[SkillName.AnimalTaming].Base < 110.0 )
{
mobile.SendMessage( "Only an Elder Tamer can learn from this Scroll." );
}
else if ( mobile.SetWeaponAbility(WeaponAbility.BleedAttack) >= 1 );
{
mobile.SendMessage( "You have already learned this knowledge." );
}
else
{
mobile.SetWeaponAbility(WeaponAbility.BleedAttack) += 1;
mobile.SendMessage( "your pet has learned a new attack." );


Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 );
Effects.PlaySound( from.Location, from.Map, 0x243 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );

Delete();
}
}

}

}
But then i get an error:

Scripts: Compiling C# scripts...Failed with: 1 errors, 0 warnings
Errors:
+ Customs/Items/Deeds/Taming Deeds/Special/BleedScroll.cs:
CS1513: Line 55: } expected
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
I don't really see why that is needed. And if i just add one in for shits and giggles i get a shitshow of errors.
Scripts: Compiling C# scripts...Failed with: 1 errors, 0 warnings
Errors:
+ Customs/Items/Deeds/Taming Deeds/Special/BleedScroll.cs:
CS1519: Line 56: Invalid token 'else' in class, struct, or interface member declaration
CS1519: Line 58: Invalid token '(' in class, struct, or interface member declaration
CS8124: Line 58: Tuple must contain at least two elements.
CS1519: Line 58: Invalid token '+=' in class, struct, or interface member declaration
CS1519: Line 59: Invalid token '(' in class, struct, or interface member declaration
CS1031: Line 59: Type expected
CS8124: Line 59: Tuple must contain at least two elements.
CS1026: Line 59: ) expected
CS1519: Line 59: Invalid token '"your pet has learned a new attack."' in class, struct, or interface member declaration
CS1519: Line 62: Invalid token '(' in class, struct, or interface member declaration
CS8124: Line 62: Tuple must contain at least two elements.
CS1026: Line 62: ) expected
CS1519: Line 62: Invalid token ',' in class, struct, or interface member declaration
CS1519: Line 63: Invalid token '(' in class, struct, or interface member declaration
CS1031: Line 63: Type expected
CS1026: Line 63: ) expected
CS1519: Line 63: Invalid token '0x243' in class, struct, or interface member declaration
CS1519: Line 64: Invalid token '(' in class, struct, or interface member declaration
CS1031: Line 64: Type expected
CS8124: Line 64: Tuple must contain at least two elements.
CS1026: Line 64: ) expected
CS1001: Line 64: Identifier expected
CS1031: Line 64: Type expected
CS1001: Line 64: Identifier expected
CS1026: Line 64: ) expected
CS1002: Line 64: ; expected
CS1001: Line 64: Identifier expected
CS1003: Line 64: Syntax error, ',' expected
CS1001: Line 64: Identifier expected
CS1003: Line 64: Syntax error, ',' expected
CS1001: Line 64: Identifier expected
CS1003: Line 64: Syntax error, ',' expected
CS1002: Line 64: ; expected
CS1519: Line 64: Invalid token ',' in class, struct, or interface member declaration
CS1519: Line 64: Invalid token ')' in class, struct, or interface member declaration
CS1519: Line 64: Invalid token ',' in class, struct, or interface member declaration
CS8124: Line 64: Tuple must contain at least two elements.
CS1519: Line 64: Invalid token '255' in class, struct, or interface member declaration
CS1519: Line 65: Invalid token '(' in class, struct, or interface member declaration
CS1031: Line 65: Type expected
CS8124: Line 65: Tuple must contain at least two elements.
CS1026: Line 65: ) expected
CS1001: Line 65: Identifier expected
CS1031: Line 65: Type expected
CS1001: Line 65: Identifier expected
CS1026: Line 65: ) expected
CS1002: Line 65: ; expected
CS1001: Line 65: Identifier expected
CS1003: Line 65: Syntax error, ',' expected
CS1001: Line 65: Identifier expected
CS1003: Line 65: Syntax error, ',' expected
CS1001: Line 65: Identifier expected
CS1003: Line 65: Syntax error, ',' expected
CS1002: Line 65: ; expected
CS1519: Line 65: Invalid token ',' in class, struct, or interface member declaration
CS1519: Line 65: Invalid token ')' in class, struct, or interface member declaration
CS1519: Line 65: Invalid token ',' in class, struct, or interface member declaration
CS8124: Line 65: Tuple must contain at least two elements.
CS1519: Line 65: Invalid token '255' in class, struct, or interface member declaration
CS1519: Line 66: Invalid token '(' in class, struct, or interface member declaration
CS1031: Line 66: Type expected
CS8124: Line 66: Tuple must contain at least two elements.
CS1026: Line 66: ) expected
CS1001: Line 66: Identifier expected
CS1031: Line 66: Type expected
CS1001: Line 66: Identifier expected
CS1026: Line 66: ) expected
CS1002: Line 66: ; expected
CS1001: Line 66: Identifier expected
CS1003: Line 66: Syntax error, ',' expected
CS1001: Line 66: Identifier expected
CS1003: Line 66: Syntax error, ',' expected
CS1001: Line 66: Identifier expected
CS1003: Line 66: Syntax error, ',' expected
CS1002: Line 66: ; expected
CS1519: Line 66: Invalid token ',' in class, struct, or interface member declaration
CS1519: Line 66: Invalid token ')' in class, struct, or interface member declaration
CS1519: Line 66: Invalid token ',' in class, struct, or interface member declaration
CS8124: Line 66: Tuple must contain at least two elements.
CS1519: Line 66: Invalid token '255' in class, struct, or interface member declaration
CS1022: Line 72: Type or namespace definition, or end-of-file expected
CS1022: Line 74: 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.
So i guess it's not only the "}" that is not working properly.
But it hasn't said anything about the WeaponAbility part yet so thats good i guess.
Thanks @DragnMaw .
 
I can't be 100% for sure on this, but something seems a little off.
OnDoubleClick( Mobile from )
PlayerMobile mobile = from as PlayerMobile;

else if ( mobile.SetWeaponAbility(WeaponAbility.BleedAttack) >= 1 );

That would be attempting to change the weapon ability of PlayerMobile, not the pet... I think?
 
Ya i made a misstake there and re did most of it. but i still get some error.

using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using System.Collections;
using Server.Gumps;
using Server.Targeting;
using Server.Misc;
using Server.Accounting;
using System.Xml;
using Server.Mobiles;
using Server.Spells;
using Server.Spells.SkillMasteries;

namespace Server.Items
{
public class BleedScroll : Item
{
[Constructable]
public BleedScroll() : base( 0x14F0 )
{
base.Weight = 1.0;
base.Name = "a Ancient Pet Attack Scroll ";
base.Hue = 0x481;
LootType = LootType.Cursed;
}

public override void OnDoubleClick( Mobile from )
{
if ( IsChildOf( from.Backpack ) )
{
from.Target = new BleedTarget(from, this);
}
else
{
from.SendMessage("That must be in your backpack for you to use it.");
}
}

public BleedScroll( 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 class BleedTarget : Target
{
private Mobile m_From;
private BleedScroll m_Deed;

public BleedTarget( Mobile from, BleedScroll deed ) : base ( 3, false, TargetFlags.None )
{
m_Deed = deed;
m_From = from;
from.SendMessage("Select the companion which offence you want to enhance.");

}

protected override void OnTarget( Mobile from, object targeted )
{

if (m_Deed.IsChildOf( m_From.Backpack ) )
{
if ( targeted is Mobile )
{
if ( targeted is BaseCreature )
{
BaseCreature creature = (BaseCreature)targeted;
if( !creature.Tamable )
{
from.SendMessage("This animal is not tame.");
}
else if( !creature.Controlled || creature.ControlMaster != from)
{
from.SendMessage("This is not your animal.");
}
else if( creature.IsDeadPet )
{
from.SendMessage("This animal is dead.");
}
else if( creature.Summoned )
{
from.SendMessage("You can not teach an attack to a summoned creature");
}
else if( creature.Body.IsHuman )
{
from.SendMessage("You can't teach this attack to a human");
}
else if( creature.IsBonded == false)
{
from.SendMessage("You need to bond with your companion first.");
}
else if( from.Skills[SkillName.AnimalLore].Base < creature.MinTameSkill )
{
from.SendMessage("You don't know enough about your companion to teach that attack");
}
else if( creature.SetWeaponAbility(WeaponAbility.BleedAttack) = true) // I also tried >= 1; but that dident work line: 111
{
from.SendMessage("Your companion already knows how to use that attack");
}
else
{
try
{
creature.SetWeaponAbility(WeaponAbility.BleedAttack) = true; // i also used =+1 dident work line: 119
from.SendMessage("You teach your companion the BleedAttack.");
m_Deed.Delete();

Effects.SendLocationParticles(EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 );
Effects.PlaySound( from.Location, from.Map, 0x243 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
}
catch
{
from.SendMessage("Oh noes!");
}
}
}
}
}
}
}
}

The error i get now is:
Scripts: Compiling C# scripts...Failed with: 1 errors, 0 warnings
Errors:
+ Customs/Items/Deeds/Taming Deeds/Special/AncientPetAttackScroll.cs:
CS0131: Line 111: The left-hand side of an assignment must be a variable, property or indexer
CS0131: Line 119: The left-hand side of an assignment must be a variable, property or indexer
Scripts: One or more scripts failed to compile or no script files were found.
 
Last bit of info I have for you, since I've never tried anything like this, but this is present inside the Pet Training System.

I kept it in formatting, but the relevant functions are inside that file. You should be able to retune it to your system, hopefully without too many problems.

THE FILE NAME IS NOT REAL
 

Attachments

  • AddAbility.cs
    6.3 KB · Views: 15
Back