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
  • 相关阅读:
    mark::开源绘图工具graphviz
    bzoj1013球形空间产生器sphere 高斯消元(有系统差的写法
    背包专题练习
    仿射加密与S-DES加密算法的实现
    1178:成绩排序
    1177:奇数单增序列
    1176:谁考了第k名
    1311:【例2.5】求逆序对
    1310:【例2.2】车厢重组
    1175:除以13
  • 原文地址:https://www.cnblogs.com/IntelligentBrain/p/5111323.html
Copyright © 2011-2022 走看看