找回密码
 点一下
查看: 1545|回复: 5

关于一个肉钩子的问题

[复制链接]
发表于 2010-7-22 11:36:19 | 显示全部楼层 |阅读模式
当移植肉钩子时,会出现20个错误。
[jass]function Trig_Butcher_Hook_GetTimerIndex takes timer t returns integer
    local integer i = 0
    loop
        exitwhen i>=200
        if t!=null then
            if udg_Butcher_Hook_Timer==t then
                return i
            endif
        else
            if udg_Butcher_Hook_Timer==null then
                set udg_Butcher_Hook_Timer = CreateTimer()
                return i
            endif
        endif
        set i = i + 1
    endloop
    set udg_Butcher_Hook_Timer[0] = null
    return 0
endfunction
function Trig_Butcher_Hook_Group_Conditions takes nothing returns boolean
    return (IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false)and(GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0.00)
endfunction
function Trig_Butcher_Hook_Loop takes nothing returns nothing
    local integer timerIndex = Trig_Butcher_Hook_GetTimerIndex(GetExpiredTimer()) * 40
    local integer hookLength = R2I(udg_Butcher_Hook_Real[timerIndex+3])
    local integer index = 1
    local real a = 0.00
    local real x = 0.00
    local real y = 0.00
    local group g = null
    if udg_Butcher_Hook_Real[timerIndex+2]==0.00 then
        set hookLength = hookLength + 1
        set udg_Butcher_Hook_Unit[timerIndex+hookLength+1] = udg_Butcher_Hook_Unit[timerIndex]
        if(hookLength>1)then
            set a = GetAngleSP(GetUnitX(udg_Butcher_Hook_Unit[timerIndex]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex]),GetUnitX(udg_Butcher_Hook_Unit[timerIndex+hookLength-1]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex+hookLength-1]))
            set udg_Butcher_Hook_Unit[timerIndex+hookLength] = CreateUnit(Player(0),'e00L',GetUnitX(udg_Butcher_Hook_Unit[timerIndex]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex]),a)
        else
            set a = udg_Butcher_Hook_Real[timerIndex]
            set udg_Butcher_Hook_Unit[timerIndex+hookLength] = CreateUnit(Player(0),'e00L',GetUnitX(udg_Butcher_Hook_Unit[timerIndex]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex]),a)
            call SetUnitVertexColor(udg_Butcher_Hook_Unit[timerIndex+hookLength],255,55,55,255)
        endif
        loop
            exitwhen index>hookLength
            if(index==1)then
                set a = udg_Butcher_Hook_Real[timerIndex]
                set x = GetDisplacementXSP(GetUnitX(udg_Butcher_Hook_Unit[timerIndex+index]),30.0,a)
                set y = GetDisplacementYSP(GetUnitY(udg_Butcher_Hook_Unit[timerIndex+index]),30.0,a)
            else
                set a = GetAngleSP(GetUnitX(udg_Butcher_Hook_Unit[timerIndex+index]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex+index]),GetUnitX(udg_Butcher_Hook_Unit[timerIndex+index-1]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex+index-1]))
                set x = GetDisplacementXSP(GetUnitX(udg_Butcher_Hook_Unit[timerIndex+index-1]),25.0,a+180.0)
                set y = GetDisplacementYSP(GetUnitY(udg_Butcher_Hook_Unit[timerIndex+index-1]),25.0,a+180.0)
            endif
            call SetUnitX(udg_Butcher_Hook_Unit[timerIndex+index],x)
            call SetUnitY(udg_Butcher_Hook_Unit[timerIndex+index],y)
            call SetUnitFacing(udg_Butcher_Hook_Unit[timerIndex+index],a)
            set index = index + 1
        endloop
        set index = hookLength
        loop
            exitwhen index <= 0
            set a = GetAngleSP(GetUnitX(udg_Butcher_Hook_Unit[timerIndex+index+1]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex+index+1]),GetUnitX(udg_Butcher_Hook_Unit[timerIndex+index]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex+index]))
            set x = GetDisplacementXSP(GetUnitX(udg_Butcher_Hook_Unit[timerIndex+index+1]),25.0,a)
            set y = GetDisplacementYSP(GetUnitY(udg_Butcher_Hook_Unit[timerIndex+index+1]),25.0,a)
            call SetUnitX(udg_Butcher_Hook_Unit[timerIndex+index],x)
            call SetUnitY(udg_Butcher_Hook_Unit[timerIndex+index],y)
            call SetUnitFacing(udg_Butcher_Hook_Unit[timerIndex+index],a)
            if(index==1 and udg_Butcher_Hook_Real[timerIndex+4]==0.00)then
                set g = CreateGroup()
                call GroupEnumUnitsInRange(g,GetUnitX(udg_Butcher_Hook_Unit[timerIndex+1]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex+1]),88.00,Condition(function Trig_Butcher_Hook_Group_Conditions))
                call GroupRemoveUnit(g,udg_Butcher_Hook_Unit[timerIndex])
                set udg_Butcher_Hook_Unit[timerIndex+38] = FirstOfGroup(g)
                call DestroyGroup(g)
                if IsUnitType(udg_Butcher_Hook_Unit[timerIndex+38],UNIT_TYPE_MAGIC_IMMUNE) and IsUnitAlly(udg_Butcher_Hook_Unit[timerIndex],GetOwningPlayer(udg_Butcher_Hook_Unit[timerIndex+38]))==false then
                    if GetRandomInt(0,1)==0 then
                        set udg_Butcher_Hook_Real[timerIndex+4] = GetRandomReal(-90.0,-70.0)
                    else
                        set udg_Butcher_Hook_Real[timerIndex+4] = GetRandomReal(70.0,90.0)
                    endif
                    call DestroyEffect( AddSpecialEffectTarget("Abilities\\Spells\\Items\\SpellShieldAmulet\\SpellShieldCaster.mdl",udg_Butcher_Hook_Unit[timerIndex+38], "origin") )
                    set udg_Butcher_Hook_Real[timerIndex] = GetUnitFacing(udg_Butcher_Hook_Unit[timerIndex+1])+udg_Butcher_Hook_Real[timerIndex+4]
                    set udg_Butcher_Hook_Unit[timerIndex+38] = null
               elseif IsUnitAlly(udg_Butcher_Hook_Unit[timerIndex],GetOwningPlayer(udg_Butcher_Hook_Unit[timerIndex+38]))==false then
                    call DestroyEffect( AddSpecialEffectTarget("Objects\\Spawnmodels\\Naga\\NagaBlood\\NagaBloodWindserpent.mdl",udg_Butcher_Hook_Unit[timerIndex+38], "chest") )
                    call DestroyEffect( AddSpecialEffectTarget("Objects\\Spawnmodels\\NightElf\\NightElfBlood\\NightElfBloodDruidoftheClaw.mdl",udg_Butcher_Hook_Unit[timerIndex+38], "chest") )
                    call DestroyEffect( AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",udg_Butcher_Hook_Unit[timerIndex+38], "chest") )
                    call UnitDamageTarget(udg_Butcher_Hook_Unit[timerIndex],udg_Butcher_Hook_Unit[timerIndex+38],udg_Butcher_Hook_Real[timerIndex+1]*100.0, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_METAL_MEDIUM_SLICE )
               endif
               set g = null
            endif
            set index = index - 1
        endloop
        if hookLength>=R2I(udg_Butcher_Hook_Real[timerIndex+1])*5+17 or udg_Butcher_Hook_Unit[timerIndex+38]!=null then
            set udg_Butcher_Hook_Real[timerIndex+2] = 1.0
        endif
    else
        call RemoveUnit(udg_Butcher_Hook_Unit[timerIndex+hookLength])
        set hookLength = hookLength - 1
        set udg_Butcher_Hook_Unit[timerIndex+hookLength+1] = udg_Butcher_Hook_Unit[timerIndex]
        set index = hookLength
        loop
            exitwhen index<1
            if(index>0)then
                set a = GetAngleSP(GetUnitX(udg_Butcher_Hook_Unit[timerIndex+index+1]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex+index+1]),GetUnitX(udg_Butcher_Hook_Unit[timerIndex+index]),GetUnitY(udg_Butcher_Hook_Unit[timerIndex+index]))
                set x = GetDisplacementXSP(GetUnitX(udg_Butcher_Hook_Unit[timerIndex+index+1]),25.0,a)
                set y = GetDisplacementYSP(GetUnitY(udg_Butcher_Hook_Unit[timerIndex+index+1]),25.0,a)
                call SetUnitX(udg_Butcher_Hook_Unit[timerIndex+index],x)
                call SetUnitY(udg_Butcher_Hook_Unit[timerIndex+index],y)
                call SetUnitFacing(udg_Butcher_Hook_Unit[timerIndex+index],a)
                if index==1 and udg_Butcher_Hook_Unit[timerIndex+38]!=null and udg_Butcher_Hook_Unit[timerIndex+38]!=udg_Butcher_Hook_Unit[timerIndex] then
                    call SetUnitX(udg_Butcher_Hook_Unit[timerIndex+38],GetUnitX(udg_Butcher_Hook_Unit[timerIndex+1]))
                    call SetUnitY(udg_Butcher_Hook_Unit[timerIndex+38],GetUnitY(udg_Butcher_Hook_Unit[timerIndex+1]))
                endif
            endif
            set index = index - 1
        endloop
    endif
    if(hookLength<1)then
        set udg_Butcher_Hook_Unit[timerIndex+38] = null
        call PauseTimer(udg_Butcher_Hook_Timer[timerIndex/40])
        set udg_Butcher_Hook_Timer[timerIndex/40] = null
    else
        set udg_Butcher_Hook_Real[timerIndex+3] = hookLength
    endif
endfunction
function Trig_Butcher_Hook_Actions takes nothing returns nothing
    local integer timerIndex = Trig_Butcher_Hook_GetTimerIndex(null)
   
local real a = GetAngleSP(GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),GetSpellTargetX(),GetSpellTargetY())
    call TimerStart(udg_Butcher_Hook_Timer[timerIndex],0.027,true,function Trig_Butcher_Hook_Loop)
    set timerIndex = timerIndex * 40
    set udg_Butcher_Hook_Real[timerIndex+0] = a
    set udg_Butcher_Hook_Real[timerIndex+1] = GetUnitAbilityLevel(GetTriggerUnit(),GetSpellAbilityId())
    set udg_Butcher_Hook_Real[timerIndex+2] = 0.00
    set udg_Butcher_Hook_Real[timerIndex+3] = 0.00
    set udg_Butcher_Hook_Real[timerIndex+4] = 0.00
    set udg_Butcher_Hook_Unit[timerIndex+0] = GetTriggerUnit()
endfunction
function Trig_Butcher_Hook_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A016'
endfunction
//===========================================================================
function InitTrig_Hook takes nothing returns nothing
    set gg_trg_Hook = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Hook, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Hook, Condition( function Trig_Butcher_Hook_Conditions ) )
    call TriggerAddAction( gg_trg_Hook, function Trig_Butcher_Hook_Actions )
endfunction][/jass]
蓝字的都错,鱼妹的问下错在哪?

发表于 2010-7-22 11:37:26 | 显示全部楼层
楼主你发错区了吧,应该发到JASS区,你要知道....


而且把你另外一贴删掉吧
回复

使用道具 举报

发表于 2010-7-22 11:53:45 | 显示全部楼层
错误的可能很多
比如没有对应的单位,对应的变量……

发jass用【jass】和【/jass】,将内容放在之间,【】替换成[]即可

LZ懂英文的话看一下错误报告吧
回复

使用道具 举报

 楼主| 发表于 2010-7-22 12:26:20 | 显示全部楼层
单位和变量无误
回复

使用道具 举报

发表于 2010-7-22 13:25:01 | 显示全部楼层
那么就发错误提示
回复

使用道具 举报

 楼主| 发表于 2010-7-22 18:52:25 | 显示全部楼层
应该怎么改呢
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-7 10:59 , Processed in 0.047961 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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