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
  • 相关阅读:
    并查集分析+总结
    poj 3083 Children of the Candy Corn(bfs+dfs 数组模拟方向)
    poj 1094 Sorting It All Out (拓扑排序)
    poj 2632 Crashing Robots(模拟)
    poj 1068 Parencodings (模拟)
    poj 1273 Drainage Ditches ( 最大流Edmonds_karp算法)
    poj 3278 Catch That Cow (BFS)
    Codeforces Round #109 (Div. 2) 总结
    poj 2299 UltraQuickSort(归并排序)
    poj 1035 Spell checker(字符串)
  • 原文地址:https://www.cnblogs.com/IntelligentBrain/p/5111323.html
Copyright © 2011-2022 走看看