Tired of setting up KickVelocity? Easy Kicker Mod!

Need some nice Mods? Here, you are right!
User avatar
Gustavo6046
Godlike
Posts: 1218
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Zeta Group leader
Location: Brazil

Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 » Mon Jan 18, 2016 12:03 am

Hello guys! :) I don't know if this already have been done (if yes, then feel free to close this thread, unless you don't want to), but I have two cool actors that will probably make a revolution in the way of making JumpPads. It's called EasyKicker and EasyKickerDest. It doesn't replace the default Kicker but allows to set up a destination point instead of having to manually set up the KickVelocity (ah man, how I hate that!). Setting up a jump pad becomes very simple!
  • Make a LiftCenter in the jump pad's location and a EasyKickerDest in the destination of the jump pad.
  • Link the LiftCenter and EasyKickerDest (the latter which is a LiftExit subclass).
  • Copy EasyKickerDest's name in the Object tab and paste it in the DestinationName field in the EasyKicker.
  • Lastly set KickHeight to the height of the apex of the arc, so that e.g. the kicked pawn can overgo obstacles beyond which (or go up the gap above which) lies the EasyKickerDest!
  • Not forgetting you can also set bRandom and bKillVelocity in Kicker tab as you would normally!
And you're done! This time I tested it because I used the fan to provide wind to cool down the PC. However I had to ask too much to family members because they said they wanted it too!

Download Now!

The algorithm is actually pretty simple. This EasyKicker just subtracts the location of corresponding EasyKickerDest by its own location and stores the result in KickVelocity, adding KickHeight to the Z part later. Tadaa! :)

Also, if I shouldn't have posted this, please don't get insane as most people get :( I just wanted to share this solution!

EDIT: To secure the situation, I must argue I didn't found anything like this when searching UT99 using that search bar. So I guess this is safe :)

User avatar
PrinceOfFunky
Godlike
Posts: 1164
Joined: Mon Aug 31, 2015 10:31 pm

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by PrinceOfFunky » Mon Jan 18, 2016 4:18 am

Gustavo6046 wrote:Also, if I shouldn't have posted this, please don't get insane as most people get :( I just wanted to share this solution!
Don't say "please" to people who get insane .o. They might say please to not to be judged, when they get insane :D lol
"Your stuff is known to be buggy and unfinished/not properly tested"

User avatar
Gustavo6046
Godlike
Posts: 1218
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Zeta Group leader
Location: Brazil

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 » Mon Jan 18, 2016 1:44 pm

PrinceOfFunky wrote: Don't say "please" to people who get insane .o. They might say please to not to be judged, when they get insane :D lol
Great jokel! :loool: (is that a Minecraft sign?)

User avatar
Gustavo6046
Godlike
Posts: 1218
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Zeta Group leader
Location: Brazil

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 » Wed Jan 20, 2016 9:36 pm

Double-post (24 hours has passed and I NEED HELP) and....

I decided to make it EVEN EASIER! So

1. You would put a LiftExit near the start, a EasyKicker2 in the jump pad, and a EasyKickerDest in the destination.
2. Match their all's LiftTag and the EasyKicker2's DestTag with EasyKickerDest's Tag.
3. Set bKilLVelocity to true and tweak the collision of EasyKicker2.

However it isn't working! i.e. isn't kicking you.
Here's the code:

Code: Select all

//=============================================================================
// EasyKicker2, the world's easiest UT99 jump-pad.
//=============================================================================
class EasyKicker2 expands LiftCenter;

var				vector	KickVelocity;
var(EasyKicker)	name	KickedClasses;
var(EasyKicker)	bool	bKillVelocity;
var(EasyKicker)	bool	bRandomize;
var(EasyKicker)	name	DestTag;

function float VSizeSq(Vector a)
{
  return a dot a;
}

function PreBeginPlay()
{
	local	EasyKickerDest	A;
	local	float			Closest;
	local	float			SQD;

	Closest = 0;

	foreach AllActors(class'EasyKickerDest', A, DestTag)
	{
		SQD = VSizeSq(A.Location - Location);

		if ((SQD < Closest) || (Closest == 0))
		{
			Closest = SQD;
			KickVelocity = A.Location - Location;
			KickVelocity.Z += sqrt(SQD) / 2;
		}
	}
}

simulated function Touch( actor Other )
{
	local Actor A;

	if ( !Other.IsA(KickedClasses) )
		return;
	PendingTouch = Other.PendingTouch;
	Other.PendingTouch = self;
	if( Event != '' )
		foreach AllActors( class 'Actor', A, Event )
			A.Trigger( Other, Other.Instigator );
}

simulated function PostTouch( actor Other )
{
	local bool bWasFalling;
	local vector Push;
	local float PMag;

	bWasFalling = ( Other.Physics == PHYS_Falling );
	if ( bKillVelocity )
		Push = -1 * Other.Velocity;
	else
		Push.Z = -1 * Other.Velocity.Z;
	if ( bRandomize )
	{
		PMag = VSize(KickVelocity);
		Push += PMag * Normal(KickVelocity + 0.5 * PMag * VRand());
	}
	else
		Push += KickVelocity;
	if ( Other.IsA('Bot') )
	{
		if ( bWasFalling )
			Bot(Other).bJumpOffPawn = true;
		Bot(Other).SetFall();
	}
	Other.SetPhysics(PHYS_Falling);
	Other.Velocity += Push;
}

//=============================================================================
// EasyKickerDest.
//
// Marks the destination location for the corresponding EasyKicker actor.
//=============================================================================
class EasyKickerDest expands LiftExit; 

EDIT: Nevermind, I just found out I FORGOT to set KickedClasses! :loool:

User avatar
Wormbo
Adept
Posts: 258
Joined: Sat Aug 24, 2013 6:04 pm

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Wormbo » Thu Jan 21, 2016 7:09 am

I'd like to point out that, while calculating VSizeSq generally would be faster than calculating VSize if both were implemented at the same level, the UnrealScript implementation of VSizeSq will always be slower than the native implementation of VSize.
Do yourself a favor and follow the two basic rules for optimization:
  1. Don't do it!
  2. (for experts only) Don't do it yet!
You'd be lying to yourself if you already consider yourself an expert, so just stick to rule 1 for now.
But if you are trying to venture into the unknown that is rule 2, keep this in mind: The only justification for an optimization of this kind would be evidence that the optimized version actually is faster. (if you're really lazy, a solid theoretical proof may be just enough, but nothing beats actual measurement)

User avatar
Gustavo6046
Godlike
Posts: 1218
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Zeta Group leader
Location: Brazil

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 » Thu Jan 21, 2016 1:15 pm

@Wormbo Well since the entire thing is calculated at KICKIN TIME it means it isn't necessary to be very fast. Now I have to determine the height.

EDIT: Problem! I tried

Code: Select all

function PreBeginPlay()
{
	local	EasyKickerDest	A;
	local	float			Closest;
	local	float			SQD;
	local	float			NQD;
	local	float			HQD;

	Closest = 0;

	foreach AllActors(class'EasyKickerDest', A, DestTag)
	{
		NQD = VSize(A.Location - Location);
		SQD = NQD ^ 2;
		HQD = (A.Location - Location).Z;

		if ((SQD < Closest) || (Closest == 0))
		{
			Closest = SQD;
			KickVelocity = A.Location - Location;
			KickVelocity.Z = ((A.Location.Z - HQD) / SecondsToDestination) + ((-Level.ZoneGravity.Z * SecondsToDestination) / 2);
		}
	}
}
but at some jump pads I get launched like twice the power needed! (Exactly twice!!) Who can help? Someone good with Math?

User avatar
FXANBSS
Skilled
Posts: 231
Joined: Thu Dec 26, 2013 7:03 pm

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by FXANBSS » Fri Jan 22, 2016 3:21 am

Oh no, never, BUT NEVER A CLASS MUST END IN A NUMBER.

It was Waffnuffly's nightmare, if there is a EasyKicker and EasyKicker2 then the "Name" value f*cks itself and sh*t happens.

User avatar
Gustavo6046
Godlike
Posts: 1218
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Zeta Group leader
Location: Brazil

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 » Fri Jan 22, 2016 2:42 pm

FXANBSS wrote:Oh no, never, BUT NEVER A CLASS MUST END IN A NUMBER.

It was Waffnuffly's nightmare, if there is a EasyKicker and EasyKicker2 then the "Name" value f*cks itself and sh*t happens.
Fixed. Now it is EasyKickerModII instead of EasyKicker2. Just a mistake in putting "mod"...

What information should the destination hold other than LiftTag?

User avatar
Wormbo
Adept
Posts: 258
Joined: Sat Aug 24, 2013 6:04 pm

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Wormbo » Fri Jan 22, 2016 5:33 pm

FXANBSS wrote:Oh no, never, BUT NEVER A CLASS MUST END IN A NUMBER.
That's actually more of a guideline than a rule. In fact, there are dozens of UT classes, including the body armor and many decorations, effects and player models that end with a digit.

User avatar
sektor2111
Godlike
Posts: 5388
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by sektor2111 » Fri Jan 22, 2016 6:21 pm

They are asleep, else a normal human being awake can see that we don't have any issue at using numbers at end of a class.

User avatar
Gustavo6046
Godlike
Posts: 1218
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Zeta Group leader
Location: Brazil

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 » Fri Jan 22, 2016 6:46 pm

And why am I launched at double the power at some jump pads without bHalve?

User avatar
Barbie
Godlike
Posts: 2124
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Barbie » Fri Jan 22, 2016 7:04 pm

FXANBSS wrote:Oh no, never, BUT NEVER A CLASS MUST END IN A NUMBER.
(Isn't that a double negation? ^^)

I can imagine that trouble comes in if you have different classes where their names distinct only in the digits in the end, eg:

Code: Select all

class SuperActor extends WhatEver;
class SuperActor1 extends WhatEverOther;
If you add an instance of SuperActor it will be named SuperActor0. If you add an instance of SuperActor1 it will be named SuperActor10. What class is an instance with the name SuperActor123 then? (I remember dark I've read somewhere that later engines adds an underscore to the class name before numbering to avoid that.)
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

User avatar
sektor2111
Godlike
Posts: 5388
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by sektor2111 » Fri Jan 22, 2016 8:31 pm

Class is just Class and Object.Name is a name assigned to that class in current instance, class stay but name differs because it gets wrapped - class never changes unless you bind some crappy stupid native to mock everything. That's why you fail, my dear coders...
[attachment=0]Class_VS_ObjectName.png[/attachment]
And for extra light
I'm writing
Pawn(Other) != None
Not really
Pawn1343(Other) != None. :lol2:

Honestly I'm feel sorry for coders which are confusing Object.Name with Class. This leads only in a general failure, not exactly that General Failure which sometimes is accessing your drives :mrgreen: .
You do not have the required permissions to view the files attached to this post.

Higor
Godlike
Posts: 1832
Joined: Sun Mar 04, 2012 6:47 pm

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Higor » Fri Jan 22, 2016 9:09 pm

Gustavo6046 wrote:function float VSizeSq(Vector a)
{
return a dot a;
}
Bad UnrealScript for the use you're giving it.
Slow because it causes a function lookup (via a field iterator)
Slow because it causes allocation of a new script stack (uscript function call).
Slow because you're passing (a) three times (one in VSizeSq, two in DOT)
Slow at an order of 10 times i'd say.
Use VSize( vector V)



Gustavo6046 wrote: Closest = 0;

foreach AllActors(class'EasyKickerDest', A, DestTag)
{
SQD = VSizeSq(A.Location - Location);

if ((SQD < Closest) || (Closest == 0))
Bad 'closest element' algorithm.
Your upper limit should be infinity or the engine's max distance.
You should use a single check.
Try this

Code: Select all

]   ClosestD = 100000;

   foreach AllActors(class'EasyKickerDest', A, DestTag)
   {
      Dist = VSize(A.Location - Location);

      if ( Dist < ClosestD )
I'd personally calculate the kick velocity on the fly, and instead cache the destination reference.


Barbie wrote:If you add an instance of SuperActor it will be named SuperActor0
Right
Barbie wrote:If you add an instance of SuperActor1 it will be named SuperActor10
Wrong, digits are chopped off starting from the right until a letter is found.

The name generator generates the same output for both examples.


============================================
XC_Siege_r3.u
https://github.com/CacoFFF/SiegeIV-UT99 ... README.txt

Lookup XC_TargetedKicker

============================================
This map has a UT3 styled variation of this kicker (and linked nodes allowing good bot usage)
https://www.ut99.org/viewtopic.php?f=5& ... 572#p69578
The variation will enforce speed for a very short while so high air control won't screw up your landing.
You do not have the required permissions to view the files attached to this post.
ImageImage
Image unreal://23.111.157.138:7777
Image unreal://46.228.199.205:7788

User avatar
Gustavo6046
Godlike
Posts: 1218
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Zeta Group leader
Location: Brazil

Re: Tired of setting up KickVelocity? Easy Kicker Mod!

Post by Gustavo6046 » Fri Jan 22, 2016 9:31 pm

Oh but mine's power can be scaled, and bots use it well, and here is a AS-Frigate variation with two jump pads!

Annexed are the files needed to run it.
You do not have the required permissions to view the files attached to this post.