找回密码
 点一下
楼主: 艾可蕾儿

<AI>Timer做的大钟锈掉了啊- -

[复制链接]
发表于 2009-11-14 13:38:55 | 显示全部楼层
楼主可以试下这个演示。

利用Jass的timer来报时。

当然实际情况下不要用这么笨的办法,用sleep计时即可。这里只是介绍下jass和AI的通讯方式。


[trigger]
Init AI
    Events
        Map initialization
    Conditions
    Actions
        AI - Start melee AI script for Player 2 (Blue): war3mapImported\\1.ai
[/trigger]
[trigger]
Send Command
    Events
        Time - Elapsed game time is 20.00 seconds
    Conditions
    Actions
        AI - Send Player 2 (Blue) the AI Command (1, 1)
[/trigger]


1.ai的内容:
[jass]
function main takes nothing returns nothing
  call Sleep( 2.0 )
  call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1,"Hallo World")
        loop
          if (GetLastCommand()==1 and GetLastData()==1) then  //获得从JASS来的上一个AI命令。
              call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1,"Hello World")
               call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1,"Over")
               call PopLastCommand() //将命令出栈,否则GetLastCommand()永远都是1,这样就会循环显示了。
          endif
          call Sleep( 1.0 )
       endloop  
endfunction

[/jass]

AICommand.w3x

17 KB, 下载次数: 6

回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-27 17:13 , Processed in 0.139818 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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