View Full Version: Fix Stasis Bug!

Annihilation Community Forums > Suggestions > Fix Stasis Bug!


Title: Fix Stasis Bug!


perrinoia - December 15, 2010 02:34 AM (GMT)
CODE
$InvList[Stasis] = 1;
$MobileInvList[Stasis] = 1;
$RemoteInvList[Stasis] = 1;

$AutoUse[Stasis] = False;
$WeaponAmmo[Stasis] = "";

addWeapon(Stasis);

BulletData StasisBolt
{ bulletShapeName = "enbolt.dts";
explosionTag = energyExp;
damageClass = 1; //Radius
damageValue = 0.01;
damageType = $StasisDamageType;
explosionRadius = 3;
muzzleVelocity = 2000.0;
totalTime = 10;
liveTime = 11;
lightRange = 3.0;
lightColor = { 0.25, 1, 0.25 };
inheritedVelocityScale = 0.3;
isVisible = True;
soundId = SoundJetLight;
};

ItemImageData StasisImage
{
shapefile = "enex";
mountPoint = 0;
weaponType = 0; // Single Shot
projectileType = StasisBolt;
accuFire = true;
reloadTime = 1.5;
fireTime = 0.5;
minEnergy = 10;
maxEnergy = 30;
lightType = 3;  // Weapon Fire
lightRadius = 3;
lightTime = 1;
lightColor = { 1, 1, 0.2 };
sfxFire = SoundFirePlasma;
sfxActivate = SoundPickUpWeapon;
sfxReload = SoundDryFire;
};

ItemData Stasis
{
description = "Spell: Stasis";
className = "Weapon";
shapeFile = "enbolt";
hudIcon = "clock";
heading = $InvHead[ihSpl];
shadowDetailMask = 4;
imageType = StasisImage;
price = 155;
showWeaponBar = true;
};

function Stasis::MountExtras(%player,%weapon)
{
if((Player::getclient(%player)).weaponHelp)
 Bottomprint(Player::getclient(%player), "<jc>"@%weapon.description@": <f2>Used to subdue your opponent.");
}

function Stasis::onFreeze(%player)
{
if(getObjectType(%player) != "Player" || Player::isDead(%player))
 return 0;
 
%client = Player::getClient(%player);
%client.isStasis = true;
%player.frozen = true; // No suicide while frozen, thanks! -perrinoia

Client::sendMessage(%client, 1, "You've been hit with Stasis!");
Client::setControlObject(%client, Client::getObserverCamera(%client));
Observer::setOrbitObject(%client, %player, 3, 3, 3); // No more pages of code and armor switching glitches, just watch yourself! -perrinoia
return 10; // Time till thaw! -perrinoia
}

function Stasis::onThaw(%player)
{
if(getObjectType(%player) != "Player" || Player::isDead(%player))
 return;

%client = Player::getClient(%player);
%client.isStasis = "";
%player.frozen = "";

Client::sendMessage(%client, 1, "You are free from Stasis.");
Client::setControlObject(%client, %client);
}

//  insert the following in function Player::onDamage, overwriting the code between the //stasis and //end stasis comments.
//  //stasis
//  if(%type == $StasisDamageType && Player::getClient(%this) != %object && (%shooterTeam != %targetTeam || $Server::TeamDamageScale))
//   schedule("Stasis::onThaw("@ %this @");", Stasis::onFreeze(%this)); // Stasis simplified by perrinoia!
//  //end stasis


It's really that simple.

While you're mulling it over, I'll be ghosting around the server with a particle beam or a tank blast cannon or something.

Scud - December 15, 2010 03:42 AM (GMT)
It's not very exploitable in a game unless team damage were enabled. But I agree, fix the glitch, new maps, come on now. Someone take charge and do these things.

perrinoia - December 15, 2010 06:15 AM (GMT)
Team damage doesn't have to be enabled, all you need is an enemy using stasis, and then try to get shot by that enemy, you'll be glitching in no time.

Scud - December 15, 2010 01:42 PM (GMT)
Oh I know how it works, but unless u have an enemy meeting you somewhere and doing it on purpose you really won't get a useful combination. How many times have you been an angel and been stasis'd?

perrinoia - December 15, 2010 04:15 PM (GMT)
Well, first of all, I don't think I've ever been hit by stasis before (except to test the exploit)... But if I saw someone stasising it up, I'd get what ever loadout I wanted and get in the idiot's way.

S_hift - December 16, 2010 09:18 AM (GMT)
actually lunar dream was using hm+stasis on me last month shit was annoying as hell. :stab:

Plasmatic - January 15, 2011 02:30 AM (GMT)
The problem is the code switches the players armor to one with very limited movement, but without item max limits.

You could set itemmax limits for the armors stasis sets you in, probably the easiest way to prevent it..

You could also call checkMax(%client,%armor) when returning from stasis.. This is another easy way to fix.

perrinoia - January 15, 2011 03:30 PM (GMT)
No, that would only prevent you from doubling up on weapons and packs. You could still get weapons and packs that a particular armor isn't allowed to carry.

The problem is that the code switched the player's armor.

That is the problem. Items limits have little to do with it.

What needs to be done, is simply force the client to observe him/herself for the duration of the spell. Remove the immobile armors from the mod all together. This way the player is stuck watching him/herself in 3rd person till the spell wears off, then they regain control of their body (if it's still alive).

Then you gotta decide, should players in stasis be invincible or not? I'd vote no, but others may disagree. If the answer is yes, then you gotta shield them or modify function Player::onDamage to detect if they are in stasis or not, currently, it uses the damage scale with the immobile armors to decide not to damage em, but without the new armors, that code won't do anything.

DaJ4ck3L - January 15, 2011 05:36 PM (GMT)
It's already patched in the update. The method I used was no ctrl k while in stasis, same concept as the jail.

<!> Death666 - January 15, 2011 06:23 PM (GMT)
Honestly I would vote no for the invincibility while in stasis thing it seems to cause trouble in the server with players that haven't learned every pack and weapon in the mod like some. They see someone taking no damage when getting shot and think its cheats. Also whats the point in freezing someone then not being able to do anything to them, but wait to freeze them again lol?

Jerry Garcia - January 15, 2011 06:41 PM (GMT)
Man, as soon as I saw the coding posted, I was ready to tell Perrin, "Noone knows what that means, you nerd!" But then the rest of you nerds ruined it for me... :P It's so great to have you back Plas. :lol:

perrinoia - January 15, 2011 06:57 PM (GMT)
Yeah, you're probably the only Tribes player left that can't read scripts, Jerry... ;)

Crow, there are multiple ways to get out of stasis, suicide is not the only way.

I believe the reason stasis spell makes players invulnerable in the first place is because whoever made the stupid spell knew about the bug in the first place. Except, back then the problem was when you got killed, not when you suicided.

You can do a million things to try to prevent people from exploiting a bug, but until you squash the bug, it's still gonna be there for people to find new ways to exploit.

I can think of at least 1 more way that any player can still exploit this bug despite your 'fix', Crow, and several ways for admins to exploit it.

Plasmatic - January 16, 2011 01:10 AM (GMT)
Simplest fix would be to check the current playerId against the playerId when they were hit with the spell before reverting armor.

perrinoia - January 16, 2011 02:46 AM (GMT)
YOU SHUT YOUR TRAP, MISTER!!!

What if they get issued the same player ID as before? It's possible!

Plasmatic - January 16, 2011 06:17 PM (GMT)
How about adding checkMax(%client,%armor); to function Stasis::resetArmor(%client,%armor) like this:
CODE
function Stasis::resetArmor(%client,%armor)
{
Player::setArmor(%client,%armor);
checkMax(%client,%armor);
UnstasisMsg(%client);
}

Simple enough for you Perrin?

Although putting the frozen player into orbit has been my plan for some time, this will fix it now.
I'll get around to it someday :stab:

perrinoia - January 16, 2011 08:15 PM (GMT)
Disregard my PMs, I thought that function checkMax only checked the number of weapons you had verses the number your armor can carry, but I just read it and realized it also checks the itemmax of each item in your inventory verses how many your armor can carry.

That should solve the problem of angels with particlebeam, etc... However, it might allow people to ghost their way into the enemy base, and suddenly switch to Titan or Tank armor.
Sure, they might not have any weapons, but they would have grenades, mines, and beacons.

Perhaps it should also check to make sure the client is wearing one of the stasis armors before doing anything...

CODE
function Stasis::resetArmor(%client, %armor)
{
if(String::findSubStr(Player::getArmor(%client), "harmor") != 0)
 return;
 
Client::SendMessage(%client, 1, "You are free from Stasis.");
Player::setArmor(%client, %armor);
checkMax(%client, %armor);
}

Plasmatic - January 17, 2011 05:44 PM (GMT)
I would say if someone could be organized enough to get a teleporter up in the enemy base to pull this off, then the cheat isn't going to help much at all. Ghosting in would only leave a titan without weapons as Necro carries a different set. But that's my opinion and I may be wrong.

That said, your fix is nice Perrinoia, and something I had planned on doing. You got it done first.

perrinoia - January 18, 2011 03:25 AM (GMT)
Yeah, I didn't say he'd have weapons, but he'd have miscellaneous items, and last time I checked, a Titan with full health and shielding and a few grenades, can kill every medium/light enemy in a room and pick up their weapons/ammo.

Also, you could try:
CODE
function Stasis::resetArmor(%client, %armor)
{
if(String::getSubStr(Player::getArmor(%client), 0, 6) != "harmor")
return;

Client::SendMessage(%client, 1, "You are free from Stasis.");
Player::setArmor(%client, %armor);
checkMax(%client, %armor);
}


Not sure if it makes a difference in execution time, but I imagine this one takes a few quadrilliseconds less time to process...

perrinoia - January 18, 2011 03:29 AM (GMT)
BTW: Who broke the code tags on this forum? It used to preserve the code indenting, but now, the only thing it's good for is preventing the semicolons and parenthesis from turning into smileys!

<!>bo'sdad - January 18, 2011 06:16 AM (GMT)
you and bong are the only one's that I know who mess with that stuff. soooooo, what did you do ? :) LOL it still turns them into smileys

perrinoia - January 18, 2011 04:20 PM (GMT)
You're not using the code tags, smart ass.

CODE
;)




* Hosted for free by zIFBoards