找回密码
 点一下
查看: 2870|回复: 15

新人一个击退技能 很多错误 急 急

[复制链接]
发表于 2010-9-5 10:15:41 | 显示全部楼层 |阅读模式
[jass]function H2I takes handle h returns integer
      return h
      return 0
endfunction

function I2U takes integer i returns unit
      return i
      return null
endfunction

function I2Tm takes integer i returns timer
      return i
      return null
endfunction





function yidong takes nothing returns nothing
    local timer tm = GetExpiredTimer()
    local real angle
    set angle=GetStoredReal(udg_GC,I2S(H2I(beijitui)), "timer")
    local unit beijitui
    set beijitui = I2U(GetStoredInteger(udg_GC, I2S(H2I(tm)), "beijitui"))  
    local location p1
    set p1= GetUnitLoc(beijitui)
    local location p2
    set p2= PolarProjectionBJ(p1, 50.00, angle)
    call SetUnitPositionLoc( beijitui, p2 )
    local location p3
    set p3= GetUnitLoc(beijitui)
    if ( DistanceBetweenPoints(p2, p3) >= 5.00 ) then
      call funover()
    endif
    set tm=null
    set beijitui=null
endfunction

function jitui takes unit beijitui, unit jituizhe, real timeout returns nothing
      local timer tm = CreateTimer()
      local real angle
      set angle=AngleBetweenPoints(GetUnitLoc(beijitui),GetUnitLoc(jituizhe))  
      call StoreInteger(udg_GC, I2S(H2I(beijitui)), "timer", H2I(tm))
      call StoreInteger(udg_GC, I2S(H2I(tm)), "beijitui",H2I(beijitui))
      call StoreReal(udg_GC,I2S(H2I(beijitui)), "timer", angle)
      call TimerStart(tm, timeout, true, function yidong)
      set tm = null
endfunction

function funover takes nothing  returns nothing
      local integer tm
      set tm= GetStoredInteger(udg_GC, I2S(H2I(beijitui)), "timer")
      call PauseTimer(I2Tm(tm))
      call DestroyTimer(I2Tm(tm))
endfunction [/jass]
发表于 2010-9-5 14:31:46 | 显示全部楼层
[jass]globals
gamecache GC=InitGameCache("GC.w3v")
endglobals
function H2I takes handle h returns integer
      return h
      return 0
endfunction
function I2U takes integer i returns unit
      return i
      return null
endfunction
function yidong takes nothing returns nothing
    local timer tm = GetExpiredTimer()
    local string BNI=I2S(H2I(tm))
    local unit u=I2U(GetStoredInteger(GC,BNI,"beijitui"))
    local real angle=GetStoredReal(GC,BNI,"angle")
    local integer c=GetStoredInteger(GC,BNI,"Count")
    local real x1=GetUnitX(u)+Cos(angle)*15
    local real y1=GetUnitY(u)+Sin(angle)*15
    call SetUnitFacing(u,angle/3.14159*180+180)
    call SetUnitPosition(u,x1,y1)
    set c=c-1
    call StoreInteger(GC, BNI, "Count", c)
    if c==0 then
        call PauseTimer(tm)
        call FlushStoredMission(GC,BNI)
        call DestroyTimer(tm)
    endif
    set tm=null
    set u=null
endfunction
function jitui takes unit beijitui, unit jituizhe, real timeout,integer Count returns nothing
      local timer tm = CreateTimer()
      local string BNI=I2S(H2I(tm))
      local real angle=Atan2(GetUnitY(beijitui)-GetUnitY(jituizhe),GetUnitX(beijitui)-GetUnitX(jituizhe))
      call StoreInteger(GC, BNI, "beijitui",H2I(beijitui))
      call StoreReal(GC, BNI, "angle", angle)
      call StoreInteger(GC, BNI, "Count", Count)
      call TimerStart(tm, timeout, true, function yidong)
      set tm = null
endfunction[/jass]
回复

使用道具 举报

 楼主| 发表于 2010-9-5 20:07:09 | 显示全部楼层

回 1楼(cuathc) 的帖子

语法检查是没错了
可是放到触发的自定义代码里
调用call jitui(GetSpellTargetUnit(),GetTriggerUnit(),0.04,20)
地图不能保存测试
回复

使用道具 举报

发表于 2010-9-5 20:26:58 | 显示全部楼层

回 2楼(88386896) 的帖子

你用的是1.24?
回复

使用道具 举报

 楼主| 发表于 2010-9-6 10:24:26 | 显示全部楼层

回 3楼(cuathc) 的帖子

没 我一直用1.20e
回复

使用道具 举报

 楼主| 发表于 2010-9-6 10:26:22 | 显示全部楼层

回 3楼(cuathc) 的帖子

还有那个缓存我在变量里定义了
在GC前面加了一下udg_删除了
globals

gamecache GC=InitGameCache("GC.w3v")

endglobals

也不行
回复

使用道具 举报

发表于 2010-9-6 11:17:12 | 显示全部楼层
错误提示是啥
回复

使用道具 举报

发表于 2010-9-6 11:19:02 | 显示全部楼层
你的错误在于“funover”函数被“yidong”函数调用,但却定义在它的后面。
回复

使用道具 举报

发表于 2010-9-6 12:13:56 | 显示全部楼层

回 5楼(88386896) 的帖子

可能你的地图编辑器不支持 vjass 全局变量不能随处定义。
回复

使用道具 举报

发表于 2010-9-6 13:16:07 | 显示全部楼层
引用第7楼希瓦于2010-09-06 11:19发表的  :
你的错误在于“funover”函数被“yidong”函数调用,但却定义在它的后面。
顺序问题语法检查也会报错吧
回复

使用道具 举报

 楼主| 发表于 2010-9-6 13:22:57 | 显示全部楼层

回 9楼(疯人¢衰人) 的帖子

不知道为什么
新建一张地图 就可以调用了
这个算是悲剧吗
回复

使用道具 举报

发表于 2010-9-6 13:59:09 | 显示全部楼层

回 10楼(88386896) 的帖子

函数名 或是 变量名冲突?
回复

使用道具 举报

发表于 2010-9-6 21:02:26 | 显示全部楼层
同样会报语法错误吧……
干脆换全局的GC,将GC前加udg_
回复

使用道具 举报

发表于 2010-10-24 12:51:44 | 显示全部楼层
他不是已经提示了吗
不能调用后面地函数
要用就把funover放到yidong前面去
难道这里已经真的没一个高手?
回复

使用道具 举报

发表于 2010-10-25 09:08:54 | 显示全部楼层
local 全部放到函数中最前面
回复

使用道具 举报

发表于 2010-11-22 15:38:37 | 显示全部楼层
你的问题 我好像遇到过  

全部都正确的  就是不能调用    后来 我新建了一个触发   然后事件 条件 复制过去  

动作  调用   就可以了  把原来的删了
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-3 15:59 , Processed in 0.054318 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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