Far-sighted Friendlies

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Far-sighted Friendlies

Postby Daryn » Thu Jul 29, 2021 11:24 am

Hello all, again.

I'm working on something with a friend, and I'm building a turret for an emplacement he wants in the map. It's mostly working, I just used a friendly monster that doesn't move, and adjsted its Missile cycle to taste. But we're finding it doesn't see far enough.

I'm using A_LookEx to set the max units it can see, but he wiki notes that there is a hard cap of 1280 units for friendly monsters. Is there another method I could use for sight checking that ould let my turret see further? Or is the friendly monster approach not what I want to use for this?

Thanks.
User avatar
Daryn
 
Joined: 23 Jan 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: Far-sighted Friendlies

Postby Blue Shadow » Thu Jul 29, 2021 7:42 pm

Daryn wrote:I'm using A_LookEx to set the max units it can see, but he wiki notes that there is a hard cap of 1280 units for friendly monsters.

There isn't anymore, as you can use the FriendlySeeBlocks actor property to adjust the max distance.
User avatar
Blue Shadow
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Far-sighted Friendlies

Postby inkoalawetrust » Thu Jul 29, 2021 7:48 pm

The range in which friendly actors can see is actually determined by the FriendlySeeBlocks property, which is 10 by default, or 1280 map units like you mentioned.

Unfortunately this property is read-only, so it cannot be changed on the fly with ZScript and custom functions, otherwise I'd have also put some code here for an A_SetSeeBlocks() function that allows you to change the property in DECORATE as well.

Edit: Fuck, BlueShadow responded before me because I wasted my time making the function above before realizing that the property is read-only.

Code: Select allExpand view
   Void A_SetSeeBlocks (Int Blocks = 10, Int Pointer = AAPTR_DEFAULT)
   {
      Actor AAPTR = GetPointer (Pointer)
      If (AAPTR) {AAPTR.FriendlySeeBlocks = Blocks;}
   }
User avatar
inkoalawetrust
 
Joined: 26 Aug 2019
Discord: inkoalawetrust #9783
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: Far-sighted Friendlies

Postby Daryn » Thu Jul 29, 2021 10:00 pm

I appreciate the help, nonetheless. If the property can't be modified on-the-fly, that's fine. The wiki implies it can be changed/set initially, though. I'll mess around with it in the morning and see what happens. If it doesn't work, it doesn't work. At least I have something I can try.
User avatar
Daryn
 
Joined: 23 Jan 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)


Return to Scripting

Who is online

Users browsing this forum: [_ilystra_] and 0 guests