找回密码
 点一下
查看: 11492|回复: 9

JASS的隐藏函数(SetTextTagLifespan等)??? (已解决)

[复制链接]
发表于 2006-4-23 14:07:06 | 显示全部楼层 |阅读模式
今天在研究暴雪的"空袭指挥官"时, 意外的发现它里面处理飘浮文字的时候用了下面几个函数:
  set ttGold = CreateTextTagUnitBJ( Message, whichUnit, 50, 10, 100, 100, 0, 0 )
    call SetTextTagPermanent( ttGold, false )
    call SetTextTagVelocityBJ( ttGold, 64, 90 )
    call SetTextTagLifespan( ttGold, 3 )
    call SetTextTagFadepoint( ttGold, 1 )  


其中红色的函数我在JASS手册和JASSSHOPPRO里都没有查到(可能common.j里面有定义, 懒, 没去看).
   不过这几个函数配合使用可以不必借助定时器, 创造出像"致命一击"那种向上消隐的文字.

[ 本帖最后由 zyl910 于 2006-4-24 01:05 编辑 ]
发表于 2006-4-23 14:08:41 | 显示全部楼层
1.18的新函数
回复

使用道具 举报

发表于 2006-4-23 14:09:10 | 显示全部楼层
1.17 -> 1.18 Jass函数改动列表 by Soar Chin

Common.j:
a)增加类型
  type pathingtype        extends     handle  // 地形路径类型
  type image              extends     handle  // 图像类型
  type ubersplat          extends     handle  // 地面纹理类型

b)增加常量
  constant pathingtype        PATHING_TYPE_ANY                = ConvertPathingType(0) // 任何单位都能通过的地形
  constant pathingtype        PATHING_TYPE_WALKABILITY        = ConvertPathingType(1) // 只有步行单位才能通过的地形
  constant pathingtype        PATHING_TYPE_FLYABILITY         = ConvertPathingType(2) // 只有飞行单位才能通过的地形
  constant pathingtype        PATHING_TYPE_BUILDABILITY       = ConvertPathingType(3) // 可以建造建筑的地形
  constant pathingtype        PATHING_TYPE_PEONHARVESTPATHING = ConvertPathingType(4) // 采矿和伐木中的农民可以穿过的地形
  constant pathingtype        PATHING_TYPE_BLIGHTPATHING      = ConvertPathingType(5) // 不死族的腐蚀地表的地形
  constant pathingtype        PATHING_TYPE_FLOATABILITY       = ConvertPathingType(6) // 允许漂浮水面行走的地形
  constant pathingtype        PATHING_TYPE_AMPHIBIOUSPATHING  = ConvertPathingType(7) // 允许两栖行走的地形

  constant unittype UNIT_TYPE_TAUREN                      = ConvertUnitType(20) // 单位类型-牛头族
  constant unittype UNIT_TYPE_POISONED                    = ConvertUnitType(21) // 单位类型-中毒的
  constant unittype UNIT_TYPE_POLYMORPHED                 = ConvertUnitType(22) // 单位类型-变成小羊的
  constant unittype UNIT_TYPE_SLEEPING                    = ConvertUnitType(23) // 单位类型-睡眠的
  constant unittype UNIT_TYPE_RESISTANT                   = ConvertUnitType(24) // 单位类型-魔法抵抗的
  constant unittype UNIT_TYPE_ETHEREAL                    = ConvertUnitType(25) // 单位类型-无形的
  constant unittype UNIT_TYPE_MAGIC_IMMUNE                = ConvertUnitType(26) // 单位类型-魔法免疫的

c)增加函数
  // 获得坐标的Z方向值(和镜头有关), 在不同的电脑上可能得到不同的值, 请勿用于联机游戏中需要同步数据的场合
  native GetLocationZ             takes location whichLocation returns real

//  Text Tag 系列
  // 设置文字标签是否停止运动
  native SetTextTagSuspended          takes texttag t, boolean flag returns nothing

  // 设置文字标签是否永久存在
  native SetTextTagPermanent          takes texttag t, boolean flag returns nothing

  // 设置文字标签的已存在的时间长度
  native SetTextTagAge                takes texttag t, real age returns nothing

  // 设置文字标签的允许存在时间
  native SetTextTagLifespan           takes texttag t, real lifespan returns nothing

  // 设置文字标签的淡化点
  native SetTextTagFadepoint          takes texttag t, real fadepoint returns nothing

// 选择系列
  // 设置是否框选单位以及允许框选单位后是否显示在界面上
  native EnableDragSelect             takes boolean state, boolean ui returns nothing

  // 设置是否预选单位以及允许预选单位后是否显示在界面上(也就是鼠标移到一个单位身上时显示其生命)
  native EnablePreSelect              takes boolean state, boolean ui returns nothing

  // 设置是否选择单位以及允许框选后是否显示在界面上
  native EnableSelect                 takes boolean state, boolean ui returns nothing

// Lighting 系列
  // 添加闪电效果, 和AddLightning比多了Z方向参数
  native AddLightningEx               takes string codeName, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2 returns lightning

  // 移动闪电, 和MoveLightning比多了Z方向参数
  native MoveLightningEx              takes lightning whichBolt, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2 returns boolean

// 地形系列
  // 得到对应坐标的地形类型
  native GetTerrainType               takes real x, real y returns integer

  // 得到对应坐标的地形的高低差指数
  native GetTerrainVariance           takes real x, real y returns integer

  // 得到对应坐标的地形类型
  native SetTerrainType               takes real x, real y, integer terrainType, integer variation, integer area, integer shape returns nothing

  // 检查对应坐标的地形是否符合地形路径类型
  native IsTerrainPathable            takes real x, real y, pathingtype t returns boolean

  // 设置对应坐标的地形的路径类型
  native SetTerrainPathable           takes real x, real y, pathingtype t, boolean flag returns nothing

// 图像系列
  // 从文件创建图像
  // 变量imageType的值对应: 0 - 影子, 1 - 选择圈, 2 - 指示器(?鼠标or what?), 3 - 碰撞标志, 4 - 地面纹理, 5 - 上一次使用的值(仅用于GetImageType)
  native CreateImage                  takes string file, real sizeX, real sizeY, real sizeZ, real posX, real posY, real posZ, real originX, real originY, real originZ, integer imageType returns image

  // 删除图像变量并释放内存
  native DestroyImage                 takes image whichImage returns nothing

  // 显示图像
  native ShowImage                    takes image whichImage, boolean flag returns nothing

  // 设置图像高度
  native SetImageConstantHeight       takes image whichImage, boolean flag, real height returns nothing

  // 设置图像位置
  native SetImagePosition             takes image whichImage, real x, real y, real z returns nothing

  // 设置图像颜色
  native SetImageColor                takes image whichImage, integer red, integer green, integer blue, integer alpha returns nothing

  // 设置图像是否着色
  native SetImageRender               takes image whichImage, boolean flag returns nothing

  // 设置图像是否总是着色
  native SetImageRenderAlways         takes image whichImage, boolean flag returns nothing

  // 这是图像是否高于水平面
  native SetImageAboveWater           takes image whichImage, boolean flag, boolean useWaterAlpha returns nothing

  // 设置图像类型, imageType取值见CreateImage
  native SetImageType                 takes image whichImage, integer imageType returns nothing

// 地面纹理系列
  // 创建地面纹理(可以模拟从头开始建造的过程)
  native CreateUbersplat              takes real x, real y, string name, integer red, integer green, integer blue, integer alpha, boolean forcePaused, boolean noBirthTime returns ubersplat

  // 删除地面纹理变量并释放内存
  native DestroyUbersplat             takes ubersplat whichSplat returns nothing

  // 重置地面纹理
  native ResetUbersplat               takes ubersplat whichSplat returns nothing

  // 完成地面纹理(相当于直接完成建造后的地面纹理)
  native FinishUbersplat              takes ubersplat whichSplat returns nothing

  // 显示地面纹理
  native ShowUbersplat                takes ubersplat whichSplat, boolean flag returns nothing

  // 设置地面纹理是否着色
  native SetUbersplatRender           takes ubersplat whichSplat, boolean flag returns nothing

  // 设置地面纹理是否总是着色
  native SetUbersplatRenderAlways     takes ubersplat whichSplat, boolean flag returns nothing



Blizzard.j:
a)增加全局变量
  image              bj_lastCreatedImage         = null  // 用于CreateImageBJ
  ubersplat          bj_lastCreatedUbersplat     = null  // 用于CreateUbersplatBJ

b) 改变的函数
  // 改为使用AddLightningEx
  function AddLightningLoc takes string codeName, location where1, location where2 returns lightning
    set bj_lastCreatedLightning = AddLightningEx(codeName, true, GetLocationX(where1), GetLocationY(where1), GetLocationZ(where1), GetLocationX(where2), GetLocationY(where2), GetLocationZ(where2))
    return bj_lastCreatedLightning
  endfunction

  // 改为使用MoveLightningEx
  function MoveLightningLoc takes lightning whichBolt, location where1, location where2 returns boolean
    return MoveLightningEx(whichBolt, true, GetLocationX(where1), GetLocationY(where1), GetLocationZ(where1), GetLocationX(where2), GetLocationY(where2), GetLocationZ(where2))
  endfunction

  // 第一个参数从原来的string abilString变为integer abilcode
  function GetAbilityEffectBJ takes integer abilcode, effecttype t, integer index returns string
    return GetAbilityEffectById(abilcode, t, index)
  endfunction

  // 第一个参数从原来的string abilString变为integer abilcode
  function GetAbilitySoundBJ takes integer abilcode, soundtype t returns string
    return GetAbilitySoundById(abilcode, t)
  endfunction

  // 由SetTextTagText改为使用SetTextTagTextBJ
  function CreateTextTagLocBJ takes string s, location loc, real zOffset, real size, real red, real green, real blue, real transparency returns texttag
    set bj_lastCreatedTextTag = CreateTextTag()
    call SetTextTagTextBJ(bj_lastCreatedTextTag, s, size)
    call SetTextTagPosBJ(bj_lastCreatedTextTag, loc, zOffset)
    call SetTextTagColorBJ(bj_lastCreatedTextTag, red, green, blue, transparency)

    return bj_lastCreatedTextTag
  endfunction

  // 由SetTextTagText改为使用SetTextTagTextBJ
  function CreateTextTagUnitBJ takes string s, unit whichUnit, real zOffset, real size, real red, real green, real blue, real transparency returns texttag
    set bj_lastCreatedTextTag = CreateTextTag()
    call SetTextTagTextBJ(bj_lastCreatedTextTag, s, size)
    call SetTextTagPosUnitBJ(bj_lastCreatedTextTag, whichUnit, zOffset)
    call SetTextTagColorBJ(bj_lastCreatedTextTag, red, green, blue, transparency)

    return bj_lastCreatedTextTag
  endfunction

c)增加的函数
  // 以下为地形函数对应的BJ系列
  function GetTerrainTypeBJ takes location where returns integer
    return GetTerrainType(GetLocationX(where), GetLocationY(where))
  endfunction

  function GetTerrainVarianceBJ takes location where returns integer
    return GetTerrainVariance(GetLocationX(where), GetLocationY(where))
  endfunction

  function SetTerrainTypeBJ takes location where, integer terrainType, integer variation, integer area, integer shape returns nothing
    call SetTerrainType(GetLocationX(where), GetLocationY(where), terrainType, variation, area, shape)
  endfunction

  function IsTerrainPathableBJ takes location where, pathingtype t returns boolean
    return IsTerrainPathable(GetLocationX(where), GetLocationY(where), t)
  endfunction

  function SetTerrainPathableBJ takes location where, pathingtype t, boolean flag returns nothing
    call SetTerrainPathable(GetLocationX(where), GetLocationY(where), t, flag)
  endfunction

  // 以下为图像函数对应的BJ系列
  function CreateImageBJ takes string file, real size, location where, real zOffset, integer imageType returns image
    set bj_lastCreatedImage = CreateImage(file, size, size, size, GetLocationX(where), GetLocationY(where), zOffset, 0, 0, 0, imageType)
    return bj_lastCreatedImage
  endfunction

  function ShowImageBJ takes boolean flag, image whichImage returns nothing
    call ShowImage(whichImage, flag)
  endfunction

  function SetImagePositionBJ takes image whichImage, location where, real zOffset returns nothing
    call SetImagePosition(whichImage, GetLocationX(where), GetLocationY(where), zOffset)
  endfunction

  function SetImageColorBJ takes image whichImage, real red, real green, real blue, real alpha returns nothing
    call SetImageColor(whichImage, PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-alpha))
  endfunction

  function GetLastCreatedImage takes nothing returns image
    return bj_lastCreatedImage
  endfunction

  // 以下为地面纹理函数对应的BJ系列
  function CreateUbersplatBJ takes location where, string name, real red, real green, real blue, real alpha, boolean forcePaused, boolean noBirthTime returns ubersplat
    set bj_lastCreatedUbersplat = CreateUbersplat(GetLocationX(where), GetLocationY(where), name, PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-alpha), forcePaused, noBirthTime)
    return bj_lastCreatedUbersplat
  endfunction

  function ShowUbersplatBJ takes boolean flag, ubersplat whichSplat returns nothing
    call ShowUbersplat(whichSplat, flag)
  endfunction

  function GetLastCreatedUbersplat takes nothing returns ubersplat
    return bj_lastCreatedUbersplat
  endfunction

  // 以下为TextTag函数对应的BJ系列
  function SetTextTagTextBJ takes texttag tt, string s, real size returns nothing
    local real textHeight = TextTagSize2Height(size)

    call SetTextTagText(tt, s, textHeight)
  endfunction

  function SetTextTagPosBJ takes texttag tt, location loc, real zOffset returns nothing
    call SetTextTagPos(tt, GetLocationX(loc), GetLocationY(loc), zOffset)
  endfunction

  function SetTextTagPosUnitBJ takes texttag tt, unit whichUnit, real zOffset returns nothing
    call SetTextTagPosUnit(tt, whichUnit, zOffset)
  endfunction

  function SetTextTagSuspendedBJ takes texttag tt, boolean flag returns nothing
    call SetTextTagSuspended(tt, flag)
  endfunction

  function SetTextTagPermanentBJ takes texttag tt, boolean flag returns nothing
    call SetTextTagPermanent(tt, flag)
  endfunction

  function SetTextTagAgeBJ takes texttag tt, real age returns nothing
    call SetTextTagAge(tt, age)
  endfunction

  function SetTextTagLifespanBJ takes texttag tt, real lifespan returns nothing
    call SetTextTagLifespan(tt, lifespan)
  endfunction

  function SetTextTagFadepointBJ takes texttag tt, real fadepoint returns nothing
    call SetTextTagFadepoint(tt, fadepoint)
  endfunction

Common.ai:
  没有改动
回复

使用道具 举报

 楼主| 发表于 2006-4-23 14:16:47 | 显示全部楼层
......看来资料要升级了

不过那个fadepoint是什么意思?参数还是整型的

[ 本帖最后由 helanmouse 于 2006-4-23 14:19 编辑 ]
回复

使用道具 举报

发表于 2006-4-23 18:16:50 | 显示全部楼层
原帖由 helanmouse 于 2006-4-23 14:16 发表
......看来资料要升级了

不过那个fadepoint是什么意思?参数还是整型的


整型?!


  1.   // 设置文字标签的淡化点
  2.   native SetTextTagFadepoint          takes texttag t, real fadepoint returns nothing
复制代码


淡化点是指过了那段时间之后texttag自动变淡(透明度提高),到了生存时间点时完全透明
回复

使用道具 举报

 楼主| 发表于 2006-4-23 21:17:06 | 显示全部楼层
彻底失败了~~竟然连参数都传错类55555如果用变量直接传估计会报错
回复

使用道具 举报

发表于 2006-4-23 21:23:15 | 显示全部楼层

这个几个函数早做成触发器了

http://www.infor.org/~n1048/WESe ... s/Floating_Text.htm

Floating Text(漂浮文字):
项目 内容 说明
Create Floating Text At Point Create floating text that reads Message at Point with Z offset Z, using font size Size, color (Red%, Green%, Blue%) and Transparency% transparency 在一地点建立一个漂浮文字,设定文字内容、高度、大小、颜色(红,绿,蓝,透明度)
Create Floating Text Above Unit Create floating text that reads Message above Unit with Z offset Z, using font size Size, color (Red%, Green%, Blue%) and Transparency% transparency 在一单位头上建立一个漂浮文字,设定文字内容、高度、大小、颜色(红,绿,蓝,透明度)

*漂浮文字不会跟着该单位移动
Destroy Destroy Floating Text 移除漂浮文字
Show/Hide Show/Hide Floating Text for Player Group 对玩者群组中的所有玩者 显示/隐藏 漂浮文字
Set Velocity Set the velocity of Floating Text to Speed towards Angle degrees 设定漂浮文字的位移角度及位移速度

*此动作只能设定一次
Change Color Change the color of Floating Text to (Red%, Green%, Blue%) with Transparency% transparency 改变漂浮文字的颜色(红,绿,蓝,透明度)
Change Position To Point Change the position of Floating Text to Point with Z offset Z 移动漂浮文字至指定位置,并设定高度
Change Position To Unit Change the position of Floating Text to Unit with Z offset Z 移动漂浮文字至指定单位头上,并设定高度
Change Text Change text of Floating Text to Message using font size Size 改变漂浮文字的内容和大小
Suspend/Resume Change Floating Text: Enable/Disable suspend state 开启/关闭 漂浮文字的年龄计算
Permanent/Expires Change Floating Text: Enable/Disable permeance 开启/关闭 漂浮文字的永久性

*此选项若为Enable则透明度会固定为0%无法改变,并且忽略寿命和衰退点的影响
Change Lifespan Change the lifespan of Floating Text to Time seconds 改变漂浮文字的寿命为X秒
Change Age Change the age of Floating Text to Time seconds 改变漂浮文字的年龄为X秒
Change Fading Age Change the fading age of Floating Text to Time seconds 改变漂浮文字的衰退时间点为X秒

 

当一个漂浮文字被创造出来时,持久属性为永久;suspend state=disable;年龄=0。只要suspend state=disable,年龄就随时间增加(每秒加1 )。
当一个时限的漂浮文字年龄?寿命时,漂浮文字就会被删掉 。如果你设定了寿命但没有把漂浮文字设为时限,那么寿命耗尽时文字不会消失。如果你把一个永久且年龄?寿命的漂浮文字设为时限,文字会立刻消失。
当一个时限的漂浮文字年龄?衰退点,漂浮文字就会开始逐渐变淡消失。淡化情形(透明度)为(年龄-衰退点)/(寿命-衰退点)*100%,忽略衰退当时的透明度(一个透明度50%的漂浮文字,会从0%衰退到100%,而不是从50%到100%)。如果你改变文字的年龄,淡化的程度也将随之改变,不过这种改变有一定的延迟。
如果没有设定寿命,则由于透明度无法计算,因此即使设了衰退点,也不会有淡化效果。
透明度的设定对永久的漂浮文字不会生效(0%)。但是如果你把一个透明度50%的漂浮文字的永久性关闭,之前对透明度的设定将立刻生效(透明度由0%变为50%)。
回复

使用道具 举报

发表于 2006-4-24 01:05:12 | 显示全部楼层
已修改标题,以后请按照Jass区版规发帖子:
http://bbs.ourga.com/thread-947-1-1.html
Jass区导航贴
回复

使用道具 举报

发表于 2006-4-24 03:36:13 | 显示全部楼层
.j文件要用war3patch里的来覆盖

还有,不看common.j......汗一个
我向来只用CJ,54BJ的说
回复

使用道具 举报

发表于 2006-4-24 14:53:16 | 显示全部楼层

路过

路过顶一下~~~~~~~~~~~~~~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-2 20:16 , Processed in 0.234741 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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