A_AttachLight Help

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!)
Posts: 12
Joined: Tue Dec 26, 2023 10:38 pm
Operating System Version (Optional): Win 10
Graphics Processor: nVidia (Modern GZDoom)

A_AttachLight Help

Post by ogwatto »

Hi lads,
I'm trying to attach a light source to the player, but I'm having trouble.

Here's what I've Written:

Sorry if the fix is obvious, I'm still very new to scripting.
You do not have the required permissions to view the files attached to this post.
User avatar
Posts: 1546
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: A_AttachLight Help

Post by ramon.dexter »

A_AttachLight() is a decorate function. You cannot use decorate functions in acs script. Find an acs alternative.

Good way of finding if the function is acs is the coloring. If the text gets colored, it's acs function. If the text stays black, it's not.
Posts: 1790
Joined: Sun Jul 21, 2019 8:54 am

Re: A_AttachLight Help

Post by Jarewill »

As Ramon has said, A_AttachLight isn't an ACS function, however you can still use it in ACS in a way.
First create a new inventory item, such as this:

Code: Select all

Class LightAttacher : Inventory{
	Override void AttachToOwner(Actor other){
		other.A_AttachLight("ShotgunLight",DynamicLight.FlickerLight,"ff ff ff",16,8,0,(0,0,other.height/2),0.25);
Then give it to the player using GiveInventory in ACS.

Return to “Scripting”