Question about setting APROP_DAMAGE

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Question about setting APROP_DAMAGE

Post by Blue Shadow »

Let's say I have this:

Code: Select all

SetActorProperty(0, APROP_DAMAGE, 20);
That, obviously, will set a certain actor's damage to 20 and that damage is randomly multiplied by 1 to 8.

The question is, how can I make that line of code to set the damage as a fixed value?

Thanks in advance.
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Question about setting APROP_DAMAGE

Post by Blue Shadow »

I'm sorry for the bump, but the topic dropped to the second page with no response and, well, the question still stands.
Gez
 
 
Posts: 17941
Joined: Fri Jul 06, 2007 3:22 pm

Re: Question about setting APROP_DAMAGE

Post by Gez »

I'm not sure it's possible. Here's a hack, though: Try adding 0x40000000 to the value. So for 20 damage, that's 17179869204 or 0x400000014.

ZDoom uses the upper bits to use some flags on the value and that's the one that means "evaluate as an expression".
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Question about setting APROP_DAMAGE

Post by Blue Shadow »

Tried it, but using...

Code: Select all

SetActorProperty(0, APROP_DAMAGE, 0x400000014);
...produces the same result as using...

Code: Select all

SetActorProperty(0, APROP_DAMAGE, 20);
:(

Just out of curiosity, why wasn't there a flag that simply takes damage randomization out of the equation instead of the way we already have to achieve that? I mean something like this...

- Flag on, overrides default damage calculation.

Code: Select all

Damage value/(expression) = value/(expression result)
- Flag off, default damage calculation's applied.

Code: Select all

Damage value/(expression) = value/(expression result) * random(1, 8)
User avatar
Nirvana
Posts: 156
Joined: Thu May 01, 2008 8:15 am

Re: Question about setting APROP_DAMAGE

Post by Nirvana »

Strange, because I have found with both A_BruisAttack and A_VileAttack that they use exact values (or at least did for me...I think) I know for sure A_VileAttack did, but it's a weird attack in and of itself.
User avatar
Cjk10000
Posts: 98
Joined: Fri Jan 02, 2009 10:13 am

Re: Question about setting APROP_DAMAGE

Post by Cjk10000 »

I wonder if you could make another monster in decorate and morph it into that monster that does exactly 20 damage?
I skimmed over the topic so if this is wrong I apologize
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Question about setting APROP_DAMAGE

Post by Blue Shadow »

I appreciate the input, guys, but here's a clarification:

What I'm trying to do here is to change a projectile's damage at runtime and I can do that by using SetActorProperty with APROP_DAMAGE. But the thing is I don't have the choice if I want the end damage to be a fixed value (no random).
Nirvana wrote:Strange, because I have found with both A_BruisAttack and A_VileAttack that they use exact values (or at least did for me...I think) I know for sure A_VileAttack did, but it's a weird attack in and of itself.
A_VileAttack does 20 direct fixed damage + 70 radius damage.
User avatar
Nirvana
Posts: 156
Joined: Thu May 01, 2008 8:15 am

Re: Question about setting APROP_DAMAGE

Post by Nirvana »

Blue Shadow wrote:I appreciate the input, guys, but here's a clarification:

What I'm trying to do here is to change a projectile's damage at runtime and I can do that by using SetActorProperty with APROP_DAMAGE. But the thing is I don't have the choice if I want the end damage to be a fixed value (no random).
Nirvana wrote:Strange, because I have found with both A_BruisAttack and A_VileAttack that they use exact values (or at least did for me...I think) I know for sure A_VileAttack did, but it's a weird attack in and of itself.
A_VileAttack does 20 direct fixed damage + 70 radius damage.
A_BruisAttack seems to use fixed damage as well, you can set it directly.
User avatar
Ethril
Posts: 2677
Joined: Sun Nov 16, 2008 2:59 am
Location: with you in the dark

Re: Question about setting APROP_DAMAGE

Post by Ethril »

I'm not sure how helpful this will be for your ACS, but I'm fairly certain that the Damage DECORATE property can be "unrandomized" if you enclose it in parentheses.

That aside, you could just make some copies of the projectile and have some A_JumpIfs to determine which one to use, instead of using only one and making it dynamic. Well, maybe; I don't really know what this is in context of.
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Question about setting APROP_DAMAGE

Post by Blue Shadow »

Ethril wrote:I'm not sure how helpful this will be for your ACS, but I'm fairly certain that the Damage DECORATE property can be "unrandomized" if you enclose it in parentheses.
Yes, I have knowledge of that.
Ethril wrote:That aside, you could just make some copies of the projectile and have some A_JumpIfs to determine which one to use, instead of using only one and making it dynamic. Well, maybe; I don't really know what this is in context of.
That was my first thought, but then I realized that ACS is the way instead... why? Because I have a leveling-up system in mind with which the player's weapons get stronger a little bit each time he/she levels-up (one or two points each level). That's why that idea won't serve my purposes well because it isn't flexible enough.
User avatar
DaMan
Posts: 727
Joined: Fri Jan 01, 2010 7:14 am

Re: Question about setting APROP_DAMAGE

Post by DaMan »

May I suggest [wiki]PowerDamage[/wiki].

Code: Select all

actor LVL2Damage : PowerDamage
{
damagefactor "normal", 1.1
inventory.icon "MEGAA0"
}

actor LVL2 : PowerupGiver
{
+Inventory.AutoActivate
Inventory.MaxAmount 0 
Powerup.Type LVL2Damage
Powerup.Duration -2147483647
}
That's an item that last 2years that increases damage by 10%. Replace with a stronger one for lvl3 rinse lather repeat.
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Question about setting APROP_DAMAGE

Post by Blue Shadow »

I guess I'm gonna have to wait for Doom Script then.
DaMan wrote:May I suggest [wiki]PowerDamage[/wiki].

Code: Select all

actor LVL2Damage : PowerDamage
{
damagefactor "normal", 1.1
inventory.icon "MEGAA0"
}

actor LVL2 : PowerupGiver
{
+Inventory.AutoActivate
Inventory.MaxAmount 0 
Powerup.Type LVL2Damage
Powerup.Duration -2147483647
}
That's an item that last 2years that increases damage by 10%. Replace with a stronger one for lvl3 rinse lather repeat.
Although it isn't that flexible at least you don't have to do a copy of each projectile.
Locked

Return to “Editing (Archive)”