找回密码
 点一下
查看: 1403|回复: 10

新建地图无法保存?

[复制链接]
发表于 2015-1-26 17:43:09 | 显示全部楼层 |阅读模式
本帖最后由 RoyalFlare 于 2015-1-26 20:06 编辑

RT 随意创建1个新地图,写完代码以后想保存测试1下,结果YDWE就弹出提示
7118: Cannot convert returned value from real to integer
查看JassHelper的错误提示信息得到如下提示

  1. function GetFadeFromSeconds takes real seconds returns integer
  2.     if (seconds != 0) then
  3.         return 128 / seconds
  4.     else
  5.         return 10000
  6.     endif
  7. endfunction
复制代码

然后往上翻发现多了许多预定义的函数,猜测是YDWE自动注入地图的函数.求解答.
关闭自动注入代码的功能依旧无效.写个Library就这麽难?


Test Library.w3x

112.51 KB, 下载次数: 0

SilentSelena.w3x

226.95 KB, 下载次数: 0

 楼主| 发表于 2015-1-26 17:45:48 | 显示全部楼层
本帖最后由 RoyalFlare 于 2015-1-26 17:48 编辑

  1. library TerrainPathability initializer Init
  2. //******************************************************************************
  3. //* BY: Rising_Dusk
  4. //*
  5. //* This script can be used to detect the type of pathing at a specific point.
  6. //* It is valuable to do it this way because the IsTerrainPathable is very
  7. //* counterintuitive and returns in odd ways and aren't always as you would
  8. //* expect. This library, however, facilitates detecting those things reliably
  9. //* and easily.
  10. //*
  11. //******************************************************************************
  12. //*
  13. //* > function IsTerrainDeepWater takes real x, real y returns boolean
  14. //* > function IsTerrainShallowWater takes real x, real y returns boolean
  15. //* > function IsTerrainLand takes real x, real y returns boolean
  16. //* > function IsTerrainPlatform takes real x, real y returns boolean
  17. //* > function IsTerrainWalkable takes real x, real y returns boolean
  18. //*
  19. //* These functions return true if the given point is of the type specified
  20. //* in the function's name and false if it is not. For the IsTerrainWalkable
  21. //* function, the MAX_RANGE constant below is the maximum deviation range from
  22. //* the supplied coordinates that will still return true.
  23. //*
  24. //* The IsTerrainPlatform works for any preplaced walkable destructable. It will
  25. //* return true over bridges, destructable ramps, elevators, and invisible
  26. //* platforms. Walkable destructables created at runtime do not create the same
  27. //* pathing hole as preplaced ones do, so this will return false for them. All
  28. //* other functions except IsTerrainWalkable return false for platforms, because
  29. //* the platform itself erases their pathing when the map is saved.
  30. //*
  31. //* After calling IsTerrainWalkable(x, y), the following two global variables
  32. //* gain meaning. They return the X and Y coordinates of the nearest walkable
  33. //* point to the specified coordinates. These will only deviate from the
  34. //* IsTerrainWalkable function arguments if the function returned false.
  35. //*
  36. //* Variables that can be used from the library:
  37. //* [real] TerrainPathability_X
  38. //* [real] TerrainPathability_Y
  39. //*
  40. globals
  41.     private constant real MAX_RANGE = 10.
  42.     private constant integer DUMMY_ITEM_ID = 'wolg'
  43. endglobals

  44. globals
  45.     private item Item = null
  46.     private rect Find = null
  47.     private item array Hid
  48.     private integer HidMax = 0
  49.     public real X = 0.
  50.     public real Y = 0.
  51. endglobals

  52. function IsTerrainDeepWater takes real x, real y returns boolean
  53.     return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
  54. endfunction
  55. function IsTerrainShallowWater takes real x, real y returns boolean
  56.     return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
  57. endfunction
  58. function IsTerrainLand takes real x, real y returns boolean
  59.     return IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY)
  60. endfunction
  61. function IsTerrainPlatform takes real x, real y returns boolean
  62.     return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
  63. endfunction

  64. private function HideItem takes nothing returns nothing
  65. if IsItemVisible(GetEnumItem()) then
  66.     set Hid[HidMax] = GetEnumItem()
  67.     call SetItemVisible(Hid[HidMax], false)
  68.     set HidMax = HidMax + 1
  69. endif
  70. endfunction
  71. function IsTerrainWalkable takes real x, real y returns boolean
  72. //Hide any items in the area to avoid conflicts with our item
  73. call MoveRectTo(Find, x, y)
  74. call EnumItemsInRect(Find ,null, function HideItem)
  75. //Try to move the test item and get its coords
  76. call SetItemPosition(Item, x, y) //Unhides the item
  77. set X = GetItemX(Item)
  78. set Y = GetItemY(Item)
  79. static if LIBRARY_IsTerrainWalkable then
  80.     //This is for compatibility with the IsTerrainWalkable library
  81.     set IsTerrainWalkable_X = X
  82.     set IsTerrainWalkable_Y = Y
  83. endif
  84. call SetItemVisible(Item, false)//Hide it again
  85. //Unhide any items hidden at the start
  86. loop
  87.     exitwhen HidMax <= 0
  88.     set HidMax = HidMax - 1
  89.     call SetItemVisible(Hid[HidMax], true)
  90.     set Hid[HidMax] = null
  91. endloop
  92. //Return walkability
  93. return (X-x)*(X-x)+(Y-y)*(Y-y) <= MAX_RANGE*MAX_RANGE and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
  94. endfunction

  95. private function Init takes nothing returns nothing
  96. set Find = Rect(0., 0., 128., 128.)
  97. set Item = CreateItem(DUMMY_ITEM_ID, 0, 0)
  98. call SetItemVisible(Item, false)
  99. endfunction
  100. endlibrary
复制代码


任意1张空白地图写完Jass代码以后就不能保存了,这是神马疑难Bug?
教练我还要用TimerUtils,GroupUtils,Table,CheckPathAbility,Knockback呢! 函数都不能导入怎麽继续做图?
找到完整的系统却不能移植 郁闷
@希瓦 @chyj4747 @ckpig @zhuzeitou @actboy168

回复

使用道具 举报

发表于 2015-1-26 19:33:26 | 显示全部楼层


  1. function GetFadeFromSeconds takes real seconds returns integer
  2.     if (seconds != 0) then
  3.         return R2I( 128 / seconds )
  4.     else
  5.         return 10000
  6.     endif
  7. endfunction
复制代码


试试
回复

使用道具 举报

 楼主| 发表于 2015-1-26 20:08:15 | 显示全部楼层
@希瓦 你下载附件试试能否正常保存? 已经把常用的Library加入进去了 地图增大了不少= =

点评

话说这麽多优秀的系统都没什麽人使用的麽? 太可惜了 YDWE的逆天功能方便了许多人 但是也使他们止步于此 接触不到更高的层次.  发表于 2015-1-26 20:10
回复

使用道具 举报

发表于 2015-1-26 22:26:00 | 显示全部楼层
RoyalFlare 发表于 2015-1-26 20:08
@希瓦 你下载附件试试能否正常保存? 已经把常用的Library加入进去了 地图增大了不少= =

没YD。。打不开
回复

使用道具 举报

发表于 2015-1-26 22:26:13 | 显示全部楼层
RoyalFlare 发表于 2015-1-26 20:08
@希瓦 你下载附件试试能否正常保存? 已经把常用的Library加入进去了 地图增大了不少= =

没YD。。打不开
回复

使用道具 举报

发表于 2015-2-21 18:08:04 | 显示全部楼层
智商问题。整数实数不分?
回复

使用道具 举报

发表于 2015-2-21 18:08:09 | 显示全部楼层
智商问题。整数实数不分?

点评

好吧 我又2了  发表于 2015-2-21 23:57
回复

使用道具 举报

 楼主| 发表于 2015-2-22 00:33:40 | 显示全部楼层
@ckpig 新版本的YDWE为何启用cJass编辑器的选项是灰色不可用的? 想玩cJass只能用旧版本麽
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-14 09:29 , Processed in 0.359650 second(s), 31 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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