找回密码
 点一下
查看: 6196|回复: 6

哦,发几个比较土鳖的函数

[复制链接]
发表于 2007-12-6 17:50:30 | 显示全部楼层 |阅读模式
这个是很土的DEBUG函数

[jass]function MSG takes string s returns nothing
   call DisplayTextToPlayer(Player(0),0,0,s)
endfunction[/jass]

这是同样很土的文字颜色函数

[jass]function AddColorForString takes integer p,string s returns string
   if(p==0)then
      return "|cFFFF0000"+s+"|r"
   elseif(p==1)then
      return "|cFF0000FF"+s+"|r"
   elseif(p==2)then
      return "|cFF00FFFF"+s+"|r"
   elseif(p==3)then
      return "|cFF9000FF"+s+"|r"
   elseif(p==4)then
      return "|cFFFFFF00"+s+"|r"
   elseif(p==5)then
      return "|cFFFF8000"+s+"|r"
   elseif(p==6)then
      return "|cFF00FF00"+s+"|r"
   elseif(p==7)then
      return "|cFFFF80C0"+s+"|r"
   elseif(p==8)then
      return "|cFFC0C0C0"+s+"|r"
   elseif(p==9)then
      return "|cFF5AC6DC"+s+"|r"
   elseif(p==10)then
      return "|cFF004040"+s+"|r"
   elseif(p==11)then
      return "|cFF804000"+s+"|r"
   elseif(p==12 or p==13)then
      return "|cFF5A3001"+s+"|r"
   endif
   return s
endfunction[/jass]

很土把

这是个参数简单的漂浮文字函数

[jass]function ShowStrPosUnitCfg takes unit su, unit tu, string str, integer style, real b,boolean RandomPos, boolean ColorCfg, boolean VisableCfg returns nothing
    local integer R = 0
    local integer G = 0
    local integer B = 0
    local integer Alpha = 0
    local integer zOffset = 0
    local real size = 0
    local real vx = 0.00
    local real vy = 55.00
    local real lifespan = 0
    local texttag tt
    if(RandomPos)then
       set vx = GetRandomReal(-15,5)
       set vy = GetRandomReal(30,50)
    endif
    if(style==0)then
       set R = 255
       set G = 125
       set B = 0
       set zOffset = 0
       set size = 10*b
       set Alpha = 255
       set lifespan = 1.5
    elseif(style==1)then
       set R = 255
       set G = 0
       set B = 0
       set zOffset = 0
       set size = 10*b
       set Alpha = 255
       set lifespan = 1.5
    elseif(style==2)then
       set R = 0
       set G = 255
       set B = 0
       set zOffset = 0
       set size = 10*b
       set Alpha = 255
       set lifespan = 1.5
    elseif(style==3)then
       set R = 0
       set G = 0
       set B = 255
       set zOffset = 0
       set size = 10*b
       set Alpha = 255
       set lifespan = 1.5
    elseif(style==4)then
       set R = 128
       set G = 128
       set B = 128
       set zOffset = 0
       set size = 10*b
       set Alpha = 255
       set lifespan = 1.5
    elseif(style==5)then
       set R = 255
       set G = 230
       set B = 0
       set zOffset = 0
       set size = 10*b
       set Alpha = 255
       set lifespan = 1.5
    else
       set R = 255
       set G = 255
       set B = 255
       set zOffset = 0
       set size = 10*b
       set Alpha = 255
       set lifespan = 1.5
    endif
   
    if(GetGameStatus(SYS_GAME_STATUS_COLOR_CONFIG))then
       if(GetOwningPlayer(tu)==GetLocalPlayer())then
          set R = 255
          set G = 255
          set B = 255
       endif
    endif

    set tt = CreateTextTag()
    call SetTextTagText(tt,str,(size*0.023/10))
    call SetTextTagColor(tt,R,G,B,Alpha)
    call SetTextTagPosUnit(tt,tu,zOffset/1000)
    call SetTextTagVelocity(tt,vx/1000,vy/1000)
    call SetTextTagPermanent(tt,false)
    call SetTextTagLifespan(tt,lifespan)
    if(VisableCfg)then
       if(GetStatusForPlayer(GetPlayerId(GetLocalPlayer()),SYS_PLAYER_STATUS_HIDE_DAMAGE_INFO))then
          call SetTextTagVisibility(tt,false)
       endif
       if(GetOwningPlayer(su)!=GetLocalPlayer() and GetOwningPlayer(tu)!=GetLocalPlayer() and GetStatusForPlayer(GetPlayerId(GetLocalPlayer()),SYS_PLAYER_STATUS_HIDE_DAMAGE_INFO_OTHERPLAYER))then
          call SetTextTagVisibility(tt,false)
       endif
       if(not(IsUnitType(su,UNIT_TYPE_HERO))and not(IsUnitType(tu,UNIT_TYPE_HERO)) and GetStatusForPlayer(GetPlayerId(GetLocalPlayer()),SYS_PLAYER_STATUS_HIDE_DAMAGE_INFO_NOHERO))then
          call SetTextTagVisibility(tt,false)
       endif
    endif
    set tt = null
endfunction[/jass]

还有个土的

[jass]function UnitGetGold takes unit u,real x,real y, integer g,integer g_ex returns nothing
    local integer R = 255
    local integer G = 225
    local integer B = 0
    local integer Alpha = 255
    local integer zOffset = 0
    local real size = 10
    local real vx = 0.00
    local real vy = 60.00
    local real lifespan = 1.00
    local texttag tt = CreateTextTag()
    local integer gold = g
    local string str = "+"+I2S(gold)
    if(g_ex>0)then
       set gold = g + g_ex
       set str = str + "(+"+I2S(g_ex)+")"
    endif

    call SetPlayerState(GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD)+gold)

    call SetTextTagText(tt,str,(size*0.023/10))
    call SetTextTagColor(tt,R,G,B,Alpha)
    call SetTextTagPos(tt,x,y,zOffset/1000)
    call SetTextTagVelocity(tt,vx/1000,vy/1000)
    call SetTextTagPermanent(tt,false)
    call SetTextTagLifespan(tt,lifespan)

    if(GetOwningPlayer(u)!=GetLocalPlayer())then
       call SetTextTagVisibility(tt,false)
    endif
    set tt = null
    set str = null
endfunction[/jass]
发表于 2007-12-7 11:21:05 | 显示全部楼层
虽然土,MS很强大
回复

使用道具 举报

发表于 2007-12-7 19:50:33 | 显示全部楼层
有什么用????????
回复

使用道具 举报

 楼主| 发表于 2007-12-7 20:18:22 | 显示全部楼层
恩。。简化一些操作。
回复

使用道具 举报

发表于 2007-12-9 18:15:01 | 显示全部楼层
我操~~果然不是一般的耐烦....
一般直接BJDebugMsg
回复

使用道具 举报

发表于 2007-12-10 15:51:33 | 显示全部楼层
管住你的舌头~~注意文明用语~~

否则下次它就会被割掉了~~
回复

使用道具 举报

发表于 2011-10-11 23:15:45 | 显示全部楼层
虽然看起来很土鳖,不过很实用啊
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 17:48 , Processed in 0.082379 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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