|
用风暴之鸦做的
[jass]
function handle2int takes handle h returns integer
return h
return 0
endfunction
function ShowText takes string str returns nothing
call DisplayTextToForce( GetPlayersAll(), str )
endfunction
function MsgBox takes player p, string msg,string text returns integer
local string s0="" //判断字符
local string s1 //截取字符
local trigger array t //单位组
local dialog dlg=DialogCreate() //新建马甲
local boolean array disable
local integer i=0
local integer n=0
local integer j=0
local string HOTKEY="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if ( p==null or text=="") then // P OR TEXT要同时成立
call DialogDestroy(dlg)
return 0
endif
set t[0]=CreateTrigger()
call TriggerRegisterDialogEvent(t[0],dlg)
//以逗号截取字符串,创建按钮
loop
set s1=SubString(text,i,i+1)
if ( s1=="" or s1=="," ) then
exitwhen s0=="" //防止字符串是以逗号结束
set n=n+1
set t[n]=CreateTrigger()
if ( SubString(s0,0,2)=="//" ) then //以//开头,表示禁用
set s0="|c00808080"+SubString(s0,2,255)+"["+SubString(HOTKEY,n-1,n)+"]|r"
set disable[n]=true
else
set s0=s0+"["+SubString(HOTKEY,n-1,n)+"]"
endif
call TriggerRegisterDialogButtonEvent(t[n], DialogAddButton( dlg, s0,n+0x40))
set s0=""
else
set s0=s0+s1
endif
exitwhen s1==""
set i=i+1
endloop
//显示对话框,并一直循环
call DialogSetMessage(dlg, msg )
call DialogDisplay( p, dlg, true)
loop
exitwhen GetTriggerEvalCount(t[0])>0
call TriggerSleepAction(0)
endloop
//释放内存,并检测按下的按钮是哪个
set i=0
loop
exitwhen i>n
if GetTriggerEvalCount(t)>0 then
set j=i
endif
call DestroyTrigger(t)
set i=i+1
endloop
call DialogClear(dlg)
call DialogDestroy(dlg)
return IntegerTertiaryOp(disable[j],0,j)
endfunction
上面的 只在文本输入
在新建一个触发 名字定义为text
//鬼龙之舞
//没有什么技术含量
function Trig_test_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Trig_test_Func001002003 takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()))
endfunction
function Trig_test_Actions takes nothing returns nothing
local unit hero=GetTriggerUnit()
local unit u
local location loc= GetUnitLoc(hero)
local group g= GetUnitsInRangeOfLocMatching(512, loc, Condition(function Trig_test_Func001002003))
local integer n=0
local integer m
local unit array units
local player p=GetOwningPlayer(hero)
local real x=GetUnitX(hero)
local real y=GetUnitY(hero)
local integer i
local integer j
local real array angle
local integer t=0
if ( FirstOfGroup(g)!=null ) then
loop
set units[n]=FirstOfGroup(g)
exitwhen units[n]==null
set u= CreateUnit( p, 'hsor', x,y, bj_UNIT_FACING )
set angle[n]= bj_RADTODEG * Atan2(GetUnitY(units[n])-y , GetUnitX(units[n])-x)
//set angle[n]=AngleBetweenPoints(loc, GetUnitLoc(units[n]))
call UnitApplyTimedLifeBJ( 10.00, 'BTLF', u )
call ShowUnitHide(u )
call IssueTargetOrderBJ(u, "magicleash", units[n] )
//'Arav'是风暴乌鸦的技能代码
call UnitAddAbilityBJ( 'Arav', units[n] )
call SetUnitFlyHeightBJ(units[n], 250, 0.00 )
call GroupRemoveUnit(g,units[n])
set n=n+1
endloop
set m=n
call TriggerSleepAction( 0.5 )
loop
exitwhen m<=0 判断循环组
set i = 0
loop
exitwhen i > n
//'Bmlt' 是魔法效果的代码
if ( units!=null and UnitHasBuffBJ(units, 'Bmlt')==false ) then
call SetUnitFlyHeightBJ( units, GetUnitDefaultFlyHeight(units), 0.00 )
call UnitRemoveAbilityBJ( 'Arav', units )
set units=null
set m=m-1
else
set angle= angle+2
//call SetUnitPositionLoc(loc,PolarProjectionBJ(loc,500,angle)
call SetUnitX(units,x+ 500 * Cos( angle * bj_DEGTORAD))
call SetUnitY(units,y+ 500 * Sin( angle * bj_DEGTORAD))
endif
set i = i + 1
endloop
call TriggerSleepAction( 0.00 )
endloop
call DisplayTextToPlayer(p,0,0,"DONE")
endif
call DestroyGroup(g)
call RemoveLocation(loc)
endfunction
//===========================================================================
function InitTrig_test takes nothing returns nothing
set gg_trg_test = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_test, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_test, Condition( function Trig_test_Conditions ) )
call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction
[/jass]
我自己也觉得这个不是很小的吧 其实认真看也发觉 这个也不是很难学
|
|