Reset actor flags

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
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Reset actor flags

Post by Apeirogon »

I set some actors flags on some actor and then want reset actor flags to flags set by default.
How do so without creating loop which set ALL AVAILABLE ACTOR FLAGS, except some, to false?

Internally this can be done done by bit shift operation, but in zscript flags transformed to bools, so this is dont work.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Reset actor flags

Post by Void Weaver »

Well dunno can it be helpful or not, but wiki says that Revive() do restore all default flags.
Seems that there are all flags restores via a some GetDefault() function:

AActor *info = GetDefault();
flags = info->flags;
flags2 = info->flags2;
flags3 = info->flags3;
flags4 = info->flags4;
flags5 = info->flags5;
flags6 = info->flags6;
flags7 = info->flags7;

Btw, looks that other reviving functions do restore flags by the similar manner.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Reset actor flags

Post by Graf Zahl »

That won't help because this function does more.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Reset actor flags

Post by Void Weaver »

So GetDefault() doesn't allow to get partial (only flags for ex.) default info?
User avatar
kodi
 
 
Posts: 1361
Joined: Mon May 06, 2013 8:02 am

Re: Reset actor flags

Post by kodi »

MyActor.bSOMEFLAG = MyActor.Default.bSOMEFLAG; ?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Reset actor flags

Post by Graf Zahl »

Void Weaver wrote:So GetDefault() doesn't allow to get partial (only flags for ex.) default info?
GetDefault only gets you a reference to the actor's default. You still have to change everything you need manually.
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: Reset actor flags

Post by Matt »

Flags are stored in an int, aren't they? Would it be possible to just set that int to getdefaultbytype(classname).thatint?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Reset actor flags

Post by Graf Zahl »

The 8 flag ints are not accessible from ZScript - only the separate bits.
Post Reply

Return to “Scripting”