franniss 发表于 2009-11-27 12:39:25

非常实用的一组新 instance_nearest 函数

函数说明:

instance_nth_nearest( x, y, obj, n )
功能与 instance_nearest() 相同。
但更进一步,该函数可以找到距离排序第 n 近的 obj。

举例:你可以用该脚本找次近的实例( n = 2 ),或者是排序第15近的实例( n = 15 )。

instance_xth_nearest( x, y, obj, n, variable, value, operator )
比上一个更强大,函数返回符合表达式运算结果的实例 id。
如果没有符合表达式运算结果的实例,则返回 -1。
运算符号( operator )是可选项,如果忽略,则默认为等号。
支持的运算符号为:"<" ">" "<=" ">=" "!=" "="。
也可以用一个脚本代替参数中的变量( variable ),它会检测脚本表达式是否为真。
"other" 指应用脚本的 object, 脚本则改由被扫描的 object 来执行,该修正适用于任何脚本。

举例:你可以用这个脚本来找到战斗力大于5,并且排序第3近( n = 3 )的实例。

instance_nth_furthest( x, y, obj, n )
与 instance_nth_nearest() 对应。
但返回的是距离排序第 n 远的实例 id 。
如果让 n = 1 则与 instance_furthest() 没区别。

instance_xth_furthest( x, y, obj, n, variable, value, operator )
与 instance_xth_nearest() 对应。
但返回的是距离排序第 n 远的实例 id 。

instance_xth_number( obj, variable, value, operator )
给出符合表达式运算结果的 obj 数目。

下载地址:

**** Hidden Message *****
使用方法:
保存为 *.gml 文件。
Scripts -> Import Scripts

secondsen 发表于 2010-1-5 19:31:23

以后像LS这样的是不是应该成为dd党

franniss 发表于 2010-1-5 19:38:20

googlepage 已经不好登了,这帖要求补档请额外说明~

b8601166 发表于 2010-3-24 22:19:51

thanks

lyraley 发表于 2010-3-27 09:07:05

太好了,支持!

helpforhope 发表于 2010-4-4 22:14:57

我怕我又下不了...

franniss 发表于 2010-4-4 22:29:07

需要?

补个档~

腐看风景 发表于 2010-5-30 14:14:35

taojianli 发表于 2010-6-30 18:26:22

太好了!

taojianli 发表于 2010-7-1 18:19:11

学习学习
页: [1] 2
查看完整版本: 非常实用的一组新 instance_nearest 函数