游戏乐悠悠网游开发网

 找回密码
 立即注册
查看: 949|回复: 1
打印 上一主题 下一主题

RunUO讲解[第三课]熟悉RunUO脚本编写

[复制链接]
  • TA的每日心情
    开心
    2023-8-27 19:01
  • 签到天数: 137 天

    [LV.7]常住居民III

    鲜花(5) 鸡蛋(0)
    跳转到指定楼层
    楼主
    发表于 2012-7-15 09:38:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式


    RunUO讲解[第三课]熟悉RunUO脚本编写


    RunUO的脚本是C#编写的,所以如果你想写出一个出色的脚本的话,必须有着C#的基础。
    下面我们简单的来说下。
    例如:
    注意括号的对应性,系统是死记的,如果你括号不对应,系统就会读不出来。

    下面是一个简单的武器脚本。我们来解析下。

    这里就是这个武器脚本需要的用到的支持。
    using System;
    using Server.Network;
    using Server.Items;
    using Server.Targeting;
    namespace Server.Items

    这里是给武器定义选用什么类型
    {
    public class 铁剑 : Kryss

    给武器定意属性的第一部分
      {
    //稀有工艺品等级
      public override int ArtifactRarity{ get{ return 999; } }
    //持久双满
      public override int InitMinHits{ get{ return 255; } }
      public override int InitMaxHits{ get{ return 255; } }

    给武器定意属性的第二部分
          [Constructable]
      public 铁剑()
      {
              Name = "铁剑";
    //被祝福的
          LootType = LootType.Blessed;
    //重量
          Weight = 1;
    //夜视术
          Attributes.NightSight = 1;
    //魔法转移
          Attributes.SpellChanneling = 1;
    //攻击伤害增加
          Attributes.WeaponDamage = 45;
    //防御几率增加
          Attributes.DefendChance = 45;
    //命中
          Attributes.AttackChance = 45;
    //挥动速度增加
          Attributes.WeaponSpeed = 45;
    //降低使用条件
          WeaponAttributes.LowerStatReq = 100;
    //颜色
          Hue = 34;
    //攻击伤害
          WeaponAttributes.HitHarm = 100;
    //吸取生命
          WeaponAttributes.HitLeechHits = 50;
    //闪电攻击
          WeaponAttributes.HitLightning = 100;
    //降低对手攻击
          WeaponAttributes.HitLowerAttack = 55;
          WeaponAttributes.HitLowerDefend = 55;
    //吸取魔法攻击
          WeaponAttributes.HitLeechMana = 50;
    //吸取精力攻击
          WeaponAttributes.HitLeechStam = 50;
    //快速魔法回复
          Attributes.CastRecovery = 6;
    //快速施法
          Attributes.CastSpeed = 2;
    //额外的敏捷
          Attributes.BonusDex = 50;
    //额外的敏捷
          Attributes.BonusStr = 55;
    //额外的生命
          Attributes.BonusHits = 15;
    //额外的智力
          Attributes.BonusInt = 40;
    //魔法增加
          Attributes.BonusMana = 10;
    //物防
          WeaponAttributes.ResistPhysicalBonus = 100;
    //火防
          WeaponAttributes.ResistFireBonus = 100;
    //寒防
          WeaponAttributes.ResistColdBonus = 100;
    //毒防
          WeaponAttributes.ResistPoisonBonus = 100;
    //能防
          WeaponAttributes.ResistEnergyBonus = 100;
    //物理反射
          Attributes.ReflectPhysical = 105;
    //降低魔力消耗
                this.Attributes.LowerManaCost = 40;
    //降低药材消耗
                this.Attributes.LowerRegCost = 100;
    //幸运
                this.Attributes.Luck = 9999;
    //魔法恢复
                this.Attributes.RegenMana = 15;
      }

    给武器定义攻击方式
    //武器攻击属性分配
      public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy )
      {
       phys = fire = cold = pois = nrgy = 20;
      }

    这里定意什么还未搞明白。可能是触发条件
      public 铁剑( 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();
      }

    这里多出来的括号是跟最上面的括号想对应的
    }
    }




  • TA的每日心情
    无聊
    2012-10-5 19:07
  • 签到天数: 42 天

    [LV.5]常住居民I

    鲜花(0) 鸡蛋(0)
    沙发
    发表于 2012-8-10 13:26:23 | 只看该作者
    真是美~~~不錯
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    小黑屋|手机版|Archiver|Online Game Xingbarking Dev Team  

    GMT+8, 2024-5-19 05:15 , Processed in 0.142205 second(s), 35 queries .

    Powered by Discuz! X3.2 Licensed

    © 2001-2013 Comsenz Inc.

    快速回复 返回顶部 返回列表