找回密码
 点一下
查看: 2310|回复: 14

JASS老是出错 大大们帮帮看是哪里的问题?

[复制链接]
发表于 2009-1-30 15:54:56 | 显示全部楼层 |阅读模式
function Trig_SpiritLightening_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function Trig_SpiritLightening_owningplayerboolean takes nothing returns boolean
    return ( GetOwningPlayer(GetEnumUnit()) != ForcePickRandomPlayer(GetPlayersAllies(GetOwningPlayer(GetTriggerUnit()))) )
endfunction

function Trig_SpiritLightening_damagedunitboolean takes nothing returns boolean
    return ( GetEnumUnit() != GroupPickRandomUnit(DamagedGroup) )
endfunction

function Trig_SpiritLightening_hero takes nothing returns boolean
    return ( IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == true )
endfunction

function Trig_SpiritLightening_boolean1 takes nothing returns boolean
    return GetBooleanAnd( Trig_SpiritLightening_owningplayerboolean, Trig_SpiritLightening_damagedunitboolean )
endfunction

function Trig_SpiritLightening_boolean takes nothing returns boolean
    return GetBooleanAnd( Trig_SpiritLightening_boolean1, Trig_SpiritLightening_hero )
endfunction

function Trig_SpiritLightening_Actions takes nothing returns nothing
    local unit ThunderAim = GetSpellTargetUnit()
    local real ManaDamage = ( 60.00 + I2R(GetUnitAbilityLevel(GetTriggerUnit(), 'A000')) )
    local integer forloopAindex = 1
    local integer forloopAindexend = ( GetUnitAbilityLevel(GetTriggerUnit(), 'A000') + 1 )
    local effect array Buffeffect
    local effect array Lighteneffect
    local group DamagedGroup
    local location AimDot
    loop
        exitwhen forloopAindex > forloopAindexend
        set AimDot = GetUnitLoc(ThunderAim)
        call UnitDamageTarget( GetTriggerUnit(), ThunderAim, RMinBJ(ManaDamage, GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA)), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
        call SetUnitManaBJ( ThunderAim, RMaxBJ(0.00, ( GetUnitState(ThunderAim, UNIT_STATE_MANA) - ManaDamage )) )
        call AddSpecialEffectTargetUnitBJ( "origin", ThunderAim, "Abilities\\Spells\\NightElf\\ManaBurn\\ManaBurnTarget.mdl" )
        set Buffeffect[forloopAindex] = GetLastCreatedEffectBJ()
        call AddSpecialEffectTargetUnitBJ( "overhead", ThunderAim, "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl" )
        set Lighteneffect[forloopAindex] = GetLastCreatedEffectBJ()
        call GroupAddUnitSimple( ThunderAim, DamagedGroup )
        set ThunderAim = null
        set ThunderAim = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(500.00, AimDot, Condition(Trig_SpiritLightening_boolean)))
        set forloopAindex = forloopAindex + 1
    endloop
    set forloopAindex = 1
    loop
        exitwhen forloopAindex > forloopAindexend
        call TriggerSleepAction( 0.10 )
        call DestroyEffect(Buffeffect[forloopAindex])
        call DestroyEffect(Lighteneffect[forloopAindex])
        set Buffeffect[forloopAindex] = null
        set Lighteneffect[forloopAindex] = null
    endloop
    call RemoveLocation(AimDot)
    set AimDot = null
    call GroupClear(DamagedGroup)
    set DamagedGroup = null
endfunction

//===========================================================================
function InitTrig_SpiritLightening takes nothing returns nothing
    set gg_trg_SpiritLightening = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_SpiritLightening, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_SpiritLightening, Condition( function Trig_SpiritLightening_Conditions ) )
    call TriggerAddAction( gg_trg_SpiritLightening, function Trig_SpiritLightening_Actions )
endfunction
发表于 2009-1-30 16:00:20 | 显示全部楼层
与其说这个是J
其实更像T
回复

使用道具 举报

 楼主| 发表于 2009-1-30 16:28:54 | 显示全部楼层
- =
本来就是T转换的- =
我只是把全局改成局部
回复

使用道具 举报

发表于 2009-1-30 17:20:10 | 显示全部楼层
那么笔误的可能会很大啰~
回复

使用道具 举报

 楼主| 发表于 2009-1-30 17:27:52 | 显示全部楼层
对啊
所以我修改过一次了的

现在是新的

globals
    group DamagedGroup
    trigger gg_SpiritLightening
endglobals

function SpiritLightening_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function SpiritLightening_owningplayerboolean takes nothing returns boolean
    return ( GetOwningPlayer(GetEnumUnit()) != ForcePickRandomPlayer(GetPlayersAllies(GetOwningPlayer(GetTriggerUnit()))) )
endfunction

function SpiritLightening_damagedunitboolean takes nothing returns boolean
    return ( GetEnumUnit() != GroupPickRandomUnit(DamagedGroup) )
endfunction

function SpiritLightening_hero takes nothing returns boolean
    return ( IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == true )
endfunction

function SpiritLightening_boolean1 takes nothing returns boolean
    return GetBooleanAnd( SpiritLightening_owningplayerboolean(), SpiritLightening_damagedunitboolean() )
endfunction

function SpiritLightening_boolean takes nothing returns boolean
    return GetBooleanAnd( SpiritLightening_boolean1(), SpiritLightening_hero() )
endfunction

function SpiritLightening_Actions takes nothing returns nothing
    local unit ThunderAim
    local real ManaDamage
    local integer forloopAindex
    local integer forloopAindexend
    local effect array Buffeffect
    local effect array Lighteneffect
    local location AimDot
    set ThunderAim = GetSpellAbilityUnit()
    set ManaDamage = ( 60.00 + I2R( GetUnitAbilityLevel(GetTriggerUnit(), 'A000')) * 35)
    set forloopAindex = 1
    set forloopAindexend = ( GetUnitAbilityLevel(GetTriggerUnit(), 'A000') + 1 )
    loop
        exitwhen forloopAindex > forloopAindexend
        set AimDot = GetUnitLoc(ThunderAim)
        call UnitDamageTargetBJ( GetTriggerUnit(), ThunderAim, RMinBJ(ManaDamage, GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA)), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
        call SetUnitManaBJ( ThunderAim, RMaxBJ(0.00, ( GetUnitState(ThunderAim, UNIT_STATE_MANA) - ManaDamage )) )
        call AddSpecialEffectTargetUnitBJ( "origin", ThunderAim, "Abilities\\\\Spells\\\\NightElf\\\\ManaBurn\\\\ManaBurnTarget.mdl" )
        set Buffeffect[forloopAindex] = GetLastCreatedEffectBJ()
        call AddSpecialEffectTargetUnitBJ( "overhead", ThunderAim, "Abilities\\\\Spells\\\\Other\\\\Monsoon\\\\MonsoonBoltTarget.mdl" )
        set Lighteneffect[forloopAindex] = GetLastCreatedEffectBJ()
        call GroupAddUnitSimple( ThunderAim, DamagedGroup )
        set ThunderAim = null
        set ThunderAim = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(500.00, AimDot, Condition(function SpiritLightening_boolean)))
        set forloopAindex = forloopAindex + 1
    endloop
    set forloopAindex = 1
    loop
        exitwhen forloopAindex > forloopAindexend
        call TriggerSleepAction( 0.10 )
        call DestroyEffect(Buffeffect[forloopAindex])
        call DestroyEffect(Lighteneffect[forloopAindex])
        set Buffeffect[forloopAindex] = null
        set Lighteneffect[forloopAindex] = null
    endloop
    call RemoveLocation(AimDot)
    set AimDot = null
    call GroupClear(DamagedGroup)
    set DamagedGroup = null
endfunction

//===========================================================================
function Jass_SpiritLightening takes nothing returns nothing
    set gg_SpiritLightening = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_SpiritLightening, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_SpiritLightening, Condition( function SpiritLightening_Conditions ) )
    call TriggerAddAction( gg_SpiritLightening, function SpiritLightening_Actions )
endfunction


JASSSHOP的报错信息如图 error.JPG
回复

使用道具 举报

发表于 2009-1-30 18:12:07 | 显示全部楼层
前面两个应该没错,第三个是参数没对,用的bj的伤害函数,参数个数和排列是cj的
直接改为UnitDamageTarget就行~
回复

使用道具 举报

 楼主| 发表于 2009-1-30 18:28:37 | 显示全部楼层
还是不行啊 囧Rz...
话说WE申报的错误好多啊咩。。。。
我又修改了一次

globals
    group DamagedGroup
    trigger gg_SpiritLightening
endglobals

function SpiritLightening_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function SpiritLightening_boolean takes nothing returns boolean
   
if GetOwningPlayer(GetEnumUnit()) != ForcePickRandomPlayer(GetPlayersAllies(GetOwningPlayer(GetTriggerUnit()))) then
    if GetEnumUnit() != GroupPickRandomUnit(DamagedGroup) then
       if IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == true then
           return true
       else
           return false
       endif
    else
        return false
    endif
else
    return false
endif
endfunction

function SpiritLightening_Actions takes nothing returns nothing
    local unit ThunderAim
    local real ManaDamage
    local integer forloopAindex
    local integer forloopAindexend
    local effect array Buffeffect
    local effect array Lighteneffect
    local location AimDot
    set ThunderAim = GetSpellAbilityUnit()
    set ManaDamage = ( 60.00 + I2R( GetUnitAbilityLevel(GetTriggerUnit(), 'A000')) * 35)
    set forloopAindex = 1
    set forloopAindexend = ( GetUnitAbilityLevel(GetTriggerUnit(), 'A000') + 1 )
    loop
        exitwhen forloopAindex > forloopAindexend
        set AimDot = GetUnitLoc(ThunderAim)
        call UnitDamageTarget( GetTriggerUnit(), ThunderAim, RMinBJ(ManaDamage, GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA)), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
        call SetUnitManaBJ( ThunderAim, RMaxBJ(0.00, ( GetUnitState(ThunderAim, UNIT_STATE_MANA) - ManaDamage )) )
        call AddSpecialEffectTargetUnitBJ( "origin", ThunderAim, "Abilities\\\\Spells\\\\NightElf\\\\ManaBurn\\\\ManaBurnTarget.mdl" )
        set Buffeffect[forloopAindex] = GetLastCreatedEffectBJ()
        call AddSpecialEffectTargetUnitBJ( "overhead", ThunderAim, "Abilities\\\\Spells\\\\Other\\\\Monsoon\\\\MonsoonBoltTarget.mdl" )
        set Lighteneffect[forloopAindex] = GetLastCreatedEffectBJ()
        call GroupAddUnitSimple( ThunderAim, DamagedGroup )
        set ThunderAim = null
        set ThunderAim = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(500.00, AimDot, Condition(function SpiritLightening_boolean)))
        set forloopAindex = forloopAindex + 1
    endloop
    set forloopAindex = 1
    loop
        exitwhen forloopAindex > forloopAindexend
        call TriggerSleepAction( 0.10 )
        call DestroyEffect(Buffeffect[forloopAindex])
        call DestroyEffect(Lighteneffect[forloopAindex])
        set Buffeffect[forloopAindex] = null
        set Lighteneffect[forloopAindex] = null
    endloop
    call RemoveLocation(AimDot)
    set AimDot = null
    call GroupClear(DamagedGroup)
    set DamagedGroup = null
endfunction

//===========================================================================
function Jass_SpiritLightening takes nothing returns nothing
    set gg_SpiritLightening = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_SpiritLightening, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_SpiritLightening, Condition( function SpiritLightening_Conditions ) )
    call TriggerAddAction( gg_SpiritLightening, function SpiritLightening_Actions )
endfunction

我都要疯狂了咩。。。。
回复

使用道具 举报

发表于 2009-1-30 18:39:07 | 显示全部楼层
这个技能很复杂....
回复

使用道具 举报

发表于 2009-1-30 18:44:17 | 显示全部楼层
可怜的LZ...
不过偶也无能为力....
等下楼吧...
回复

使用道具 举报

发表于 2009-1-30 19:27:59 | 显示全部楼层
JASSSHOP
没报错啊
ref  out.jpg
回复

使用道具 举报

发表于 2009-1-30 19:33:26 | 显示全部楼层
人品问题
回复

使用道具 举报

 楼主| 发表于 2009-1-30 19:58:51 | 显示全部楼层
我的报错了咩
可能我最近RP太低- =
我去下了个WEHELPER
又修改了一下
终于可以了咩
但是又遇到了新的问题咩...

大家注意看
我是想要达到闪电弹跳的目的..按技能等级分别弹跳2/3/4/5次
但是我测试时发现只能对首要目标进行伤害..
囧Rz...
是否有哪位大人帮忙看一下。。。

以下是最新的代码:
function SpiritLightening_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function SpiritLightening_Actions takes nothing returns nothing
    local unit ThunderAim
    local real ManaDamage
    local integer forloopAindex
    local integer forloopAindexend
    local effect array Buffeffect
    local effect array Lighteneffect
    local location AimDot
    local group DamagedGroup
    set ThunderAim = GetSpellTargetUnit()
    set ManaDamage = ( 60.00 + I2R( GetUnitAbilityLevelSwapped('A000', GetTriggerUnit())) * 35)
    set forloopAindex = 1
    set forloopAindexend = ( GetUnitAbilityLevelSwapped( 'A000', GetTriggerUnit()) + 1 )
    loop
        exitwhen forloopAindex > forloopAindexend
        set AimDot = GetUnitLoc(ThunderAim)
        call UnitDamageTarget( GetTriggerUnit(), ThunderAim, RMinBJ(ManaDamage, GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA)), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
        call SetUnitManaBJ( ThunderAim, RMaxBJ(0.00, ( GetUnitState(ThunderAim, UNIT_STATE_MANA) - ManaDamage )) )
        call AddSpecialEffectTargetUnitBJ( "origin", ThunderAim, "Abilities\\\\Spells\\\\NightElf\\\\ManaBurn\\\\ManaBurnTarget.mdl" )
        set Buffeffect[forloopAindex] = GetLastCreatedEffectBJ()
        call AddSpecialEffectTargetUnitBJ( "overhead", ThunderAim, "Abilities\\\\Spells\\\\Other\\\\Monsoon\\\\MonsoonBoltTarget.mdl" )
        set Lighteneffect[forloopAindex] = GetLastCreatedEffectBJ()
        call GroupAddUnitSimple( ThunderAim, DamagedGroup )
        set ThunderAim = null
        loop
        set ThunderAim = GroupPickRandomUnit(GetUnitsInRangeOfLocAll(500.00, AimDot))
        exitwhen GetBooleanAnd(IsUnitType(ThunderAim, UNIT_TYPE_HERO ),GetBooleanAnd(( GetOwningPlayer(ThunderAim) != ForcePickRandomPlayer(GetPlayersAllies(GetOwningPlayer(GetTriggerUnit()))) ),( GetEnumUnit() != GroupPickRandomUnit(DamagedGroup) ))) == true
        endloop
        set forloopAindex = forloopAindex + 1
    endloop
    set forloopAindex = 1
    loop
        exitwhen forloopAindex > forloopAindexend
        call TriggerSleepAction( 0.10 )
        call DestroyEffect(Buffeffect[forloopAindex])
        call DestroyEffect(Lighteneffect[forloopAindex])
        set Buffeffect[forloopAindex] = null
        set Lighteneffect[forloopAindex] = null
        set forloopAindex = forloopAindex + 1
    endloop
    call RemoveLocation(AimDot)
    set AimDot = null
    call GroupClear(DamagedGroup)
    set DamagedGroup = null
endfunction

//===========================================================================
function InitTrig_SpiritLightening takes nothing returns nothing
    local trigger gg_SpiritLightening = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_SpiritLightening, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_SpiritLightening, Condition( function SpiritLightening_Conditions ) )
    call TriggerAddAction( gg_SpiritLightening, function SpiritLightening_Actions )
endfunction
回复

使用道具 举报

发表于 2009-1-30 21:10:19 | 显示全部楼层
还是T.......
I 服 了.....
你还是直接发T吧..
这种转JASS....就是编辑时显示不一样...
如果你觉得这样更好速度更快..效果更明显.. .....你可以试试 用MPQ 打开地图 把 war3map.J 解压用记事本打开 看看这种转化 和没转化 有什么不同....
回复

使用道具 举报

发表于 2009-1-30 21:41:04 | 显示全部楼层
local group DamagedGroup 是在function Trig_SpiritLightening_Actions 里的

function   Trig_SpiritLightening_damagedunitboolean   takes nothing returns boolean
    return ( GetEnumUnit() != GroupPickRandomUnit(DamagedGroup) )

问题就在这里了
DamagedGroup是局域变量,怎么可以出现在2个function里

还有很多类似的地方 基本上所有的都是这种错误
回复

使用道具 举报

发表于 2009-1-31 16:23:45 | 显示全部楼层
人家的DamagedGroup设的是全局变量``
不过刚发现哦,虽声明了DamagedGroup但从没CreateGroup过
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-12-22 16:39 , Processed in 0.049776 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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