找回密码
 点一下
查看: 1518|回复: 8

帮忙找下错吧

[复制链接]
发表于 2007-10-24 21:10:47 | 显示全部楼层 |阅读模式
[codes=jass]globals
    location udg_Point_Skillused
endglobals
function RunFunctionAsTrigger  takes code cFun  returns nothing
    local trigger trg = CreateTrigger()
    call TriggerAddAction(trg,cFun)
    call TriggerExecute(trg)
    call DestroyTrigger(trg)
    set trg = null
endfunction

function RunFunctionAsTriggerWithTimer takes code cFun,real time,boolean cycle  returns trigger
    local trigger trg = CreateTrigger()
    call TriggerAddAction(trg,cFun)
    call TriggerRegisterTimerEvent(trg,time,cycle)
    return trg
endfunction

function SkillFrostNovaEffect takes nothing returns nothing
    local real x =GetLocationX(udg_Point_Skillused) +GetRandomReal(0,400)*SinBJ(GetRandomReal(-180,180))
    local real y =GetLocationY(udg_Point_Skillused) +GetRandomReal(0,400)*SinBJ(GetRandomReal(-180,180))
    local effect eff = AddSpecialEffect("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl",x,y)
    call PolledWait(2)
    call DestroyEffect(eff)
    set eff=null
endfunction

function SkillFrostNovaRectEffect takes nothing returns nothing
    local trigger trg= RunFunctionAsTriggerWithTimer(function SkillFrostNovaEffect,0.1,true)
    call PolledWait(5)
    call DestroyTrigger(trg)
    set trg=null
endfunction
function SkillJudgeAUfn takes nothing returns boolean
    if ( GetSpellAbilityId() == 'AUfn'  ) then
        return true
    endif
    return false
endfunction

function SkillFrostNova takes nothing returns nothing
    local trigger trg = CreateTrigger()
    set   udg_Point_Skillused=   GetSpellTargetLoc()
    call TriggerRegisterAnyUnitEventBJ(trg,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(trg,Condition(function SkillJudgeAUfn))
    call TriggerAddAction(trg,function SkillFrostNovaRectEffect)
    call DestroyTrigger(trg)
    set trg=null
endfunction[/codes]
我在jasscraft里面编译通过了,放到we中却无法通过啊有25个编译错误,都是些缺少'endif',错误的变量名,缺少代码声明什么的。。。。
应该怎么样把自己做的jass技能加到we中去啊?最好有个图解:)
发表于 2007-10-24 21:52:29 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

 楼主| 发表于 2007-10-25 09:50:45 | 显示全部楼层
是啊,那应该怎么做呢?是不是全局变量不用自己申明?
回复

使用道具 举报

发表于 2007-10-25 10:18:32 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

 楼主| 发表于 2007-10-25 10:55:35 | 显示全部楼层
期待中。。
还有,我把别人用jass做的技能照搬了过来还是报错好郁闷啊!
我在we里设的触发要求用初始化函数调用initTrig_trg(我设的触发器名为“trg”)又是个啥问题呢?
回复

使用道具 举报

 楼主| 发表于 2007-10-25 11:19:24 | 显示全部楼层
以下是我先用T做的再转成的J:
[codes=jass]function Trig_FrostNova_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'AUfn' ) ) then
        return false
    endif
    return true
endfunction

function Trig_FrostNova_Actions takes nothing returns nothing
    set udg_rect = RectFromCenterSizeBJ(GetSpellTargetLoc(), ( 400.00 * SinBJ(GetRandomReal(-180.00, 180.00)) ), ( 400.00 * SinBJ(GetRandomReal(-180.00, 180.00)) ))
    set udg_x = GetLocationX(GetRectCenter(udg_rect))
    set udg_y = GetLocationY(GetRectCenter(udg_rect))
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 10
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call AddSpecialEffectLocBJ( GetRandomLocInRect(udg_rect), "Abilities\\\\Spells\\\\Undead\\\\FrostNova\\\\FrostNovaTarget.mdl" )
        call TriggerSleepAction( 0.10 )
        call DestroyEffect( GetLastCreatedEffectBJ() )
        call UnitDamagePoint( GetTriggerUnit(), 0, 400.00, udg_x, udg_y, 20.00, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction

//===========================================================================
function InitTrig_FrostNova takes nothing returns nothing
    set gg_trg_FrostNova = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_FrostNova, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_FrostNova, Condition( function Trig_FrostNova_Conditions ) )
    call TriggerAddAction( gg_trg_FrostNova, function Trig_FrostNova_Actions )
endfunction[/codes]
发现简短多了。。。。打击太大了,闭门吃饭先。。。
回复

使用道具 举报

发表于 2007-10-26 10:15:55 | 显示全部楼层
为什么一定要用rect 呢,用两个real把x和y存起来不是更好么?

[jass]function Trig_FrostNova_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'AUfn' ) ) then
        return false
    endif
    return true
endfunction[/jass]

上面可以这样写:

[jass]function Trig_FrostNova_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'AUfn'
endfunction[/jass]

简单很多,但是要注意某些boolean会出错,不如IsUnitType()就不可以这样写。

其他还有很多地方可以简化,不但让程序看起来更舒服,还能节省游戏资源运行起来更流畅,就不多说了,在网上很容易都能找到。
回复

使用道具 举报

发表于 2007-10-26 10:22:27 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

 楼主| 发表于 2007-10-26 12:43:53 | 显示全部楼层
果子不是说要发个将j技能导进we的攻略的么?加油啊,大伙都等着呢
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-22 23:32 , Processed in 0.130119 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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