[DECORATE] Pressing use on Actor activates them?

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!)
User avatar
Graaicko
Posts: 532
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

[DECORATE] Pressing use on Actor activates them?

Post by Graaicko »

I'm trying to make an informant actor similar to Blake Stone Informants. I know I can use a spawner in the decorate to make it randomize. But I was wondering how to make an enemy go into its see state (look for the player) when the player presses the use key on the actor? In other words, what would the decorate code look like to make this happen?

I'm also going to make a protagonist version of these informants that will either give you useful items, information of hints but would like to nail down the hostile versions first.
User avatar
TheGameratorT
Posts: 63
Joined: Sun Mar 04, 2018 4:42 am
Graphics Processor: nVidia with Vulkan support
Location: Portugal

Re: [DECORATE] Pressing use on Actor activates them?

Post by TheGameratorT »

I think there is a Use state on decorate
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: [DECORATE] Pressing use on Actor activates them?

Post by ramon.dexter »

Graaicko, you dont want to meddle with states. To make some action based on actor activation you dont need to modify the actor.

Based on what you described, i think all you need is to create an ZSDF conversation and the assign it to a actor.
User avatar
StrikerMan780
Posts: 486
Joined: Tue Nov 29, 2005 2:15 pm
Graphics Processor: nVidia with Vulkan support

Re: [DECORATE] Pressing use on Actor activates them?

Post by StrikerMan780 »

ramon.dexter wrote:Graaicko, you dont want to meddle with states. To make some action based on actor activation you dont need to modify the actor.

Based on what you described, i think all you need is to create an ZSDF conversation and the assign it to a actor.
Extremely incorrect, this would be a horrible thing to do. Stop spreading bad advice.

You're going to want a SwitchingDecoration, or SwitchableDecoration. See: [wiki]Creating_decorations_that_can_be_(de)activated[/wiki]

The "Activation" property can let you adjust the behavior of the actor upon activation: https://zdoom.org/wiki/Actor_properties#Activation

Here's an example of my own DECORATE code, which is a drinking fountain that can be activated and give health:

Code: Select all

actor DrinkingFountain : SwitchableDecoration 16541
{
	//$Category SMMP Interactive Stuff
	//$Title Drinking Fountain
	//$Color 13
	Activation THINGSPEC_ThingTargets | THINGSPEC_ThingActs
	height 16
	radius 12
	XScale 0.70
	YScale 0.75
	+SOLID
	+USESPECIAL
	states
	{
		Spawn:
			FOUN A -1 NoDelay A_SetSpecial(130, 0) // THING_ACTIVATE special. This allows me to use the "Active" state upon using.
			loop
		Active:
			FOUN B 0 A_ChangeFlag("USESPECIAL", 0) // Turn off use special so it can't be activated again during animation
			FOUN B 0 A_PlaySound("DrinkingFountain")
			FOUN BCDBCDBCDBCDBCDBCDBCDBCDB 1 A_GiveToTarget("Health", 1)
			FOUN CDBCDBCDBCDBCDBCDBCDBCDBCDBCDBCDBCDBCDBCDBCDBCDBCD 1
			FOUN A 0 A_ChangeFlag("USESPECIAL", 1) // Turn on use special so it can be activated again
			goto Spawn
	}
}
There's probably a much better way to do this stuff in ZScript, but I've yet to familiarize myself with it.
User avatar
Graaicko
Posts: 532
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: [DECORATE] Pressing use on Actor activates them?

Post by Graaicko »

Cooool. Thanks. It's works actaully how I want it. Now I just need to make the good informants.
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: [DECORATE] Pressing use on Actor activates them?

Post by ramon.dexter »

Sorry for bad advice. I thought (from the description), that the information will give you information, not health.

Besides that, giving health could be done easily with ZSDF. So my advice was not so bad. You know, I finding the ZSDF conversation system as a new thing, to which the old members are not so used to. So my advice could be noted as bad, based on lack of exprience with the new addition.

Return to “Scripting”