[UT99] Player invulnerable

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Zisu

Rune Player
Dec 12, 2004
34
0
0
Maybe make a new state shielding that ignores... stuff. Look examples at existing state coing in some of the superclasses of your player. PlayerPawn.uc is a good place to start.

You need to add checks to function that determines the amount of damage player takes if the shield is on. With brief glance you have only set animations, not the actual functionality. You should also have a variable (int, float) to have the shield energy and redure it in playertick, playermove or timer function that you define in your new state. Remember to call super though. Anyway, state is your friend in this imo.
 

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
thank you...i've always been a weapons guy so this is new territory for me...
i'll try it out and let you know. thanks for the help! :)
but waht about making a scripted texture on the Canvas that indicates energy>?


and the blood? maybe i should just looks at SevenB.TVPlayer for that...
noob1pk.gif
 
Last edited:

draconx

RuneUT
Jun 26, 2002
325
0
0
36
Waterloo, Canada
You could make an energy meter on the HUD by using a 1x1 white square and scaling it to the apropriate size using DrawRect. Use the DrawColor property to set the colour to whatever you wish
 

Bonehed316

New Member
Oct 15, 2001
208
0
0
41
Florida
Visit site
I had an old feature for a cheat protection mutator for UT99 that I called practice mode, where no one could die. Worked great as a last resort when a botter came in and started laming the place up. If they cant kill you, they leave, lol. Works great if you dont mind wasting some time.

Inside Pawn there is a variable called ReducedDamageType.

var() name ReducedDamageType; //Either a damagetype name or 'All', 'AllEnvironment' (Burned, Corroded, Frozen)

Maybe that helps. ;)
 

draconx

RuneUT
Jun 26, 2002
325
0
0
36
Waterloo, Canada
Although this may not apply to your particular case, i'll put it here anyway:

For pickups, however, I find it much more elegant to make the pickup an armor, set the AbsorptionPriority to some large value, and then in the ArmorAbsorbDamage function just set the damage to zero.

Avoids any problems that might arise using ReducedDamageType (i.e. 2 different things try to set it to 2 different values).
 

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
Code:
var() name ReducedDamageType;
:
State Invulnerable()
{
:
Function BecomeInVulnerable()
{
TweenAnim('HldShld',1.3);
ReducedDamageType=All;
}
:
Function BecomeVulnerable()
{
TweenAnim('Idle',1.1);
ReducedDamageType=None;
}
:
}
something like that? hte ":" indicates code i didnt post; now another questoin: how to make it so plyer can only turn, not shoot, move, or jump when invulnerable? hmm...
noob1pk.gif




my original idea was that when invulnerable, ur nrg goes down faster if its taking damage, a pickup armor couldnt do that, unless someone whats to tell me how to make regenerateing triggerable armor that is bound into the canvas and user key binding...
btw how should i go about (in my HUD class) calling the energy the player has and displaying that on a bar? huds are my weakest point of all...
once again i tahnk you all 4 ur help :).
 
Last edited:

Asgard

New Member
Oct 6, 2000
265
0
0
Visit site
here is a tutorial which explains how to draw health on a vertical bar..
http://chimeric.beyondunreal.com/tutorials/tut33.php
you could adapt it to suit

At the begining of the state you may be able to spawn a new hud and at the end restore the old one (if you only want an temp hud). Or in BecomeInVulnerable and BecomeVulnerable

I do this in a armor type mod (pickup) that Ive made.. When its activated the new hud is drawn.. When deactivated the old one is restored.


Have a look at state PlayerWaiting for function Jump all code is blanked out and have a look at fire and alfire.
Notice the state ignores TakeDamage.. Which gives you another option to decide on. can add ignores jump..

You should probably also have a look at state FeigningDeath as this is similar to what youre trying to do, you could even change the state so it does the shielding in that instead of feigning death.. Options :) Your answers about firing moving etc are in that

if youre using ReducedDamageType.. from playerpawn god function
ReducedDamageType = 'All';
ReducedDamageType = '';

You could even spawn an invisible shield where the shield appears (similar to what the queen does). If for example you think the player should be able to take damage from behind etc.. more options..

cheers
 
Last edited:

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
well, it is a skaarj player...a pic would help...! ;)(the following pics are of a stationary object with AnimName and AnimFrame set on the normaly thrid person dummy; pretend the skaarj is your beta testing friend ;))
if you try to attack from the front, you can only were his energy down...
[screenshot]http://img228.exs.cx/img228/2789/shot02274xx.jpg[/screenshot]
but if you come fomr behind, hes screwd
[screenshot]http://img228.exs.cx/img228/9854/shot02268ft.jpg[/screenshot]

like that?
btw im using my custom hud so far...i have removed the current ammo and accidntly inventory, it was supposed to be health that went poof( 3 bars, Green, red , and blue; in order: health, armor, and energy.
taht is, when i finish. ;)
 
Last edited by a moderator:

Asgard

New Member
Oct 6, 2000
265
0
0
Visit site
Yeah I know :)

Humour me.. Go copy the entire state FeigningDeath (from playerpawn) and rename it to State Invulnerable, then.. change it so..
State Invulnerable()
ignores TakeDamage;

Swap the FeigningDeath animation for the shielded animation.

The make a function..
exec function shield()
gotostate Invulnerable

When you type in shield at the console or make a bind for it you'll be in the shielded state. When u press jump or fire you'll leave shielded state and go to state PlayerWalking.

The only thing is youll have to update the players rotation and animation so he can turn..

If you dont want him immune from all damage and can take damage from behind, remove "ignores TakeDamage" and you can either spawn an invisible shield which rotates with the player or edit takedamage so you only takedamage from behind etc or if he takes damage from the front his shield wears down instead of health.

State FeigningDeath also comes with a nice little eyeheight update you can also make use of.

Then I guess edit the rest to suit with any changes you want to make.

You were asking "how to make it so player can only turn, not shoot, move, or jump when invulnerable? hmm..." Well you might find what youre looking for in state FeigningDeath.

cheers
 

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
ok, so i've made it so when Insert is pressed, my player tweens to the 'holdshield' animation, and becomes invulnerable...but when i press insert agin, he does not go back to normal...
thanks for the help, im on the right track now...ideas are still welcome... :)

edit: ok, it works now,,...somewhat...
you have to contiuously tap the Insert key in order to be protected...you cant take damage untill the current animatoin is done, though ;).
 
Last edited:

Asgard

New Member
Oct 6, 2000
265
0
0
Visit site
Well are you using the state FeigningDeath code? You'll notice that if you press fire or jump youll be out of the state and thrown into state playerwalking and problem solved.. :)

You can also make another exec function "shieldoff" which throws the player to state playerwalking.
exec function shieldoff()
gotostate playerwalking

Then in the readme you could include a bind
shield||shieldoff

set input s shield||shieldoff
which makes the s key toggle the exec functions on and off.. Altho theres a lot of players that may not understand that so it might be an idea to leave it as optional with fire and jump still throwing them to state playerwalking..

cheers
 
Last edited:

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
it works... :D
Code:
var() float NRG;
var() bool bShielded;
var int no;

exec function UnShield()
{
bShielded=false;
TweenAnim('ShldDown', 0.12);
Jump();
}

exec function shield() 
{		
	if(NRG>=5)
		{
			bshielded=True;
			//PlayAnim('ShldUp', 0.7, 0.12);
			TweenAnim('HoldShield', 0.12);
			gotostate('Shielded');
		}
}

State Shielded
{
	Ignores TakeDamage;



	exec function Fire( optional float F )
	{
UnShield();
	}

	exec function AltFire( optional float F )
	{
UnShield();
	}
	function PlayChatting()
	{
	}

	exec function Taunt( name Sequence )
	{
	}

	function AnimEnd()
	{
		if ( Role < ROLE_Authority )
			return;
		if ( Health <= 0 )
		{
			GotoState('Dying');
			return;
		}
		GotoState('PlayerWalking');
		PendingWeapon.SetDefaultDisplayProperties();
		ChangedWeapon();
	}
	
	function Landed(vector HitNormal)
	{
		if ( Role == ROLE_Authority )
			PlaySound(Land, SLOT_Interact, 0.3, false, 800, 1.0);
		if ( bUpdating )
			return;
		TakeFallingDamage();
		bJustLanded = true;				
	}

	function Rise()
	{
		if ( (Role == ROLE_Authority) && (Health <= 0) )
		{
			GotoState('Dying');
			return;
		}
		if ( !bRising )
		{
bShielded=false;
TweenAnim('ShldDown', 0.12);
Jump();
			Enable('AnimEnd');
			BaseEyeHeight = Default.BaseEyeHeight;
			UnShield();
		}
	}

	function ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)	
	{
		if ( bJustFired || bPressedJump || (NewAccel.Z > 0) )
			Rise();
		Acceleration = vect(0,0,0);
	}

	event PlayerTick( float DeltaTime )
	{
		Weapon = None; // in case client confused because of weapon switch just before feign death
		if ( bUpdatePosition )
			ClientUpdatePosition();
		
		PlayerMove(DeltaTime);
	}

	function ServerMove
	(
		float TimeStamp, 
		vector Accel, 
		vector ClientLoc,
		bool NewbRun,
		bool NewbDuck,
		bool NewbJumpStatus, 
		bool bFired,
		bool bAltFired,
		bool bForceFire,
		bool bForceAltFire,
		eDodgeDir DodgeMove, 
		byte ClientRoll, 
		int View,
		optional byte OldTimeDelta,
		optional int OldAccel
	)
	{
		Global.ServerMove(TimeStamp, Accel, ClientLoc, NewbRun, NewbDuck, NewbJumpStatus,
							bFired, bAltFired, bForceFire, bForceAltFire, DodgeMove, ClientRoll, (32767 & (Rotation.Pitch/2)) * 32768 + (32767 & (Rotation.Yaw/2)));
	}

	function PlayerMove( float DeltaTime)
	{
		local rotator currentRot;
		local vector NewAccel;
	
		aLookup  *= 0.24;
		aTurn    *= 0.24;

		// Update acceleration.
		if ( !IsAnimating() && (aForward != 0) || (aStrafe != 0) )
			NewAccel = vect(0,0,1);
		else
			NewAccel = vect(0,0,0);

		// Update view rotation.
		currentRot = Rotation;
		UpdateRotation(DeltaTime, 1);
		SetRotation(currentRot);

		if ( Role < ROLE_Authority ) // then save this move and replicate it
			ReplicateMove(DeltaTime, NewAccel, DODGE_None, Rot(0,0,0));
		else
			ProcessMove(DeltaTime, NewAccel, DODGE_None, Rot(0,0,0));
		bPressedJump = false;
	}

	function PlayDying(name DamageType, vector HitLocation)
	{
		BaseEyeHeight = Default.BaseEyeHeight;
		if ( bRising || IsAnimating() )
			Global.PlayDying(DamageType, HitLocation);
	}
	
	function ChangedWeapon()
	{
		Weapon = None;
		Inventory.ChangedWeapon();
	}

	function EndState()
	{
		bJustFired = false;
		bshielded = false;
	}
	function BeginState()
	{
		local rotator NewRot;
		if ( carriedDecoration != None )
			DropDecoration();
		NewRot = Rotation;
		NewRot.Pitch = 0;
		SetRotation(NewRot);
		bIsCrouching = false;
		bPressedJump = false;
		bJustFired = false;
		bRising = false;
		Disable('AnimEnd');
		PlayShield();
		bShielded = true;
	}
}
function PlayRising()
{
		TweenAnim('ShldDown', 0.12);
}
function PlayShield()
{
PlayAnim('ShldUp', 0.7, 0.12);
}
:
:
:

best part is, in invulnerable mode, holding delete (my Behindview 1 | onrelease Behindview 0 bind) lets you look at yourself at different angles! you cant shoot while invulnerable, it all works! yah know what coo part is?

asgard said:
Then in the readme you could include a bind
shield||shieldoff

set input s shield||shieldoff
which makes the s key toggle the exec functions on and off.. Altho theres a lot of players that may not understand that so it might be an idea to leave it as optional with fire and jump still throwing them to state playerwalking..
tahts what i was doing just a few mins ago, i didnt check this page for about an hour! wierd....we had the same idea
tahnks you alot! now to move onto the energy and such... ;)
edit: now with pics! :D
btw the green glow is only cause of a custom shield belt, it normaly doesnt appear with invulnerability. ;)


 
Last edited:

Asgard

New Member
Oct 6, 2000
265
0
0
Visit site
Happy to help :)

Only thing id suggest tho is to add the base eyeheight code back in as it'd be a good indication to the player that hes shielded (such as when he ducks).
Also the skaarj can still hold a weapon while shielded, perhaps remove the changedweapon, weapon =none, pendingweapon etc so he's still holding his gun ?

Youre also kinda double handling unshield with fire, altfire and rise. processmove() will call rise which calls your unshield but the bool bJustFired = true should be set in fire and altfire rather than calling unshield otherwise all rise isnt being called when fire/altfire is pressed. This is desired?

Anyways you get the idea :)

cheers
 

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
Asgard said:
Only thing id suggest tho is to add the base eyeheight code back in as it'd be a good indication to the player that hes shielded (such as when he ducks).
im looking into it now...
i fixed the eyeheight thingy...

Asgard said:
Youre also kinda double handling unshield with fire, altfire and rise. processmove() will call rise which calls your unshield but the bool bJustFired = true should be set in fire and altfire rather than calling unshield otherwise all rise isnt being called when fire/altfire is pressed. This is desired?

yes, its desired :).

im screwing the charge meter...
since you shouldnt fire when invulnerable, i think its fair that u got infinate shields... :eek:

asgard said:
Also the skaarj can still hold a weapon while shielded, perhaps remove the changedweapon, weapon =none, pendingweapon etc so he's still holding his gun ?

yah, when invulnerablilty turns on ur weapon dissapears(1st person) and ammo counts go away, when it turns off they come back, i guess thats ok for now im not going to screw with it any further than that.
Asgard said:
Anyways you get the idea :)
yup! thanks again...now that ive got invulnerablilty down, im going to look into the following:

bleeding
'owning' a 'squad' of various monsters (brutes, skaarjs, krall, ect)
i would like to request permission to use the following scripts in my mod(from AKCoop):

rebel
drone
biobelt
karimea

i might alter them a bit, but full credit would be given to the original scripts. :)
please? :)

edit: i made my own radiance, its an inventory than when turned on it makes the player glow blue and a blue buble appears around him. when turned off, the bubble goes away, and the player no longer glows.
it has infinate energy. :)
 
Last edited:

Asgard

New Member
Oct 6, 2000
265
0
0
Visit site
Ghost3021 said:
bleeding
'owning' a 'squad' of various monsters (brutes, skaarjs, krall, ect)
i would like to request permission to use the following scripts in my mod(from AKCoop):

rebel
radiance
biobelt
karimea

i might alter them a bit, but full credit would be given to the original scripts. :)
please? :)

Yeah that'll be ok, a small thankyou is always nice :)

I made Akcoop several years ago. It was the first mod of its type for Unreal Coop, so I never really got any help. Scripting was new to me then so things were difficult. If I was ever to make ver 3 at some stage id change a few things aswell. Hopefully Ive learnt a bit since then and could fix some of the silly mistakes I made. Too many new things to finish now, and Unreal 1 isnt doing so well these days anyway.

The Rebel Skaarj is still my baby tho, and I never travel anywhere without one :)

cheers
 

Ghost3021

Registered Hobbit
Nov 21, 2004
586
0
0
34
Behind you.
ummm...problem.
i opened up the AKCoop2.u in UEd, and all teh scripts look like:

Code:

could you send me the sourcefiles? the un-compiled ones? my adress is soh_ghost3021@yahoo.com, i would appreciate. and yes i will thank you. :)
thank you!
(and in teh credits,readme, ect)


Asgard said:
...
The Rebel Skaarj is still my baby tho, and I never travel anywhere without one :)
yah, good job. :)
they dont seem to be smart enough to run from hunter-killers, though. :p
 

Asgard

New Member
Oct 6, 2000
265
0
0
Visit site
Sorry about the delay, havent had much time of late.

Sent what you asked for....

Just a note dunno what game youre making this for but if its UT the karimea will require tweaks.

Also the rebel skaarj fears no-one, they know they cant always win but as theyre loyal to thier owner, they try at the ver least to buy him some time :biorifle: (pokes tounge out)

cheers
 
Last edited: