SetActorFlag() "NOPAIN" not working.

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
arkore
Posts: 25
Joined: Wed Nov 27, 2013 8:27 pm

SetActorFlag() "NOPAIN" not working.

Post by arkore »

This is not working for me:

Code: Select all

SetActorFlag(mon_tid, "NOPAIN", TRUE);
I know mon_tid is correct, because my other lines of code (next to SetActorFlag line) are all using mon_tid and are working fine.

Only the decorate action works:

Code: Select all

A_ChangeFlag("NOPAIN", 1)
I've tried Zandronum, GDCC, and the latest ZDoom compiler (ver. 155, Mar. 12, 2017) from GZDB r3004.
User avatar
Rachael
Posts: 13950
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: SetActorFlag() "NOPAIN" not working.

Post by Rachael »

You are going to have to post a runnable example.
arkore
Posts: 25
Joined: Wed Nov 27, 2013 8:27 pm

Re: SetActorFlag() "NOPAIN" not working.

Post by arkore »

Make your own example and run it.
User avatar
Rachael
Posts: 13950
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: SetActorFlag() "NOPAIN" not working.

Post by Rachael »

Yeah, good job on demonstrating how NOT to get your issue solved. I wish you the best of luck, friend.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: SetActorFlag() "NOPAIN" not working.

Post by Matt »

Whatever it is you tried to run that didn't work, upload it.
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: SetActorFlag() "NOPAIN" not working.

Post by _mental_ »

Here is my script

Code: Select all

#include "zcommon.acs"

script 1 open
{
	Spawn("DoomImp", 0, 0, 0, 1234);
	Log(s:"SetActorFlag() returns ", i:SetActorFlag(1234, "NOPAIN", TRUE));
}
It outputs "SetActorFlag() returns 1" upon starting a game. This means that flag has been changed for one actor.
By debugging GZDoom I verified that summoned actor was found and the corresponding flag was set for it.

Developers are asking for runnable sample not because we have nothing else to do but because the chance of user's error is quite high.
At the same time there can be some corner cases which you might find. Although guessing about it is a futile endeavor.
arkore
Posts: 25
Joined: Wed Nov 27, 2013 8:27 pm

Re: SetActorFlag() "NOPAIN" not working.

Post by arkore »

Apologies.

I tested using GZDoom, and it works. This means that Zandronum 3 itself is the problem.

It's frustrating because it's misleading when the docs don't hint at an issue of compatibility (like they used to in the past), and then the compiler compiled successfully, and yet Zandronum 3 still isn't up to date and doesn't give any warning or error messages. This SetActorFlag feature is roughly 2 years old now, and Zandronum 3 was just released last December. :/

Your post helped me realize how return value could've been helpful. After reading the docs carefully again now, I see now. A return value of 0 could've proven to me that it really wasn't working, and in which case I would've had second thoughts on posting this in bugs and feeling the way I did.

I was tired and frustrated, and generally tired of experiencing these kinds of issues of compatibility without notice.

---

For anyone else experiencing this issue, you can use Inventory hacks (which most people are probably doing already, since no tracker ticket has been posted about this yet on Zandronum).

Code: Select all

ACTOR SetNoPain : CustomInventory
{
	+AUTOACTIVATE
	Inventory.MaxAmount 0
	States
	{
		Spawn:
			TNT1 A 0
			Stop
		Pickup:
			TNT1 A 0 A_ChangeFlag("NOPAIN", TRUE)
			Stop
	}
}

ACTOR UnSetNoPain : CustomInventory
{
	+AUTOACTIVATE
	Inventory.MaxAmount 0
	States
	{
		Spawn:
			TNT1 A 0
			Stop
		Pickup:
			TNT1 A 0 A_ChangeFlag("NOPAIN", FALSE)
			Stop
	}
}

ACS:
GiveInventory(monster_tid, "SetNoPain", 1);
and
GiveInventory(monster_tid, "UnSetNoPain", 1);
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: SetActorFlag() "NOPAIN" not working.

Post by _mental_ »

ACS SetActorFlag() function doesn't work in Zandronum 3 because it's based on relative old version of GZDoom.
At the moment unknown ACS functions are ignored silently at runtime, i.e. they do nothing and their results are set to zero.
Post Reply

Return to “Scripting”