If you use the decorate code 'A_ChangeFlag("FRIENDLY",1)', this will reduce the total monster count by one. However, if you use the ZScript code 'bFriendly = true' to do the same thing, then the total monster count will not be reduced. This will give you an extra monster that will not be accounted for if it died and you won't be able to get 100% kills.
Here is an example. The ZScript text contains TestMonster1 that uses 'bFriendly = true' after a few frames. The Decorate text uses TestMonster2 that uses 'A_ChangeFlag("FRIENDLY",1)' instead. Summon both to see the difference.
'bFriendly = true' does not reduce monster count
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
'bFriendly = true' does not reduce monster count
- Attachments
-
testmonster.pk3
- (1.04 KiB) Downloaded 22 times
- m8f
-
- Posts: 1457
- Joined: Fri Dec 29, 2017 4:15 am
- Preferred Pronouns: He/Him
- Location: Siberia (UTC+7)
- Contact:
Re: 'bFriendly = true' does not reduce monster count
Well, you can always adjust total monster count manually by doing
I think it's expected that changing actor flag doesn't have side effects like changing total monster count.
Code: Select all
level.total_monsters -= 1;
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49225
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: 'bFriendly = true' does not reduce monster count
Yes, it does, but the global monster counter lives elsewhere. If you just change the flag the engine only toggles a variable, so you have to take care of the counter yourself.
Re: 'bFriendly = true' does not reduce monster count
Ok, but it is strange how it works with one method but not with another.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49225
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: 'bFriendly = true' does not reduce monster count
There is no "other method". But if you just change a variable on an actor directly at run time this won't update other related variables. 'bFriendly = true;' is just a variable assignment - it calls no function that updates other state in the engine - all it does is setting bFriendly to true. The global monster counter is a separate variable.
ZScript has no concept of properties like C# or Objective-C where you can overload an assignment with a function call.
ZScript has no concept of properties like C# or Objective-C where you can overload an assignment with a function call.
Re: 'bFriendly = true' does not reduce monster count
Well, as long as there's a way to deal with the actual problem, I should be fine.
Actually, I just found out about A_ChangeCountFlags, which does exactly what I need.
Actually, I just found out about A_ChangeCountFlags, which does exactly what I need.
-
- Posts: 5041
- Joined: Sun Nov 14, 2010 12:59 am
Re: 'bFriendly = true' does not reduce monster count
There's now [wiki=A_SetFriendly]this[/wiki], for whoever might need it.