找回密码
 点一下
查看: 5866|回复: 3

仿Dota技能 屠夫 - 肉钩 (傻瓜移植版)

[复制链接]
发表于 2011-12-15 02:28:11 | 显示全部楼层 |阅读模式
             ABC.gif
                1 - 本演示需1.24b以上魔兽版本
                2 - 为方便WEER移植已经写好注释
                3 - 支持多人同时释放
                4 - 需JassHelper插件支持(YDWE)
                5 - 仅供学习与娱乐

                6 - 100%排泄 90%高仿

                7 - 可以钩任何单位(友方单位不造成伤害)
                8 - 暂不支持伤害与属性挂钩
                9 - 可以根据自己需要任意修改

蛋疼学了下Zinc 发现结构体的概念一窍不通。 只能学学语法 写个不伦不类的东西
[通魔作坊]仿dota技能 - 肉钩(傻瓜移植版).w3x (21 KB, 下载次数: 212)

[jass]

/*
//! zinc
library KuOfHook
{
   constant  hashtable hx = InitHashtable();
   constant  string Effect =     /*ÌØЧ·¾¶¡ú¡ú¡ú¡ú¡ú*/  "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl"     ;
   constant  integer HookAId =       'ewsp' ;                    //   ¹³×ÓÍ·²¿Âí¼×µ¥Î»Id
   constant  integer HookBid =        'e000' ;                    //   ¹³×ÓÂí¼×Id
   constant  integer  SpellId =          'A000' ;                     //  Èâ¹³¼¼ÄÜId
   constant  real SpeedA =                       0.03 ;                     //  ³ö¹³Òƶ¯ËÙ¶È 0.01Ϊ×î¿ì
   constant  real SpeedB =                       0.03 ;                     //  ÊÕ¹³Òƶ¯ËÙ¶È 0.01 Ϊ×î¿ì
   constant  real SpeedSpare =                  45 ;                     //  ¹³×Ó¼ä¾à(»áÓ°ÏìËÙ¶È)
   constant  integer Distance =                 28 ;                     //  ¹³×Ó³¤¶È
   constant  real Range =                              75 ;                     // ¹³×ÓÑ¡È¡·¶Î§
   constant  real Damage =                       100 ;                     // Ôì³ÉÉ˺¦

    function  Spell_Hook_TimerB()
    {
        unit Hook,Majia[],Target;
        real x,y,ang;
        integer i,t,Max,Loop=0;

        i = GetHandleId(GetExpiredTimer());
        t = LoadInteger(hx,i,500);
        Max = LoadInteger(hx,i,501);
        Hook = LoadUnitHandle(hx,i,Max+1);
        Target = LoadUnitHandle(hx,i,Max+2);
        ang = LoadReal(hx,i,Max+3);
        if(t>0)
        {
            Majia[t] = LoadUnitHandle(hx,i,t);
            RemoveUnit(Majia[t]);
            t -= 1;
            SaveInteger(hx,i,500,t);
            ang += 180;
            x = GetUnitX(Hook)+SpeedSpare*Cos(ang*bj_DEGTORAD);
            y = GetUnitY(Hook)+SpeedSpare*Sin(ang*bj_DEGTORAD);
            SetUnitX(Target,x);
            SetUnitY(Target,y);
            SetUnitX(Hook,x);
            SetUnitY(Hook,y);
        }
        else
        {
            PauseTimer(GetExpiredTimer());
            RemoveUnit(Hook);
            DestroyTimer(GetExpiredTimer());
            FlushChildHashtable(hx,i);
        }
        Hook = null;
        Target = null;
        i = 0;
        while(i>Max)
        {
            i += 1;
            Majia = null;
        }
    }

    function Spell_Hook_TimerA()
    {
        unit Hero,Hook,Majia[],Target;
        timer Timer ;
        real x,y,ang;
        integer i,i2,t,Max,Loop;
        group g,g2=CreateGroup() ;

        i = GetHandleId(GetExpiredTimer());
        Timer = LoadTimerHandle(hx,i,6);
        i2 = LoadInteger(hx,i,7);
        Hero = LoadUnitHandle(hx,i,1);
        Hook = LoadUnitHandle(hx,i,2);
        g = LoadGroupHandle(hx,i,3);
        ang = LoadReal(hx,i,4);
        t = LoadInteger(hx,i,5);

        if( t < Distance)
        {
            t += 1;
            SaveInteger(hx,i,5,t);
            x = GetUnitX(Hook)+SpeedSpare*Cos(ang*bj_DEGTORAD);
            y = GetUnitY(Hook)+SpeedSpare*Sin(ang*bj_DEGTORAD);
            Majia[t] = CreateUnit(GetOwningPlayer(Hero),HookBid,0,0,ang);
            SetUnitX(Majia[t],x);
            SetUnitY(Majia[t],y);
            SaveUnitHandle(hx,i2,t,Majia[t]);
            SetUnitX(Hook,x);
            SetUnitY(Hook,y);
             GroupEnumUnitsInRange(g2,x,y,Range,null);
             for(Target=FirstOfGroup(g2);Target!=null;Target=FirstOfGroup(g2))
             {
                 if(GetUnitState(Target, UNIT_STATE_LIFE) > 0&&GetUnitTypeId(Target) != 'ewsp' &&Target!=Hero)
                {
                    GroupAddUnit(g,Target);
                }
                GroupRemoveUnit(g2,Target);
             }
             DestroyGroup(g2);
             if(IsUnitGroupEmptyBJ(g)  != true)
             {
                PauseTimer(GetExpiredTimer());
                Target = FirstOfGroup(g);
                if (IsUnitEnemy(Target, GetOwningPlayer(Hero)) == true)
                {
                    UnitDamageTarget( Hero, Target, Damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DEATH, WEAPON_TYPE_WHOKNOWS );
                    DestroyEffect( AddSpecialEffectTarget( Effect , Target, "overhead") );
               }
                Max = t ;
                SaveInteger(hx,i2,501,Max);
                SaveInteger(hx,i2,500,t);
                SaveUnitHandle(hx,i2,Max+1,Hook);
                SaveUnitHandle(hx,i2,Max+2,Target);
                SaveReal(hx,i2,Max+3,ang);
                TimerStart(Timer,SpeedB,true,function   Spell_Hook_TimerB);
                DestroyGroup(g2);
                DestroyTimer(GetExpiredTimer());
                FlushChildHashtable(hx,i);
             }
        }
        else
        {
                PauseTimer(GetExpiredTimer());
                Max = t ;
                SaveInteger(hx,i2,501,Max);
                SaveInteger(hx,i2,500,t);
                SaveUnitHandle(hx,i2,Max+1,Hook);
                SaveReal(hx,i2,Max+3,ang);
                TimerStart(Timer,0.03,true,function   Spell_Hook_TimerB);
                DestroyGroup(g2);
                DestroyTimer(GetExpiredTimer());
                FlushChildHashtable(hx,i);
        }
        Hero = null;
        Hook = null;
        Target = null;
        g = null;
        g2 = null;
        Timer = null;
        i = 0;
        while (i>t)
        {
            i += 1;
            Majia = null;
        }
    }

    function Spell_Hook()
    {
        unit Hero = GetTriggerUnit(),Hook;
        location SpellLoc = GetSpellTargetLoc();
        timer t = CreateTimer(),t2= CreateTimer();
        integer i = GetHandleId(t),i2 = GetHandleId(t2);
        real x,y,ang;
        group g = CreateGroup();

        if(GetSpellAbilityId()==SpellId)
        {
        ang = bj_RADTODEG* Atan2(GetLocationY(SpellLoc)-GetUnitY(Hero),GetLocationX(SpellLoc)-GetUnitX(Hero) );
         x = GetUnitX(Hero)+60*Cos(ang*bj_DEGTORAD);
         y = GetUnitY(Hero)+60*Sin(ang*bj_DEGTORAD);
        Hook = CreateUnit(GetOwningPlayer(Hero),HookAId,x,y,ang);
         SetUnitPathing( Hook, false );
        SaveUnitHandle(hx,i,1,Hero);
        SaveUnitHandle(hx,i,2,Hook);
        SaveGroupHandle(hx,i,3,g);
        SaveReal(hx,i,4,ang);
        SaveInteger(hx,i,7,i2);
        SaveTimerHandle(hx,i,6,t2);
        TimerStart(t,SpeedA,true,function Spell_Hook_TimerA);
        }
        Hero = null;
        RemoveLocation(SpellLoc);
        SpellLoc= null;
        Hook = null;
        t = null;
        g = null;
        t2 = null;
    }
    function onInit()
    {
        trigger t  = CreateTrigger();
        TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT );
        TriggerAddCondition( t, function Spell_Hook);
        t = null;
    }
}
//! endzinc
[/jass]
发表于 2011-12-15 17:18:42 | 显示全部楼层
我有预感楼主即将出个J版的月神箭
回复

使用道具 举报

发表于 2015-9-1 12:43:31 | 显示全部楼层
我打不開 請問這要怎麼使用(我是用地圖編輯器開的
回复

使用道具 举报

发表于 2017-12-16 13:21:36 | 显示全部楼层
lz好人一生平安
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-4-25 15:54 , Processed in 0.186678 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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