|
这个是很土的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] |
|