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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Daryn
Posts: 113
Joined: Wed Jan 23, 2019 10:22 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Professional X64
Graphics Processor: nVidia with Vulkan support

Far-sighted Friendlies

Post by Daryn »

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.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Far-sighted Friendlies

Post by Blue Shadow »

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 [wiki=Actor_properties#FriendlySeeBlocks]FriendlySeeBlocks[/wiki] actor property to adjust the max distance.
User avatar
inkoalawetrust
Posts: 70
Joined: Mon Aug 26, 2019 9:18 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Far-sighted Friendlies

Post by inkoalawetrust »

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 all

	Void A_SetSeeBlocks (Int Blocks = 10, Int Pointer = AAPTR_DEFAULT)
	{
		Actor AAPTR = GetPointer (Pointer)
		If (AAPTR) {AAPTR.FriendlySeeBlocks = Blocks;}
	}
User avatar
Daryn
Posts: 113
Joined: Wed Jan 23, 2019 10:22 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Professional X64
Graphics Processor: nVidia with Vulkan support

Re: Far-sighted Friendlies

Post by Daryn »

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.
Post Reply

Return to “Scripting”