zoukankan      html  css  js  c++  java
  • jass脚本调了一个下午

    globals
        boolean isDebug=true

        unit mHero = null 

        constant integer SMART=851971   //右键单击
        constant integer STOP=851972    //停止
        constant integer ATTACK=851983  //攻击
        constant integer ATTACKGROUND=851984    //攻击地面
        constant integer MOVE=851986   //移动
        constant integer PATROL=851990 //巡逻
        constant integer HOLD=851993   //保持原位

    endglobals
    function printf takes string msg returns nothing
        if isDebug then
            call DisplayTextToPlayer(GetLocalPlayer(),0,0,msg)
        endif
    endfunction

    function selectHero takes nothing returns unit
        local unit u = null
        local group g = CreateGroup()
        call GroupEnumUnitsOfPlayer(g,ai_player,null)
        loop
            set u = FirstOfGroup(g)
            exitwhen u==null
            if IsUnitType(u,UNIT_TYPE_HERO) and not IsUnitIllusion(u) then
                return u
            endif
            call GroupRemoveUnit(g,u)
        endloop
        call RemoveUnit(u)
        set u=null
        return null
    endfunction
    //为玩家2创建守鹤
    function CreateUnitById takes player playerId,integer unitId returns nothing
        call CreateUnit(playerId,unitId,3600,3300,90)
    endfunction
    function  gotoRandomLoc takes nothing returns nothing
        local location loc = null
        loop
            set mHero = selectHero()
            exitwhen mHero==null
            set loc = Location(GetRandomReal(-4000,4000),GetRandomReal(-4000,4000))

            call Sleep(10)    

            call IssuePointOrderByIdLoc(mHero,'attack',loc) //这边出错,因为没定义attack  ---851983

            call RemoveLocation(loc)
            set loc = null
        endloop
    endfunction
    function main takes nothing returns nothing
        call printf("Init AI>>>")
        call InitAI()//初始化AI
        call Sleep(10)
        call CreateUnitById(ai_player,'H002')
        call Sleep(1.0)
        call selectHero()
        call StartThread(function gotoRandomLoc)
    endfunction
  • 相关阅读:
    Bootstrap学习笔记(2)--栅格系统深入学习
    如何用手机访问电脑上的html文件
    Jquery学习笔记(11)--jquery的ajax删除用户,非常简单!
    Jquery学习笔记(10)--ajax删除用户,使用了js原生ajax
    Jquery学习笔记(9)--注册验证复习(未用到ajax)
    CSS学习笔记(3)--表格边框
    CSS学习笔记(2)--html中checkbox和radio
    Jquery学习笔记(8)--京东导航菜单(2)增加弹框
    Jquery学习笔记(7)--京东导航菜单
    CSS学习笔记(1)--浮动
  • 原文地址:https://www.cnblogs.com/IntelligentBrain/p/5111323.html
Copyright © 2011-2022 走看看