View Full Version: Item: Wolfman Potion

RunUO.FR Support > Items > Item: Wolfman Potion


Title: Item: Wolfman Potion
Description: 2e item de la collection DidiWolfman


Didi - November 5, 2003 01:56 AM (GMT)
Une potion qui transforme en loup-garou pendant 10 minutes ?

Potion:
(nouveau fichier: scripts/items/skill items/magicals/potion/Wolfman.cs )

CODE
using System;
using Server;

namespace Server.Items
{
public class GarouPotion : BasePotion
{
 [Constructable]
 public GarouPotion() : base( 0xF06, PotionEffect.TransformGarou )
 {
 Name = "Wolfman Potion";
 Hue = 540;
 }

 public GarouPotion( 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 Drink( Mobile from )
 {
 if (from.BodyValue != 182)
 {      
 Mobiles.IMount mt = from.Mount;

 if ( mt != null )
 {
 mt.Rider = null;
 from.SendMessage( "Votre monture s'agite et vous tombez" );
 }
     WolfTimer timer = new WolfTimer(from);
  timer.Start(); //Il lance le timer
    from.FixedEffect( 0x375A, 10, 15 );
    from.PlaySound( 0x1E7 );
    this.Delete();
    from.PlaySound( 0x2D6 );
    from.AddToBackpack( new Bottle() );
  }
  else
  {
   from.SendMessage( "Boire la potion ne vous à étrangement rien donné" );
   this.Delete();
   from.PlaySound( 0x2D6 );
   from.AddToBackpack( new Bottle() );
  }
 }
}
public class WolfTimer : Timer
{
private Mobile m;

public WolfTimer(Mobile from ) : base
( TimeSpan.FromSeconds (600.0), TimeSpan.FromSeconds (600.0) )
{
m = from;
  from.BodyValue = 182;
  from.HueMod = 542;
  from.Emote("*Se transforme en loup garou*");
  from.Str += 30;
  from.GuildTitle = from.Title;
  from.Title = null;
  from.NameMod = "Loup Garou";
}

protected override void OnTick()
{
  if (m.Female == true)
  {
  m.BodyValue = 401;
  m.Emote("*Redeviens une femme*");
  }
  if (m.Female ==false)
  {
  m.BodyValue = 400;
  m.Emote("*Redeviens un homme*");
  }
 m.HueMod = -1;
 m.Title = m.GuildTitle;
 m.GuildTitle = null;
 m.NameMod = null;
 m.Str -= 30;
 m.PlaySound( 0x209 );
 m.FixedParticles( 0x375A, 1, 30, 9966, 33, 2, EffectLayer.Head );
 m.FixedParticles( 0x37B9, 1, 30, 9502, 43, 3, EffectLayer.Head );
 Stop();

}
}

}


Craftage potion:
(cherchez le bout en bleufoncer et ajoutez le bout en rouge)

scripts/engine/crafty/defAlchemy
(pour pas laisser NightSight et Wolfman seuls, je les ai mis ensemble :P

QUOTE
  // Explosion Potion
  index = AddCraft( typeof( LesserExplosionPotion ), 1044537, 1044555, 5.0, 55.0, typeof( SulfurousAsh ), 1044359, 3, 1044367 );
  AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
  index = AddCraft( typeof( ExplosionPotion ), 1044537, 1044556, 35.0, 85.0, typeof( SulfurousAsh ), 1044359, 5, 1044367 );
  AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
  index = AddCraft( typeof( GreaterExplosionPotion ), 1044537, 1044557, 65.0, 115.0, typeof( SulfurousAsh ), 1044359, 10, 1044367 );
  AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
 
  // Loup Garou Potion
  index = AddCraft( typeof( GarouPotion ), "Special", "Wolfman Potion", 90.0, 103.3, typeof( Bloodmoss), "Blood Moss", 6, "Blood Moss missing !");
  AddRes( index, typeof ( DaemonBlood ), "Deamon Blood", 6, "Daemon Blood missing !" );
  AddRes( index, typeof ( Bone ), "Bone", 4, "Bones missing !" );
  AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
  index = AddCraft( typeof( NightSightPotion ), "Special", "Night Vision Potion", -25.0, 25.0, typeof( SpidersSilk ), "Spider Silk", 1, "Spider Silk Missing" );
  AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );

  }
}
}


Restictions du loup garou:
(cherchez le bout en bleufoncer et ajoutez le bout en rouge)

scripts/mobiles/animals/mount/basemount.cs
QUOTE
if ( from.IsBodyMod && !from.Body.IsHuman || from.BodyValue == 182 )
  {
    if ( Core.AOS ) // You cannot ride a mount in your current form.
    from.SendLocalizedMessage( 1062061 );
    else
    from.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed.

    return;
  }

pour les skill, si vous souhaitez qu'iul ne puisse rien faire suffit d'ajouter une ligne du genre a chauqe skill au bon endroit .. ici par exemple anatomy !
QUOTE
else if ( targeted is Mobile)
    {
                      Mobile targ = (Mobile)targeted;
    if ( from.BodyValue == 182 )
      {
      from.SendMessage( "Il devient très agité en votre présence et vous déconcentre" );
      }
      else {


// Il faut bien-sur fermer le "else" plus bas :P     


    int strMod = targ.Str / 10;
    int dexMod = targ.Dex / 10;


Didi - July 2, 2004 09:06 PM (GMT)
Voila, comme je sais que c'est un de mes premier script et qu'il est bourré de conneries qui peuvent empecher son bon fonctionnement, je le refait tout en le laissant lisible pour les débutants :D
================

Craftage potion:
(cherchez le bout en bleufoncer et ajoutez le bout en rouge)

scripts/engine/crafty/defAlchemy
(pour pas laisser NightSight et Wolfman seuls, je les ai mis ensemble
QUOTE
  // Explosion Potion
  index = AddCraft( typeof( LesserExplosionPotion ), 1044537, 1044555, 5.0, 55.0, typeof( SulfurousAsh ), 1044359, 3, 1044367 );
  AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
  index = AddCraft( typeof( ExplosionPotion ), 1044537, 1044556, 35.0, 85.0, typeof( SulfurousAsh ), 1044359, 5, 1044367 );
  AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
  index = AddCraft( typeof( GreaterExplosionPotion ), 1044537, 1044557, 65.0, 115.0, typeof( SulfurousAsh ), 1044359, 10, 1044367 );
  AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
 
  // Loup Garou Potion
  index = AddCraft( typeof( GarouPotion ), "Special", "Wolfman Potion", 90.0, 103.3, typeof( Bloodmoss), "Blood Moss", 6, "Blood Moss missing !");
  AddRes( index, typeof ( DaemonBlood ), "Deamon Blood", 6, "Daemon Blood missing !" );
  AddRes( index, typeof ( Bone ), "Bone", 4, "Bones missing !" );
  AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
  index = AddCraft( typeof( NightSightPotion ), "Special", "Night Vision Potion", -25.0, 25.0, typeof( SpidersSilk ), "Spider Silk", 1, "Spider Silk Missing" );
  AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );

  }
}
}




Restictions du loup garou:
(cherchez le bout en bleufoncer et ajoutez le bout en rouge)

scripts/mobiles/animals/mount/basemount.cs

QUOTE
if ( from.IsBodyMod && !from.Body.IsHuman || from.BodyValue == 182 )
  {
    if ( Core.AOS ) // You cannot ride a mount in your current form.
    from.SendLocalizedMessage( 1062061 );
    else
    from.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed.

    return;
  }




pour les skill, si vous souhaitez qu'iul ne puisse rien faire suffit d'ajouter une ligne du genre a chauqe skill au bon endroit .. ici par exemple anatomy !

QUOTE
else if ( targeted is Mobile)
    {
                      Mobile targ = (Mobile)targeted;
    if ( from.BodyValue == 182 )
      {
      from.SendMessage( "Il devient très agité en votre présence et vous déconcentre" );
      }
      else {


// Il faut bien-sur fermer le "else" plus bas      


    int strMod = targ.Str / 10;
    int dexMod = targ.Dex / 10;



CODE
using System;
using Server;

namespace Server.Items
{
public class GarouPotion : BasePotion
{
  [Constructable]
  public GarouPotion() : base( 0xF06, PotionEffect.TransformGarou )
  {
   Name = "Wolfman Potion";
   Hue = 540;
  }

  public GarouPotion( 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 Drink( Mobile from )
  {
   if (from.BodyValue != 182)
   {      
    Mobiles.IMount mt = from.Mount;

    if ( mt != null )
    {
     mt.Rider = null;
     from.SendMessage( "Votre monture s'agite et vous tombez" );
    }
       WolfTimer timer = new WolfTimer(from);
     timer.Start(); //Il lance le timer
      from.FixedEffect( 0x375A, 10, 15 );
      from.PlaySound( 0x1E7 );
      this.Delete();
      from.PlaySound( 0x2D6 );
      from.AddToBackpack( new Bottle() );
    }
    else
    {
      from.SendMessage( "Boire la potion ne vous à étrangement rien donné" );
      this.Delete();
      from.PlaySound( 0x2D6 );
      from.AddToBackpack( new Bottle() );
    }
  }
 public class WolfTimer : Timer
 {
  private Mobile m;
  private int Old_Body;
  private int Old_Hue;
  private string Old_Title;
  private string Old_GuildTitle;
  private string Old_Name;
 
  private void SaveData( Mobile from )
  {
   Old_Body = from.BodyValue;
   Old_Hue = from.Hue;
   Old_Title = from.Title;
   Old_GuildTitle = from.GuildTitle;
   Old_Name = from.Name;
  }
  private void SetData( Mobile from )
  {
   from.BodyValue = 182;
   from.Hue = 542;
   from.Title = null;
   from.GuildTitle = null;
   from.Name = "Loup Garou";    
  }
  private void LoadData( Mobile from )
  {
   from.BodyValue = Old_Body;
   from.Hue = Old_Hue;
   from.Title = Old_Title;
   from.GuildTitle = Old_GuildTitle;
   from.Name = Old_Name;
  }

  public WolfTimer(Mobile from ) : base( TimeSpan.FromSeconds (600.0), TimeSpan.FromSeconds (600.0) )
  {
   m = from;
   SaveData( from );
   SetData( from );
     from.Emote("*Se transforme en loup garou*");
     from.Str += 30;
  }

  protected override void OnTick()
  {
   LoadData( m );
   m.Emote("*Redeviens un" + (m.Female ? "e femme*" : " homme");
    m.Str -= 30;
    m.PlaySound( 0x209 );
    m.FixedParticles( 0x375A, 1, 30, 9966, 33, 2, EffectLayer.Head );
    m.FixedParticles( 0x37B9, 1, 30, 9502, 43, 3, EffectLayer.Head );
    Stop();
  }
 }
}
}




Hosted for free by InvisionFree