Stop redeemer boost

Discussions about Coding and Scripting
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Stop redeemer boost

Post by iloveut99 »

Hello, does anyone know how can I stop redeemer boost?

Jack Griffin showed it in the antiboost tutorial in the old utsurvival forum, but I lost it.

Momentum = Vect(0,0,0); only works for other weapons.

Thanks.
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Stop redeemer boost

Post by Feralidragon »

In the Redeemer that won't work indeed. That is implemented directly in the shockwave and it's implemented in such a way to deflect even incoming projectiles.

Check the Shocwave class (under Effects), and go to the Timer function, and you will be able to find something like this:

Code: Select all

Victims.Velocity = Victims.Velocity + dir * (MoScale + 20); 
AND something like this as well:

Code: Select all

if ( Victims.bIsPawn )
       Pawn(Victims).AddVelocity(dir * (MoScale + 20));
else
       Victims.Velocity = Victims.Velocity + dir * (MoScale + 20); 
Subclass the shockwave class, and replace the Timer function with another without those lines.
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Stop redeemer boost

Post by iloveut99 »

Ok, thanks I'm going to try that but if I remember correctly Jack used to do this inside of 'mutator take damage' function.
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Stop redeemer boost

Post by Feralidragon »

iloveut99 wrote:Ok, thanks I'm going to try that but if I remember correctly Jack used to do this inside of 'mutator take damage' function.
Well, in the case of the Redeemer, that cannot be done that way afaik, that only works with other weapons, since TakeDamage has a Momentum argument, which you just need to nullfy before giving the actual damage to the player, however the Redeemer's shockwave is different, it doesn't use any momentum, it relies purelly on velocity, and no matter what movable colliding actor it hits, they all get exactly the same boost relative to their distance.

This was done mostly because they wanted the redeemer to deflect other projectiles away with its shockwave (to give a powerfull feeling from the weapon), so in order to avoid it, you have to either compensate the new velocity somehow, or replace the shockwave instances with other ones without those lines of code (or at least make them not to apply to pawns only).
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Stop redeemer boost

Post by JackGriffin »

If you want the full code, grab it from here:
http://www.moddb.com/mods/monsterhunt2
There is a link to the entire source.

Man that deny redeemer boost took me for freaking ever to fix too. Here is the relevant code for it:

Code: Select all

function MutatorTakeDamage (out int ActualDamage,Pawn Victim,Pawn InstigatedBy,out Vector HitLocation,out Vector Momentum,name DamageType)
{
	local Pawn P;

	if(DamageType == 'Impact') // hammer x5 ii !
	{
	   ActualDamage *= 5;
	}

	if(bUseAntiBoost)
	{
	    if(Victim != None && InstigatedBy != None)
	       {
                  if (InstigatedBy.IsA('PlayerPawn') && Victim.IsA('PlayerPawn'))
		     {
			Momentum = Vect(0,0,0);
                        ActualDamage = 0;
                        if (string(DamageType)=="RedeemerDeath")
                           {
			      Velocity = Vect(0,0,0);
			      Victim.Velocity = (Victim.Velocity * 0);
                           }
                     }
		}
	}
It works very well, it's simple and easy to include too. Update the damage string if you have specific super weapons to include also but this will cover redeemer, Ghandi ripper, etc.
Feel free to email me if you ever need anything. I'll always answer.
So long, and thanks for all the fish
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Stop redeemer boost

Post by Feralidragon »

I just see a little tiny problem with that code: in case you're already with some speed (kicker, jumppad, falling), once he/she gets with a shockwave, they will just stop in middle air and fall.

Perhaps you should compensate it instead (take the same speed away given from the shockwave, using the damage value which is dependent from the distance, and therefore proporcional to the velocity given, nullifying the new speed).

But either ways it's a good solution and the probability of something like this to happen is slim, however if there's a Redeemer in a w00t map, people will notice that.
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Stop redeemer boost

Post by iloveut99 »

JackGriffin wrote:If you want the full code, grab it from here:
http://www.moddb.com/mods/monsterhunt2
There is a link to the entire source.

Man that deny redeemer boost took me for freaking ever to fix too. Here is the relevant code for it:
...
Feel free to email me if you ever need anything. I'll always answer.
Hi Jack!

Yeah that's the code I was looking for. Thanks for registering to post it. :tu:

Thanks also for your availability to emails. :)

I just checked your mh2 mod video at the link above. Looks awesome, the end is so funny. :lol2: Is there any server where I can play it?
Feralidragon wrote:I just see a little tiny problem with that code: in case you're already with some speed (kicker, jumppad, falling), once he/she gets with a shockwave, they will just stop in middle air and fall.

Perhaps you should compensate it instead (take the same speed away given from the shockwave, using the damage value which is dependent from the distance, and therefore proporcional to the velocity given, nullifying the new speed).

But either ways it's a good solution and the probability of something like this to happen is slim, however if there's a Redeemer in a w00t map, people will notice that.
Thanks I was looking today at this code:
Victims.Velocity = Victims.Velocity + dir * (MoScale + 20);

And how nullify it in the mutator TakeDamage function. You are correct the velocity added by the redeemer can be calculated!

Code: Select all

Victims.Velocity + dir * (MoScale + 20); 

MoScale = ActualDamage

out Vector Momentum = (1000 * dir)
|
|-> dir=Momentum/1000
So I just putted this code in the function:

Code: Select all

Victim.Velocity = (Momentum/1000) * (ActualDamage + 20)-Victim.Velocity;
And it worked like a charm.

Thank you very much, you are always extremely helpful.

I will release the mutator now. =]
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Stop redeemer boost

Post by JackGriffin »

You'd better server test it first. Ferali is right about nullifying the velocity and making you drop but I had to do that for a reason. In testing I did exactly what you guys are discussing but it didn't work. Most of the time (due to server lag) the redeemer death and resulting velocity addition will register several times over. I can prove this by spawning a monster in MH and shooting it with a deemer. Only rarely will the damage stay at 1000. Most always you get double and triple the damage because the shockwave hits you multiple times. If you meet me in my MH test server ( 206.51.238.106:7777 ) I'll show you this in-game by shooting you as you jump up. You can see the waves pass over you while in mid-air because you will bob up and down slightly as the movement gets canceled. Nullifying the entire velocity was the only sure way I ever figured out that worked server-side. It's not the most beautiful solution but it does work well.
So long, and thanks for all the fish
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Stop redeemer boost

Post by iloveut99 »

Yeah seems you are right there are some spikes (sometimes) due to multiple waves, but it is working good so far. (I am running it on a dedicated server)

I may change the method later if I see it's better.
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Stop redeemer boost

Post by Feralidragon »

Well, that's a good point, didn't think about that. But like I said, it's only noticeable generally in w00t maps with kickers and jumppads, nowhere else, so it's nothing to worry about. :)
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Stop redeemer boost

Post by JackGriffin »

Those are all mine and use this same code medor (with the exception of v2 i think). That was about when I sorted the redeemer blast movement.

If this is still an issue with different gametypes I'd be happy to make a final multi-game version with options and such.
So long, and thanks for all the fish
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Stop redeemer boost

Post by iloveut99 »

Feel free to make a new version, since mine is based exclusively for serverside, without options of mutate commands and such.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Stop redeemer boost

Post by JackGriffin »

That's actually the better way. It's been my experience with letting the client decide that it just confuses them.
So long, and thanks for all the fish
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Stop redeemer boost

Post by iloveut99 »

Feralidragon wrote:In the Redeemer that won't work indeed. That is implemented directly in the shockwave and it's implemented in such a way to deflect even incoming projectiles.

Check the Shocwave class (under Effects), and go to the Timer function, and you will be able to find something like this:

Code: Select all

Victims.Velocity = Victims.Velocity + dir * (MoScale + 20); 
AND something like this as well:

Code: Select all

if ( Victims.bIsPawn )
       Pawn(Victims).AddVelocity(dir * (MoScale + 20));
else
       Victims.Velocity = Victims.Velocity + dir * (MoScale + 20); 
Subclass the shockwave class, and replace the Timer function with another without those lines.
Hm... Backing to this method. (the current that I am using sometimes project people in inverse side, when they hit the multiple waves and doing rocket boost; tried also the velocity*0 but it also seems have problems (the players stop for a while because multiple waves))

How should I exactly do it? Extend to Shockwave is enough? Or do I need to replace all reedemers with custom ones with the current new shockwave class?