|
本帖最后由 LANGRENBULE 于 2013-1-26 23:17 编辑
@lfglvstory @chyj4747
以下的代码,在英雄生产出来后,攻击线程就直接死掉了。魔兽无错误信息退出- function attackAssignment takes nothing returns nothing
- local unit target //攻击目标
- call StaggerSleep( 0, 2 ) //睡眠功能
- //攻击循环
- loop
- call Sleep(2.0)
- call DisplayTextToPlayer(GetLocalPlayer(),0,0,"outter loop ing")
- if GetUnitCountDone('Ofar')>0 then
- call Sleep(2.0)
- call printf("ready to attack!!!")
- call InitAssaultGroup() //进攻组的指令,初始化进攻组
- call SetAssaultGroup(GetUnitCountDone('Ofar'),GetUnitCountDone('Ofar'), 'Ofar' )
- //call SetAssaultGroup(GetUnitCountDone('Otch'),GetUnitCountDone('Otch'), 'Otch' )
- //call SetAssaultGroup(GetUnitCountDone('Oshd'),GetUnitCountDone('Oshd'), 'Oshd' )
- //call SetAssaultGroup(GetUnitCountDone('ogru'),GetUnitCountDone('ogru'), 'ogru' )
- //call SetAssaultGroup(GetUnitCountDone('ohun'),GetUnitCountDone('ohun'), 'ohun' )
- // call SetAssaultGroup(GetUnitCountDone('orai'),GetUnitCountDone('orai'), 'orai' )
- //call SetAssaultGroup(GetUnitCountDone('okod'),GetUnitCountDone('okod'), 'okod' )
- // call SetAssaultGroup(GetUnitCountDone('owyv'),GetUnitCountDone('owyv'), 'owyv' )
- // call SetAssaultGroup(GetUnitCountDone('oshm'),GetUnitCountDone('oshm'), 'oshm' )
- // call SetAssaultGroup(GetUnitCountDone('ospw'),GetUnitCountDone('ospw'), 'ospw' )
- // call SetAssaultGroup(GetUnitCountDone('otau'),GetUnitCountDone('otau'), 'otau' )
- set target = GetEnemyBase() //敌人基地
- if target == null then
- call StartGetEnemyBase() //寻找主基地
- loop
- call DisplayTextToPlayer(GetLocalPlayer(),0,0,"inner loop ing")
- exitwhen (not WaitGetEnemyBase()) //找不到主基地
- call SuicideSleep(5) //睡眠功能
- endloop
- call DisplayTextToPlayer(GetLocalPlayer(),0,0,"can not found enemy")
- else
- call DisplayTextToPlayer(GetLocalPlayer(),0,0,"========start========")
- call FormGroup( 5, false) //集结队伍,5是时间秒数,false指英雄是否准备好
- call AttackMoveKill(target) //攻击组攻击单位,直到target被杀死
- call SleepUntilAtGoal() //等待直至攻击组抵达目的地
- call SleepInCombat() //等待直至攻击组结束战斗
- call Sleep(1.0)
- call DisplayTextToPlayer(GetLocalPlayer(),0,0,"========end==========")
- endif
-
- endif
- endloop
- endfunction
复制代码 不过这样的攻击线程也太落后了。给个更好的思路?当然,先帮我看看为什么会死掉
|
|