Tiger wrote:Combinebobnt wrote:i wonder if i posted the solution in this thread.
Can you please walk me through this code?
The
morgensteinplayer ACTOR takes 50% less damage from the
newrockkit ACTORs who dealt "oyeababyatriple" damage type to it. So we do the maths:
Base damage: 20 * 50% = 10
Radius damage: 128* 50% = 64
Total = 74.
That means, one player can get hurt by its own rocket by half the original amounts but it will deal that same halved damage to other players too. HOWEVER! We DO want full damage dealt when one player hits another player with a rocket. How to achieve this?
1. Increase base damage by 100% so it doesn't get halved by the DamageType property. Hence the line
Damage 20*2 //don't forget missile impact damage! at the rocket ACTOR definition.
2. Increase radius damage by 100% (128 -> 256) and deal the radius damage in two instantaneous blows. The first one will hurt the player which fires the rocket and the damage will be divided by 2. This is the line
TNT1 A 0 A_Explode(128, 128, XF_HURTSOURCE) //explosion part.
3. The second part of the blast will not hurt the player who fired the rocket but it will hurt others. This is the line
TNT1 A 0 A_Explode(128, 128, 0)
So, we do some simple math imagining we hit ourselves with our own rocket:
Base damage: 40 * 50% * 0 = 0
Radius damage1: 128 * 50% * 1 = 64, this part deals damage because of XF_HURTSOURCE.
Radius damage2: 128 * 50% * 0 = 0, this part does not apply since it's our own rocket.
Total = 64
And when we hit another player:
Base damage: 40 * 50% = 20
Radius damage1: 128 * 50% * 1 = 64
Radius damage2: 128 * 50% * 1 = 64, now this part applies because it's our rocket hitting another player.
Total = 148
Crucial question: Then why don't we just ignore DamageType and halve all quantities directly?
Crucial answer: Because A_Explode would not deliver enough damage to rocketjump. If we reduce A_Explode damage to 64 and divide by 2, we would only receive 64 points of damage instead of the original 128 needed for normal rocketjumping.
Crucial question 2: But doesnt the radius damage gets halved by the "ohyeababyitsatriple" damage factor?
Crucial answer 2: Indeed, it does get halved. However, thrust does not. So if we specify 64 instead of 128 directly we get half of the thrust received from a rocket blast.
Crucial question 3: Then, could other players receive two times the thrust with this?
Crucial answer 3: I don't know. We should try and see.