Page 1 of 5

[Auto-Guiding Rockets] -- Beta 1

Posted: Tue Sep 06, 2016 2:26 am
by Gustavo6046
So I decided to exercise a bit more on my UnrealScript capabilities, and reading the UT_SeekingRocket, Razor2, and other actors, as well as my existing knowledge on UnrealScript, I have been capable on doing something that went on being super fun: Auto Rockets!

Those guys basically roam around the level avoiding walls and non-targetable Actors, and if they find some target, they rush to it! Boom!, Die b@%#&! Their code isn't very short either, sporting some functions, and even some netcode resulted from server tests with my father. :P

Code: Select all

//=============================================================================
// AutoRocket.
//=============================================================================
class AutoRocket expands UT_SeekingRocket;

var()	float	SeekAcceleration, SeekSpeed, TargetAcquiringRadius, WallAvoidSpeed, WallPredictionFactor, WallAvoidSlowdown;
var		Pawn	User;
var		int		Slowdown;
var		bool	bFoundUser;

replication
{
	reliable if ( Role == ROLE_Authority )
		User,
		Slowdown,
		bFoundUser;
}

simulated event Vector EstimateLocation(Actor Other)
{
	return Other.Location + (Other.Velocity / VSize(Velocity)) * 0.5;
}

simulated event HomeAt(Actor Other)
{
	Velocity *= VSize(Velocity cross (EstimateLocation(Seeking) - Location)) * SeekAcceleration;
	Acceleration = (EstimateLocation(Seeking) - Location) * SeekSpeed;
}

simulated event Actor WillHitWall(optional out Vector Location, optional out Vector OutNormal)
{
	return Trace(Location, OutNormal, Self.Location + Velocity * WallPredictionFactor);
}

simulated event bool CheckSeekable(Pawn Other, Pawn FireAgent)
{
	if
	(
		Other != None
		&&
		(
			FireAgent == None
			||
			(
				FastTrace(Other.Location)
				&& Other != FireAgent
				&& !Other.IsInState('Dying')
				&&
				(
					(
						ScriptedPawn(FireAgent) != None
						&& ScriptedPawn(FireAgent).AttitudeTo(Other) != ATTITUDE_Friendly
					)
					||
					(
						ScriptedPawn(Other) != None
						&& ScriptedPawn(Other).AttitudeTo(FireAgent) != ATTITUDE_Friendly
					)
					||
					(
						PlayerPawn(FireAgent) != None
						&& Other.AttitudeToPlayer != ATTITUDE_Friendly
						&& Other.PlayerReplicationInfo.Team != FireAgent.PlayerReplicationInfo.Team
					)
					|| Other.PlayerReplicationInfo.Team != FireAgent.PlayerReplicationInfo.Team
				)
			)
		)
	)	
	{
		return True;
	}

	return False;
}

function BeginPlay()
{
	if ( Owner == None )
		return;

	if ( Pawn(Owner) != None )
		User = Pawn(Owner);

	else
		User = Pawn(Owner.Owner);

	if ( User == None )
		return;
}

simulated function SetTarget(Pawn Other)
{
	Seeking = Other;

	Log(self@"is now seeking after:"@Other);
}

simulated event Timer()
{
	local Pawn P;
	local Pawn Target;
	local Actor A;
	local Vector WallNorm, WallLoc;

	SetRotation(Rotator(Velocity));

	A = WillHitWall(WallLoc, WallNorm);

	if ( A != None && ( LevelInfo(A) != None || !CheckSeekable(Pawn(A), User) ) && WallNorm dot (Velocity + Acceleration) < 0.9 )
	{
		Velocity /= WallAvoidSlowdown;
		Slowdown *= WallAvoidSlowdown;
		Acceleration -= WallAvoidSpeed * 2 * (WallNorm dot Velocity) * WallNorm;
	}

	else if ( Slowdown > 1 )
	{
		Velocity *= Slowdown;
		Slowdown = 1;
	}

	else bFoundUser = True;

	if ( Seeking != None && ( Pawn(Seeking) == None || !Pawn(Seeking).IsInState('Dying') || ( ScriptedPawn(Seeking) == None && User != None && ScriptedPawn(Seeking).AttitudeTo(User) == ATTITUDE_Friendly ) ) )
	{
		HomeAt(Seeking);
	}

	else
	{
		foreach RadiusActors(class'Pawn', P, TargetAcquiringRadius)
		{
			if ( Target == None || VSize(P.Location - Location) < VSize(Target.Location - Location) )
			{
				Target = P;

				if ( CheckSeekable(Target, User) )
					SetTarget(Target);
			}
		}
	}
}
(As well as some non-identifiable Accessed Nones in the CheckSeekable function ;_;)

Please remember it will work as desired only if fired from a weapon! (For example, AutoRocketGun below.)

Code: Select all

//=============================================================================
// AutoRocketGun.
//=============================================================================
class AutoRocketGun expands minigun2;

var()	float	ShootDistance;
var()	Vector	FireError;

function TraceFire(float Accuracy)
{
	Spawn(ProjectileClass, self, '', Pawn(Owner).Location + Normal(Vector(Pawn(Owner).ViewRotation)) * (Owner.CollisionRadius + ProjectileClass.default.CollisionRadius + ShootDistance) + FireOffset + VRand() * Accuracy, Rotator(Vector(Pawn(Owner).ViewRotation) + VRand() * FireError));
}

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 3:30 am
by ANUBITEK
Can we get a mutator that replaces the stock minigun with this auto rocket gun, in a package?

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 6:34 am
by sektor2111
Gustavo6046 wrote:As well as some non-identifiable Accessed Nones in the CheckSeekable function ;_;
Seriously you are non-identificable. Since you call variables never assigned what exactly are you expecting ?
Answer NO, not satisfied, Accessed Nones are not my favorites (and not only mine), and if you did not see this, everyone coding here properly is trying to avoid them.
For today you have an F.
Why ?
Because:
1. Your codes are bad.
2. Whatever MiniRocketGun or how the heck is called exist in MH, in one of those craps which (_@_) clan was using + bugged packages for more crashes but asking player to be polite :loool:. Me, one I was polite enough, I just screwed their craps in more error-free ones fixing them without to ask nothing in exchange.
Also there was a bugged enforcer firing rockets which I was fixing and now it do works as supposed... One of those Levels it's MH-TooMuchPupaeFixX, which in reality has no fix, it's all trash there.
You should take in account that HUMAN has the same definition over time: and WHEEL has been already invented.
LannFyre wrote:Can we get a mutator that replaces the stock minigun with this auto rocket gun, in a package?
I think we have some "packages" already...

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 2:59 pm
by Wormbo
Sector, get your act together. That post was rude and not helpful in any way.

Gustavo: Your function never checks if those pawns actually have a PRI in the first place.

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 5:43 pm
by sektor2111
Wormbo wrote:Sector, get your act together. That post was rude and not helpful in any way.
Maybe Not and maybe Yes... This young "coder" unable to put up a script (even was telling me in private) but screwing info at Wiki seems to not learn lessons.
Now let me quote MissileGun01... to 0X ALREADY Done and can be used as inspiration for any such thing... And title sounds as a prophanity "Are you satisfied ?" Sure - with Accessed Nones only stupid people are clapping hands and legs and heads.
And these are ones of those small steps done at UT99.org in way down hill - like Jack Said someday will get an end. Let a kid to drive the car and say a pray.
Keep going... now let's see a few... codes:

Code: Select all

      foreach RadiusActors(class'Pawn', P, TargetAcquiringRadius)
      {
         if ( Target == None || VSize(P.Location - Location) < VSize(Target.Location - Location) )
         {
            Target = P;

            if ( CheckSeekable(Target, User) )
               SetTarget(Target);
         }
      }
As I can figure so far all pawns in radius are registered as target until last one. Once finding a target it should break because it won't track all pawns there. The rest of blabbering there doesn't worth a check, only when I'm looking at this iterator already I can see how do it works...
A simple code might be technically doable by Setting up a "Seeked" in any SeekingRocket class which can be sorted using Eightball's feature a bit modified - pretty good code...
Little note

Code: Select all

( 

ScriptedPawn(Seeking) == None && User != None && ScriptedPawn(Seeking).AttitudeTo(User) == 
ATTITUDE_Friendly )
Snippet Translated sounds as follows:
(if) Monster Victimized doesn't exist and User (Instigator probably) exist and Monster Victimized (which doesn't exist) has attitude to User attitude friendly... bla bla... I don't want to find results here...
Or another translation if a Null monster is friend with player... Mushrooms huh ?

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 7:06 pm
by EvilGrins
It's always nice to re-visit the classics.

Mutator came out around 2002, I believe. Called Smart Rockets. Replaces the standard rocket launcher with an identical weapon that fires rockets that last 3 times as long as the standard ones, that once locked on a target will follow it until they hit said target.

Thing I always liked about them was playing them in CTF on HallOfGiants, because if you got killed while they were tracking you, they'd lock onto your new position wherever you re-spawned back into the game.

I mean, sure... they'd do that on any map but HoG has a lot more sky for a good chase and smart rockets are INSANELY fun in low gravity!

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 7:49 pm
by Terraniux
LannFyre wrote:Can we get a mutator that replaces the stock minigun with this auto rocket gun, in a package?
I second that.

I don't care wether there already such an actor around, I'm always interested to see what people present.
Motivate, yet give constructive criticism.

Keep going gustavo!

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 8:01 pm
by Gustavo6046
sektor2111 wrote:with Accessed Nones only stupid people are clapping hands and legs and heads.
Yes. Actually, the reason for the accessed none is one only, and it's located hidden (--or not anymore; thanks Wormbo) in that function. However the number of calls to it... :wth:
A simple code might be technically doable by Setting up a "Seeked" in any SeekingRocket class
e
Unsure if I understood this little part, but if you meant SetEnemy wasn't necessary, I made it in case I wanted to add any future checks or stuff for everytime the target would be changed. :P

As for that teammate check... :omfg:

And thanks for your constructive criticism. You could be a bit easier with it since I'm still learning to code big stuff like this, but you have been great help for today. Guess I'll do the real fix (not MH's bugged and f*!&#ed up additions labeled "fixes") and then set this code as reference for the next one. :)

(Also hey, would someone like if I added a machine gun to this rocket and it self-destructed as last resort? :ironic: )
LannFyre wrote:Can we get a mutator that replaces the stock minigun with this auto rocket gun, in a package?
Terraniux wrote:
I second that.

I don't care wether there already such an actor around, I'm always interested to see what people present.
Motivate, yet give constructive criticism.

Keep going gustavo!
Soon! That is, I already have done one, but I'll distribute GusPack II (oh no, revealed ;_;) in no time! :D :D :D

P.S.
sektor2111 wrote:but screwing info at Wiki
Haven't we discussed about this ages ago? :S

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 10:05 pm
by sektor2111
Terraniux wrote:
LannFyre wrote:Can we get a mutator that replaces the stock minigun with this auto rocket gun, in a package?
I second that.

I don't care wether there already such an actor around, I'm always interested to see what people present.
Motivate, yet give constructive criticism.

Keep going gustavo!
It is advisable to check what was introduced in first forum entrance and later posts. Some guys were retreating because of these stupid posts and by the other one too. Actually he has a fan posting a screenshot where anyone could figure an aimbot loaded - and is still here untouched + doesn't even have 18 years old for ON-Line rights, ahah. Even doing only incomplete and broken things they are still roaming and nothing is changed, just check and see if I'm lying. Else check what was replied in latest <skins> thread before defending this awesome disrespectful kid. See what others from staff were saying before encouraging such habits. It seems that always is trying to piss off a green guy or red guy and later showing that he was joking and he not listening at people older than Internet. So slow down this defending to not be disappointed.
Gustavo6046 wrote:but I'll distribute GusPack II (oh no, revealed ;_;) in no time! :D :D :D
God help us!
Gustavo6046 wrote:Haven't we discussed about this ages ago? :S
Ages ?? First you need to accomplish an age and then we can chat about more. While you were PM-ing me about your skill in doing stuff I see that you have a replay, nothing is changed from last stupid code which didn't even work. When you start 100 things finishing nothing that's less helpful. Now you have a sudden turn for Net Stuff - which might be a good change and you should follow this way, more helpful.
Too bad, in whatever future I won't be here, when Higor will finish and stabilize XCGE I'll jump in my yard where I have my clean place ignoring "awesome" super duper with no functionality stuff which is spread here. :agree1:

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 10:23 pm
by Gustavo6046
sektor2111 wrote:piss off a green guy or red guy
The fuck? The only one I would want to piss of is you, who did also piss me off.
last stupid code
that was done long ago and thus deprecated.

You should know I have been long trying to have this shit working in servers. And that you are so outdated on what I've been doing (though this is my fault since I've been long a period with little to no posts here). Shut up now, please, I'm not gonna talk to you again.

I shouldn't have returned... (And please don't come with crap about "get better and return", because it won't glue!)

At least you gave constructive criticism. But if you keep doing that retardness (remember that's not how I'm gonna get better if you keep shitting like that!) please get off.

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 10:27 pm
by darksonny
Ok this is enough

Somebody at Staff in this forum, should draw attention to Sektor (or ban him for a while, if he persists in their bad attitude), his arrogance is being increased every post he writes here I can't stand f***** arrogance guys like this "sir". Would you like to be treated with agressiveness as you treat to gustavo? Im sure not, don't come here with programming lessons here if its done with arrogance you are acting like Isis with your dogmatism. Get out here, f*** some girl, take some joint, whatever you want, make some slow breathing and leave Gustavo in peace, f**** as*****!.

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 10:30 pm
by sektor2111
May I refresh your memory. In case you have a sudden amnesia:
viewtopic.php?f=13&t=6734#p80038
darksonny wrote:Ok this is enough

Somebody at Staff in this forum, should draw attention to Sektor (or ban him for a while, if he persists in their bad attitude), his arrogance is being increased every post he writes here I can't stand f***** arrogance guys like this "sir". Would you like to be treated with agressiveness as you treat to gustavo? Im sure not, don't come here with programming lessons here if its done with arrogance you are acting like Isis with your dogmatism. Get out here, fuck some girl, take some joint, whatever you want, make some slow breathing and leave Gustavo in peace, f**** as*****!.
You should read then his posts generally and then do what you were saying to me because you seems to not really read forum but just only what you want, and truth slaped in face is painful as usual. Yes, please some staff can ban me, or whatever, because I'm busy these days with other things... :wink:.

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 10:31 pm
by Gustavo6046
Ok, I'm calm now.

No need to act now. Nor you darksonny, thanks.

I'm gonna close this thread for some time, and it's gonna get better. Later I post again, if I don't get away.
May I refresh your memory. In case you have a sudden amnesia:
viewtopic.php?f=13&t=6734#p80038
When was that? January? Dang, I'm always with shame from that time. Now please, don't mess with me again, right?

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 10:45 pm
by darksonny
I will leave this discussion for both, i am not going to tell anything, that gustavo (form the link you put) could have acted rude does not mean you did not do the same. You overreacted in the same way as him, so you failed with that attitude.

You could have ignored (if the solution is there, by using the search engine) this post nobody forces you to write something rude here, in this life everything does it have election, you can choose not no be rude (or directly not to answer) or to be patient, or whatever.

Good luck and have a nice day

Re: Auto-Guiding Rockets -- Are you satisfied now?

Posted: Tue Sep 06, 2016 10:47 pm
by sektor2111
darksonny wrote:Good luck and have a nice day
Thank you, Sir !