魔兽地图编辑器吧 关注:65,271贴子:3,839,978
  • 17回复贴,共1

想知道怎么把别人jass的东西,复制到其他图,而且能适用?

只看楼主收藏回复

jass的文字如下
1 library UnitAnimation
globals
private integer StructMax = 0
endglobals
struct Animation
integer UnitType
integer WalkAnimation
integer ElseWalkAnimation
integer StandAnimation
integer DeepWaterStand
real MoveSpeed
static Animation data
static method TurnUnitAnimation takes integer UnitType returns integer
local integer i = 0
local integer TurnIndex = 0
loop
exitwhen i > StructMax
set data = i
if data.UnitType == UnitType then
set TurnIndex = data.WalkAnimation
exitwhen true
endif
set i = i + 1
endloop
return TurnIndex
endmethod
static method TurnUnitMoveSpeed takes integer UnitType returns real
local integer i = 0
local real TurnSpeed = 0
loop
exitwhen i > StructMax
set data = i
if data.UnitType == UnitType then
set TurnSpeed = data.MoveSpeed
exitwhen true
endif
set i = i + 1
endloop
return TurnSpeed
endmethod
static method TurnUnitElseWalkAnimation takes integer UnitType returns integer
local integer i = 0
local integer TurnIndex = 0
loop
exitwhen i > StructMax
set data = i
if data.UnitType == UnitType then
set TurnIndex = data.ElseWalkAnimation
exitwhen true
endif
set i = i + 1
endloop
return TurnIndex
endmethod
static method TurnUnitDeepWaterStand takes integer UnitType returns integer
local integer i = 0
local integer TurnIndex = 0
loop
exitwhen i > StructMax
set data = i
if data.UnitType == UnitType then
set TurnIndex = data.DeepWaterStand
exitwhen true
endif
set i = i + 1
endloop
return TurnIndex
endmethod
static method TurnUnitStandAnimation takes integer UnitType returns integer
local integer i = 0
local integer TurnIndex = 0
loop
exitwhen i > StructMax
set data = i
if data.UnitType == UnitType then
set TurnIndex = data.StandAnimation
exitwhen true
endif
set i = i + 1
endloop
return TurnIndex
endmethod
endstruct
//设置单位的行走索引
function SaveUnitAnimation takes integer UnitType,integer WalkAnimation returns nothing
local Animation dat
set StructMax = StructMax + 1
set dat = Animation.create()
set dat.UnitType = UnitType
set dat.WalkAnimation = WalkAnimation
endfunction
//! textmacro_once SaveAnimation takes func_name,type
function SaveUnit$func_name$ takes integer UnitType,$type$ value returns nothing
local Animation dat
local integer i = 0
loop
exitwhen i > StructMax
set dat = i
if dat.UnitType == UnitType then
set dat.$func_name$= value
endif
set i = i + 1
endloop
endfunction
//! endtextmacro
//! runtextmacro SaveAnimation ("ElseWalkAnimation","integer")
//! runtextmacro SaveAnimation ("MoveSpeed","real")
//! runtextmacro SaveAnimation ("DeepWaterStand","integer")
//! runtextmacro SaveAnimation ("StandAnimation","integer")
//! textmacro_once Turn takes func_name,type
function TurnUnit$func_name$ takes unit UnitType returns $type$
return Animation.TurnUnit$func_name$(GetUnitTypeId(UnitType))
endfunction
//! endtextmacro
//! runtextmacro Turn ("ElseWalkAnimation","integer")
//! runtextmacro Turn ("Animation","integer")
//! runtextmacro Turn ("MoveSpeed","real")
//! runtextmacro Turn ("DeepWaterStand","integer")
//! runtextmacro Turn ("StandAnimation","integer")
endlibrary
先说清楚了,我是个完全不懂jass的人!



IP属地:浙江1楼2012-08-31 23:10回复
    挽尊


    IP属地:四川2楼2012-08-31 23:11
    回复
      2025-06-21 10:27:45
      广告
      先学吧 等你能看懂了 也就会移植了


      IP属地:北京3楼2012-08-31 23:12
      收起回复
        哦。那就去学。没人帮你干这个的。


        IP属地:广东4楼2012-08-31 23:12
        回复
          2
          //这里是常量设置,你可以根据你喜欢的数值去改掉默认值
          //被锁定的单位必须要拥有移动速度且不是建筑,生命值不为0
          library DefalutSystem
          function UnitMove takes unit u,real Former,real Latter returns nothing
          local real AppriseX = GetUnitX(u)
          local real AppriseY = GetUnitY(u)
          local boolean NotifyX
          local boolean NotifyY
          call SetUnitPosition(u, Former, Latter)
          if (RAbsBJ(GetUnitX(u) - Former) > .5) or (RAbsBJ(GetUnitY(u) - Latter) > .5) then
          call SetUnitPosition(u, Former, AppriseY)
          set NotifyX = RAbsBJ(GetUnitX(u) - Former) <= .5
          call SetUnitPosition(u, AppriseX, Latter)
          set NotifyY = RAbsBJ(GetUnitY(u) - Latter) <= .5
          if NotifyX then
          call SetUnitPosition(u, Former, AppriseY)
          elseif NotifyY then
          call SetUnitPosition(u, AppriseX, Latter)
          else
          call SetUnitPosition(u, AppriseX, AppriseY)
          endif
          endif
          endfunction
          function CheckZ takes unit u returns real
          local real Photograph1
          local real Photograph2
          local real Photograph3
          local real Partial_Axis
          local real x = GetUnitX(u)
          local real y = GetUnitY(u)
          call MoveLocation(Locus, x, y)
          set Photograph1 = GetLocationZ(Locus)
          call MoveLocation(Locus, x - 400 * Cos(GetUnitFacing(u) * .01745), y - 400 * Sin(GetUnitFacing(u) * .01745))
          set Photograph2 = GetLocationZ(Locus)
          call MoveLocation(Locus, x + 400 * Cos(GetUnitFacing(u) * .01745), y + 400 * Sin(GetUnitFacing(u) * .01745))
          set Photograph3 = GetLocationZ(Locus)
          if GetOwningPlayer(u) == GetLocalPlayer() then
          if Photograph3 >= Photograph1+ 100 then
          set Partial_Axis =GetCameraField(CAMERA_FIELD_ZOFFSET) + GetUnitFlyHeight(u) + Photograph3 - GetCameraEyePositionZ()
          set Position1 = 10
          elseif (Photograph1 + 100 >= Photograph2) then
          set Partial_Axis =GetCameraField(CAMERA_FIELD_ZOFFSET) + 300 + GetUnitFlyHeight(u) + Photograph1 - GetCameraEyePositionZ()
          set Position1 = -15
          else
          set Partial_Axis =GetCameraField(CAMERA_FIELD_ZOFFSET) + 300 + GetUnitFlyHeight(u) + Photograph2 - GetCameraEyePositionZ()
          


          IP属地:浙江5楼2012-08-31 23:15
          回复
            set Position1 = -50
            endif
            endif
            return Partial_Axis
            endfunction
            function CheckEffect takes unit u returns boolean
            //这里可以自行添加更多的函数
            if (GetUnitMoveSpeed(u) != .0) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == false /*
            */and GetWidgetLife(u) > .0 then
            return true
            endif
            return false
            endfunction
            endlibrary
            //=========================================================================================
            // <3D_Camera> and <KeyBoard Control Moving> System 0.2
            // 新增了检查单位是否拥有一些不能移动的负面效果,如果拥有这些效果,单位则不能移动、
            //更改面向角度。
            // 新增检查函数,是否在使用键盘移动,是返回true,否返回false
            // 新增了播放两栖单位在海面上的行走动画函数
            // 修改了左右角度的默认值,为单位的转身速度 * 10
            // 单位走到高地后 会拉开镜头到单位的距离
            globals
            //默认的玩家人数
            constant integer Max_Player = 12
            //默认镜头的X旋转角度
            constant integer AngleOfAttack = 335
            //默认镜头的观察区域
            constant integer FieldOfView = 100
            //默认的镜头距离到目标
            constant integer TargetDistance =600
            //默认的镜头距离到目标刷新速率
            constant real TargetDisTime = .25
            //默认的镜头角度刷新速率
            constant real RotationTime = .25
            //默认的镜头X旋转角度刷新速率
            constant real AngleOfAttackTime = .25
            //默认的镜头观察区域刷新速率
            constant real FieldOfViewTime = .1
            //默认的单位行走速度,X坐标的设置
            constant real X_Down = -1.5
            //Y坐标的设置
            constant real Y_Down = -1.
            //默认的被除值
            constant real Mod = 65.
            //DET
            constant real DET = 3.14159 / 180.
            //loc
            constant location Locus = Location(.0,.0)
            endglobals
            library CameraSystem requires UnitAnimation,DefalutSystem
            globals
            trigger array Right_Up[Max_Player]
            trigger array Left_Up[Max_Player]
            trigger array Up_Up[Max_Player]
            trigger array Right_Down[Max_Player]
            trigger array Left_Down[Max_Player]
            trigger array Up_Down[Max_Player]
            trigger array Down_Down[Max_Player]
            trigger array Down_Up[Max_Player]
            timer array Control[Max_Player][5]
            boolean array ControlDet[Max_Player][10]
            real array dis[2]
            CameraStruct array Sturcts[Max_Player]
            real x = .0
            real y = .0
            real Position1 = .0
            endglobals
            struct CameraStruct
            unit CameraUnit
            player CameraPlayer
            real NowUnitFacing
            real AddReal
            real TargetDis
            real AngleOfAttack
            real FieldOfView
            


            IP属地:浙江6楼2012-08-31 23:15
            回复
              real RotationTime
              real AngleOfAttackTime
              real FiledOfViewTime
              real TargetDisTime
              real RestTime
              real RightFac
              real LeftFac
              real RightDown
              real LeftAdd
              boolean IsUseCamera
              static CameraStruct data
              //刷新当前镜头
              static method RestCamera takes nothing returns nothing
              local integer i = 0
              loop
              exitwhen i > Max_Player
              if GetExpiredTimer() == Control[i][4] then
              if Player(i) == GetLocalPlayer() then
              set data = Sturcts[i]
              call PanCameraToTimed( GetUnitX(data.CameraUnit), GetUnitY(data.CameraUnit), 0 )
              call SetCameraField(CAMERA_FIELD_ZOFFSET, CheckZ(data.CameraUnit), .25)
              set data.AngleOfAttack = Position1
              call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, data.TargetDis, data.TargetDisTime)
              call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, data.AngleOfAttack, data.AngleOfAttackTime)
              call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW, data.FieldOfView, data.FiledOfViewTime)
              call SetCameraField(CAMERA_FIELD_FARZ, bj_CAMERA_DEFAULT_FARZ, .25)
              call SetCameraField(CAMERA_FIELD_ROTATION, GetUnitFacing(data.CameraUnit), data.RestTime)
              endif
              endif
              set i = i + 1
              endloop
              endmethod
              endstruct
              //======================================判断单位所在区域=========================================
              private function IsTerrainDeepWater takes real x, real y returns boolean
              return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
              endfunction
              //======================================键盘移动系统动作=========================================
              //! textmacro PressLeftOrRightDown takes WhichKey,IsAdd,whichTimer,fac,DownUp
              private function $WhichKey$TimeOut takes nothing returns nothing
              local integer i = 0
              local integer i1 = 0
              loop
              exitwhen i > Max_Player
              set i1 = 0
              loop
              exitwhen i1 > 2
              if Control[i][i1] == GetExpiredTimer() and CheckEffect(Sturcts[i].CameraUnit) == true and /*
              */IsUnitPaused(Sturcts[i].CameraUnit) == false then
              set Sturcts[i].$fac$ = ( GetUnitFacing(Sturcts[i].CameraUnit) $IsAdd$ Sturcts[i].$DownUp$ )
              call IssueImmediateOrder( Sturcts[i].CameraUnit, "stop" )
              call SetUnitFacingTimed( Sturcts[i].CameraUnit, Sturcts[i].$fac$ , .01)
              return
              endif
              set i1 = i1 + 1
              endloop
              set i = i + 1
              endloop
              endfunction
              


              IP属地:浙江7楼2012-08-31 23:15
              回复
                这货一定是NAJI写的


                8楼2012-09-01 02:30
                回复
                  2025-06-21 10:21:45
                  广告
                  我只能隐晦看出是模拟移动的


                  IP属地:湖北来自iPhone客户端9楼2012-09-01 08:47
                  收起回复
                    ……全给贴到自定义代码区
                    不过怀疑贴了LZ也不会用


                    10楼2012-09-02 15:46
                    回复
                      纳吉的键盘移动函数?


                      IP属地:湖北11楼2012-09-02 15:50
                      回复
                        找到运行函数既可。比如call najidashabi()之类的东东。


                        IP属地:澳大利亚来自Android客户端12楼2012-09-02 16:19
                        回复
                          楼上给的提示。不然我还不知道写什么呢。


                          IP属地:澳大利亚来自Android客户端13楼2012-09-02 16:20
                          回复
                            好像是call unitmove(najidashabi)
                            唔。误。雾。呜。


                            IP属地:澳大利亚来自Android客户端14楼2012-09-02 16:23
                            回复
                              2025-06-21 10:15:45
                              广告
                              好像有好几个运行函数。也许是call unitanimation。嗯
                              千万别相信我。我可以100%告诉你我的是错的。只是给你举例。你好到原来发现代码的地址找找。


                              IP属地:澳大利亚来自Android客户端15楼2012-09-02 16:28
                              回复