Multiplier is based on distance to dynlight OR sound source?

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.

Multiplier is based on distance to dynlight OR sound source?

Postby Void Weaver » Wed May 29, 2019 12:49 am

I want to get a some custom (?) dynamic multiplier for damage f-tions, which should been based on radius distance from dynlight source OR on heaing distance from sound source.
I. e. the closer to the source, the higher the multiplier (and therefore damage).

Can it be done on DECORATE only? Via userVars for ex. or by something else tricky way?
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014

Re: Multiplier is based on distance to dynlight OR sound sou

Postby Caligari87 » Wed May 29, 2019 7:42 am

It makes no sense to base this on dynlights or sounds when you can just check against the position/radius of the actor performing the damage (such as a rocket). This would be trivial in zscript as you can just compare xyz positions and do some math. It's been too long since I used DECORATE but I don't think there's any simple way to calculate distance cleanly; you'd have to use a set of A_JumpIfCloser calls for example.

A_Explode already has damage falloff, why not use that?

PS: Why do you keep writing "f-tion" in place of "function"?

8-)
User avatar
Caligari87
I'm just here for the community
User Accounts Assistant
 
Joined: 26 Feb 2004
Location: Salt Lake City, Utah, USA
Discord: Caligari87#3089

Re: Multiplier is based on distance to dynlight OR sound sou

Postby Void Weaver » Wed May 29, 2019 9:05 am

Well, currently I have use a row of A_Explode calls indeed:
Code: Select allExpand view
<...>
A_JumpIfInventory("AuraLevel",6,"DarknessLevel6")
A_JumpIfInventory("AuraLevel",5,"DarknessLevel5")
A_JumpIfInventory("AuraLevel",4,"DarknessLevel4")
<...>
DarknessLevel5:
A_Explode(1,256,XF_NOSPLASH,0,256);
DarknessLevel4:
A_Explode(1,128,XF_NOSPLASH,0,128);
DarknessLevel3:
A_Explode(1,64,XF_NOSPLASH,0,64);
DarknessLevel2:
A_Explode(1,32,XF_NOSPLASH,0,32);
DarknessLevel1:
A_Explode(1,16,XF_NOSPLASH,0,16);
<...>
But since damage source is monster's aura leveling actor with dynamic growing dynlight radius, I consider calls of different A_Explode as placeholder. I. e. I want to use only 1 damage function, damage value inside of which takes into account pointerless distance from center of its source to any abstract actor within its dynlight(or sound) radius.

Caligari87 wrote:A_Explode already has damage falloff, why not use that?
Yeah, but I dunno its progression formula and seems there is no way to precise handle it, so I don't want use it blindly. Or I am wrong about this?

Well, ofc I can define a lot of A_Explode calls with checks for dynlight*(its level) but I whant to achieve the same effect without ladder of checks for A_Explode's or another damage function. Something like:
Code: Select allExpand view
A_Explode(1*CountInv("AuraLevel")*<(dynlight_radius)/(proximity_to_dynlight_source_distance)>,<dynlight_radius>)
OR
Code: Select allExpand view
A_Explode(1*CountInv("AuraLevel")*<(sound_audibility_max_distance)/(sound_attenuation)>,<sound_audibility_max_distance>)


Caligari87 wrote:Why do you keep writing "f-tion" in place of "function"?
Sorry, it's my habit to shorten a some words, but in my native language a similar shortens are quite acceptable. :oops: Thank you, I'll try to avoid so stupid usage further.
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014


Return to Scripting

Who is online

Users browsing this forum: Google [Bot], Volasaurus and 0 guests