刚玩两天的萌新,最近在捣鼓处理器,写了一个单位跟随玩家的逻辑,但是遇到一个问题
就是现在我获取玩家坐标都得靠对应单位的unit radar,一旦玩家移动太快跑出了单位的雷达范围就会导致丢失玩家位置。我知道一个比较蠢的解决方法是靠处理器的radar来侦测玩家位置,但除非全地图插满处理器,否则单位的跟随范围十分受限。想问一下有没有什么解决方案能够实现无论玩家在哪里都能获得玩家的坐标这种逻辑。
还有一个问题是我发现单位的响应并不是很流畅,尤其是单位较多的时候有些单位反应会慢半拍,估计是因为每个时间段处理器只能操控一个单位?这个有什么好的解决思路吗。
最后附上逻辑和蓝图,写的很蠢
# poly单位跟随/开火
ubind @poly
sensor enabled switch1 @enabled
jump 34 equal enabled false
sensor unitX @璐村惂鐢ㄦ埛_00Q6JQM馃惥 @x
sensor unitY @unit @y
sensor unitRange @unit @range
op sub unitRange unitRange 1
sensor enabled switch1 @enabled
uradar player any any distance 0 1 player
jump 34 strictEqual player null
sensor playerX player @x
sensor playerX player @x
sensor playerY player @y
sensor shootX player @shootX
sensor shootY player @shootY
sensor isShooting player @shooting
sensor isShooting player @shooting
op sub dX shootX unitX
op sub dY shootY unitY
op angle angle dX dY
op len dis dX dY
op min dis dis unitRange
op cos dX angle unitRange
op sin dY angle unitRange
op mul dX dX dis
op mul dY dY dis
op add shootX dX unitX
op add shootY dY unitY
ucontrol approach playerX playerY 5 0 0
jump 32 notEqual isShooting true
ucontrol target shootX shootY true 0 0
jump 35 always true true
ucontrol target shootX shootY false 0 0
jump 35 always true true
ucontrol pathfind 0 0 0 0 0
end
蓝图:
bXNjaAF4nAH+AQH+AAMAAgIABG5hbWUAEOi3n+maj0Bwb2x5IHY0LjAAC2Rlc2NyaXB0aW9uAAACAAZzd2l0Y2gAD2xvZ2ljLXByb2Nlc3NvcgAAAAIAAAAAAAoBAAEAAQAADgAAAaF4nI2TzY7TMBDHZwVoS8SNF/AjNF323gsvAJfmOLVn2yDXDv7QkqfjrbiACLZjO+kKaavEief3nxl7/HEH8OanP/ZKsP2g5dhYUlYbRgqPkgSzz73j55btM2i++cvAHj4x+u5RVrcnlJZKrFe9O7B9/LH9jzXtCh3X9AuqExXFRKPRA7P+uFKXXvvqFL1BgYYNEkcyDNWYmuitQ8WJbVmbtVqMdabn7nMqKYcpL2UZaUaHIi01vSJ0Vaj12rPWbgmYzSuxuxa7Ivb2a7R7dbp2COAWl7yi4lCmkHap4q4MnrYp4rDYkvI3RIkEJam4kAu49BmEVvcoClwnrzn+SrExpPufcvEyZT7EdBV06Z0BClHmL1YlVJx85xI818oZLRkOg9HIzy92q2OP4Shs8xnYMaXzAVitojOelkQOzYlcGT+PF11WeR4Zymcc7cxviE8358YEA7rzU7yq2/I0pEQDABvYKM8ledtOv+AdbC5kLZ6onf7CXbV2059g3XNSjkw7/Yb38BYNb+FDSBF7O/gYaHF/CKkA7vP9miaAf+xXd40AS2bopQ==
就是现在我获取玩家坐标都得靠对应单位的unit radar,一旦玩家移动太快跑出了单位的雷达范围就会导致丢失玩家位置。我知道一个比较蠢的解决方法是靠处理器的radar来侦测玩家位置,但除非全地图插满处理器,否则单位的跟随范围十分受限。想问一下有没有什么解决方案能够实现无论玩家在哪里都能获得玩家的坐标这种逻辑。
还有一个问题是我发现单位的响应并不是很流畅,尤其是单位较多的时候有些单位反应会慢半拍,估计是因为每个时间段处理器只能操控一个单位?这个有什么好的解决思路吗。
最后附上逻辑和蓝图,写的很蠢
# poly单位跟随/开火
ubind @poly
sensor enabled switch1 @enabled
jump 34 equal enabled false
sensor unitX @璐村惂鐢ㄦ埛_00Q6JQM馃惥 @x
sensor unitY @unit @y
sensor unitRange @unit @range
op sub unitRange unitRange 1
sensor enabled switch1 @enabled
uradar player any any distance 0 1 player
jump 34 strictEqual player null
sensor playerX player @x
sensor playerX player @x
sensor playerY player @y
sensor shootX player @shootX
sensor shootY player @shootY
sensor isShooting player @shooting
sensor isShooting player @shooting
op sub dX shootX unitX
op sub dY shootY unitY
op angle angle dX dY
op len dis dX dY
op min dis dis unitRange
op cos dX angle unitRange
op sin dY angle unitRange
op mul dX dX dis
op mul dY dY dis
op add shootX dX unitX
op add shootY dY unitY
ucontrol approach playerX playerY 5 0 0
jump 32 notEqual isShooting true
ucontrol target shootX shootY true 0 0
jump 35 always true true
ucontrol target shootX shootY false 0 0
jump 35 always true true
ucontrol pathfind 0 0 0 0 0
end
蓝图:
bXNjaAF4nAH+AQH+AAMAAgIABG5hbWUAEOi3n+maj0Bwb2x5IHY0LjAAC2Rlc2NyaXB0aW9uAAACAAZzd2l0Y2gAD2xvZ2ljLXByb2Nlc3NvcgAAAAIAAAAAAAoBAAEAAQAADgAAAaF4nI2TzY7TMBDHZwVoS8SNF/AjNF323gsvAJfmOLVn2yDXDv7QkqfjrbiACLZjO+kKaavEief3nxl7/HEH8OanP/ZKsP2g5dhYUlYbRgqPkgSzz73j55btM2i++cvAHj4x+u5RVrcnlJZKrFe9O7B9/LH9jzXtCh3X9AuqExXFRKPRA7P+uFKXXvvqFL1BgYYNEkcyDNWYmuitQ8WJbVmbtVqMdabn7nMqKYcpL2UZaUaHIi01vSJ0Vaj12rPWbgmYzSuxuxa7Ivb2a7R7dbp2COAWl7yi4lCmkHap4q4MnrYp4rDYkvI3RIkEJam4kAu49BmEVvcoClwnrzn+SrExpPufcvEyZT7EdBV06Z0BClHmL1YlVJx85xI818oZLRkOg9HIzy92q2OP4Shs8xnYMaXzAVitojOelkQOzYlcGT+PF11WeR4Zymcc7cxviE8358YEA7rzU7yq2/I0pEQDABvYKM8ledtOv+AdbC5kLZ6onf7CXbV2059g3XNSjkw7/Yb38BYNb+FDSBF7O/gYaHF/CKkA7vP9miaAf+xXd40AS2bopQ==












