请选择 进入手机版 | 继续访问电脑版

 找回密码
 点一下
查看: 485|回复: 5

发一点BJ还原的纯JASS

[复制链接]
发表于 2021-6-13 16:14:37 | 显示全部楼层 |阅读模式
globals
constant 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
 楼主| 发表于 2021-6-13 16:26:40 | 显示全部楼层
//--------------播放声音-------------------------
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
//--------------------------
回复

使用道具 举报

 楼主| 发表于 2021-6-13 16:29:31 | 显示全部楼层
不知道有没有大佬会自定义 等待 这种.... 我感觉 好像JASS 办不到 LOOP里面计时器实数判定这种等待 太耗资源...
回复

使用道具 举报

 楼主| 发表于 2021-6-13 16:31:48 | 显示全部楼层

//------------------自定义移动镜头----
function PanCamera takes player whichPlayer, real x, real y, real duration returns nothing
if (GetLocalPlayer() == whichPlayer) then
call PanCameraToTimed(x, y, duration)
endif
endfunction
回复

使用道具 举报

 楼主| 发表于 2021-6-13 16:40:08 | 显示全部楼层
球个大佬 来个自定义等待, 我只想这个等待函数 只停用Loop  , 脚本里的等待 只有停只整个线程和玩家的... 蛋疼  很多时候调用 只用停止 Loop 触发里 行 脚本里就不行了 ...  函数问题  好蠢的暴雪...
回复

使用道具 举报

 楼主| 发表于 2021-6-15 06:47:41 | 显示全部楼层
最后开是靠自己解决,自定义等待可以运行在主函数以外的 地方,AI的线程初始化 不能运行 自定义等待 汗!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-3-29 00:06 , Processed in 0.081526 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表