发一点BJ还原的纯JASS
globalsconstant real PIdtodeg = 3.14159
constant real Radtodeg = 180.0/PIdtodeg
endglobals
function GetRectQY takes real x, real y,real width,real height returns rect //以指定坐标返回矩形区域
return Rect( x - width*0.5, y - height*0.5, x + width*0.5, y + height*0.5 )
endfunction
//-------------------------两个坐标间的方向-----------------------------
function ZuoBiaoFangX takes real x1,real y1, real x,real y returns real
return Atan2(y1 - y, x1 - x)* Radtodeg
endfunction
//-----------------两个坐标之间的距离-----------------------
function zuobiaoJULi takes real x1,real y1,real x2,real y2 returns real
return SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
endfunction
//----------------------自定义圆半径算法-----------------
function Atan2CJ takes real y, real x returns real//--和Atan2BJ一样的 就该了 两个常量
return Atan2(y, x) * Radtodeg
endfunction //--------------播放声音-------------------------
function ToInt takes real percentage, integer max returns integer
local integer result = R2I(percentage * I2R(max) * 0.01)
if (result < 0) then
set result = 0
elseif (result > max) then
set result = max
endif
return result
endfunction
function SoundToUnit takes sound soundHandle, unit whichUnit returns nothing
call AttachSoundToUnit(soundHandle, whichUnit)
endfunction
function Volume takes sound soundHandle, real volumePercent returns nothing
call SetSoundVolume(soundHandle, ToInt(volumePercent, 127))
endfunction
function PlaySou takes sound soundHandle returns nothing
local sound lastPlayedSound = soundHandle
if (soundHandle != null) then
call StartSound(soundHandle)
endif
set lastPlayedSound=null
endfunction
//-------------播放声音自定义函数------------
function PlaySoundOnUnit takes sound soundHandle, real volumePercent, unit whichUnit returns nothing
call SoundToUnit(soundHandle, whichUnit)
call Volume(soundHandle, volumePercent)
call PlaySou(soundHandle)
endfunction
//-------------------------- 不知道有没有大佬会自定义 等待 这种.... 我感觉 好像JASS 办不到 LOOP里面计时器实数判定这种等待 太耗资源...
//------------------自定义移动镜头----
function PanCamera takes player whichPlayer, real x, real y, real duration returns nothing
if (GetLocalPlayer() == whichPlayer) then
call PanCameraToTimed(x, y, duration)
endif
endfunction 球个大佬 来个自定义等待, 我只想这个等待函数 只停用Loop, 脚本里的等待 只有停只整个线程和玩家的... 蛋疼很多时候调用 只用停止 Loop 触发里 行 脚本里就不行了 ...函数问题好蠢的暴雪...
最后开是靠自己解决,自定义等待可以运行在主函数以外的 地方,AI的线程初始化 不能运行 自定义等待 汗!!
页:
[1]