Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Anti-Everything
Anti-Everything
2004-11-18, 8:18 PM #1
I recently found a thread pointing to some aged JK "hacking" sites that had decent collections of powerful (but messy and potentially crashy) JK hacks. Well, I went through most of them and tried to come up with counters for most of the major hacks and just wanted to throw up a post with my "anti-everything" cog. Note that this doesn't even get close to passing checksum, and was just an exercise in exploring ways to counteract the evil triad of JK hacks (fade, destroy and jail) to get myself back into the swing of cogging.

Anyway, it's not perfect; if you get chain faded for like 30 seconds you'll eventually get 1 suicide count, and it's near impossible to defeat jail, but I think I conquered destroy and most common annoyances.

Code:
# Jedi Knight Cog Script
#
# ITEM_KEYBLUE.COG
#
# INVENTORY script - Anti-Everything
# Bin 47
#
# [QM]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

sound       keysound=BactaUse01.WAV          local
thing       player=-1                        local
thing       dummy=-1                         local
cog         kyleCog                          local
template    antifade=+punchcloud             local
vector      antitrip                         local
model       antimorph=ky.3do                 local
int         antiforce=-1                     local

message     startup
message     activated
message     deactivated
message     pulse
message     timer
message     skill
message     damaged
message     removed

end

# ========================================================================================

code

startup:
   player = GetLocalPlayerThing();

   // Initialize Force Power Filter
   kyleCog = GetThingClassCog(player);

   // Initialize Anti-Trip
   antitrip = VectorSet(0, 0, 0);

   // Initialize Anti-Morph
   Sleep(1);
   antimorph = GetThingModel(player);

   SetInv(player, 47, 1);
   SetInvAvailable(player, 47, 1);
   Return;

# ........................................................................................

activated:
   player = GetSourceRef();
   PlaySoundLocal(keysound, 1.0, 0.0, 0);
   SetPulse(0.01);
   Return;

# ........................................................................................

deactivated:
   SetActorFlags(player, 0x400000);
   Return;

# ........................................................................................

pulse:
   // Initialize Invulnerability and Anti-Destroy
   SetThingClassCog(player, GetSelfCog());
   SetThingCaptureCog(player, kyleCog);

   // Anti-Fade
   if(GetActorFlags(player) & 0x400000)
   {
      ClearActorFlags(player, 0x400000);
      ClearThingFlags(player, 0x200);
      dummy = FireProjectile(player, antifade, -1, -1, '0 0 0', '0 0 0', 0, 0x0, 0, 0);
      SetThingType(player, 2);
      TeleportThing(player, dummy);
      KillTimerEx(1);
      SetTimerEx(1, 1, 0, 0); // flex_delay, ID, param0, param1
      CycleCamera();
      CycleCamera();
   }

   // Flag Maintenance (Anti-Null, Anti-Freeze, Anti-Delete)
   if((GetThingType(player) != 10) && (GetThingType(player) != 2)) SetThingType(player, 10);
   ClearTypeFlags(player, 0xA40800);
   SetTypeFlags(player, 0x1);
   ClearThingFlags(player, 0x80002);
   SetThingFlags(player, 0x20000401);
   ClearPhysicsFlags(player, 0x4020B0);
   SetPhysicsFlags(player, 0x4a4e);

   // Anti-Morph
   if(GetThingModel(player) != antimorph) SetThingModel(player, antimorph);

   // Timer Check
   if(GetLifeLeft(player) != 0) SetLifeLeft(player, 0);

   // Attachments (Weak Anti-Jail)
   if(GetThingAttachFlags(player) & 0x4) DetachThing(player);
   if(GetThingAttachFlags(player) & 0x8) DetachThing(player);

   // Anti-Sink
   if(GetCollideType(player) != 1) SetCollideType(player, 1);
   if(GetThingCollideSize(player) != 0.065) SetThingCollideSize(player, 0.065);
   if(GetThingMoveSize(player) != 0.065) SetThingMoveSize(player, 0.065);
   if(GetThingMass(player) != 150) SetThingMass(player, 150);

   // Anti-Trip
   if(!(VectorDist(antitrip, VectorSet(0, 0, 0)) == 0))
   {
//      if(VectorDist(GetThingLVec(player), antitrip) > 0.85) SetThingLook(player, antitrip);
      if(VectorZ(GetThingLVec(player)) >= 0.0001)
         SetThingLook(player, VectorSet(VectorX(antitrip), VectorY(antitrip), 0));
      if(VectorZ(GetThingLVec(player)) <= -0.0001)
         SetThingLook(player, VectorSet(VectorX(antitrip), VectorY(antitrip), 0));
   }
   antitrip = GetThingLVec(player);

   // Anti-Slam
   if(VectorLen(GetThingThrust(player)) > 5)
      SetThingThrust(player, VectorScale(VectorNorm(GetThingThrust(player)), 5));
   if(VectorLen(GetThingVel(player)) > 5)
      SetThingVel(player, VectorScale(VectorNorm(GetThingVel(player)), 5));

   // Anti-Spin
   SetThingRotVel(player, VectorSet(0, 0, 0));

   Return;

# ........................................................................................

timer:
   DestroyThing(player);
   SetThingType(player, 10);
   Return;

# ........................................................................................

skill:
   // Force Power Filter
   if(GetSenderRef() == GetLocalPlayerThing())
   {
      if((GetParam(0) == 24) && (GetCurWeapon(player) >= 10))
      {
         ReturnEx(0);
         Return;
      }
      if(GetParam(0) == 27)
      {
         ReturnEx(0);
         Return;
      }
      SetThingClassCog(player, kyleCog);
      antiforce = -1;
      antiforce = SkillTarget(player, GetSourceRef(), GetParam(0), GetParam(1));
      SetThingClassCog(player, GetSelfCog());
      ReturnEx(antiforce);
   }
   Return;

# ........................................................................................

damaged:
   // Invulnerability
   ReturnEx(0);
   Return;

# ........................................................................................

removed:
   // Anti-Destroy
   ClearThingFlags(GetSenderRef(), 0x2);
   Return;

end


So yeah, peruse and use it. The anti-fade code makes something sorta funny happen when you fall in a fade-to-black pit! =D

QM
2004-11-19, 12:55 AM #2
I don't recall ever seeing an anti-trip (if it's referring to trippin_billy's most famous hack, which it looks like it does), which actually surprised me when I realized it. It is complete, although much bulkier than your average anti cog. I guess, though, you could put this in grip or pull probably. Actually...I'd just use kyle.cog as that's the stuff I usually put in there anyways.
</sarcasm>
<Anovis> mmmm I wanna lick your wet, Mentis.
__________
2004-11-19, 11:20 AM #3
I've seen it; like most hacks, it's a poorly written mess that attempts to pulse at .0000001 and has a call loop that'll terminate after what, 4 threads? It also makes probably a half dozen unneeded and argumentative flag changes (SetThingFlags(0xF), ClearThingFlags(0xE) is an example of pointless changes that'll just add to lag if JK attempts to transmit both changes). I don't think too highly of trash that has stuff like EAH=+EAH in the symbols section and '0.0 0.0 0.01'(x, x) within parsed code regions. On the bright side, at least he didn't change healingSound (changing sounds in hacks is near pointless; since I started this thread I'll hijack it and explain why in a bit, since it's something not even the best "hackers" ever understood).

Anyway, my point wasn't to make a competing anti-hack cog, I just wanted to see what I could do from scratch to get myself back up to speed with cog and I thought exploring anti methods would be a good exercise.

--- Tutorial: JK "hacking" and why you're an idiot if you change sound references ---

Let's say I turn force seeing into a jetpack, complete with smoketrail and decent thrust speeds to keep it from being TOO easy to use... wouldn't it make sense to change ForceSee02.WAV (the looped wave that'll play while my jetpack is engaged) into something more engine sounding like crowenginewhine02.wav?

No, no it wouldn't. Here's why: when JK loads a level, it assigns the sounds it loads a number. It decides what sounds to load first from the sound list in the level's JKL file, then, as it parses through the various cogs, it increments the count each time it comes across a new sound, giving it the next unique number in line...

Well gee QM, I knew that, but why does that matter?

Well, let's say ForceSee02.WAV isn't in the level's JKL, and when the cog is parsed that sound is given number 50. Also, if I use the hacked cog, instead crowenginewhine02.wav will be assigned number 50. If I use my jetpack I'll hear crowenginewhine02.wav perfectly... however, everyone else in my game will have ForceSee02.WAV assigned as sound number 50. When my jetpack starts humming, it says "play sound 50 and loop it" so I'll hear a nice engine sound and they'll hear an ugly force seeing loop...

Now, this isn't a critical problem, except other people will think you sound kinda stupid flying around with force seeing, and good "hacks" are all about what the other person experiences, not what you experience. However, there CAN be a critical problem caused by changing a sound.

Let's say ForceSee02.WAV IS in the level's JKL so it gets an earlier number than 50, like 10... when the cog is parsed, ForceSee02.WAV will still be sound number 10... but crowenginewhine02.wav would still be something like 50. This throws off the whole sound count. By changing a single sound in an unrelated cog, you could shift the saber swing sounds and loop sound. How annoying would it be if you pull out your saber and the loop everyone else hears is it constantly turning on? This happens quite often with standard hacked force power, item and weapon cogs, where some chump saw fit to change ForceSee02.WAV to orceSee02.WAV in attempt to silence it, where in actuality they potentially threw off the sound count.

Animations (KEYs) can suffer from this same unsyncing, though are typically a bit safer to modify (you can do whatever you want with internal view gun animations, no one else sees those) but the external saber attack animations can fail (you'll see yourself swinging, but your oponent won't see you do anything, or at least not the correct animation). The way to avoid this is to not use abnormal animations (stick with the xxxvmnt.key, xxxvpst.key, etc. animations, don't use pbhit.key to mount your gun) since most of those are loaded in every level jkl and won't get out of count.

Models (3do's) don't suffer from this problem nearly at all: JK keeps them much more properly sorted and sync'd. If you try and use a bacta tank as your external weapon model in a level with no bacta tanks, the other players probably will see you holding something else (just an example), but SetThingModel commands properly sync up models in other situations.

--- End Tutorial ---

That's my 2 cents on changing sounds in "hacks" I guess...

Compos Mentis, Anti-Trip was named after trippin billy's stuff, but was simply made to counter SetThingLook(player, RandVec()); or anything else that pitched you harshly forward or backward.

I'll be releasing a final version of my "hacks" soon, just need to start a new kyle.cog from scratch (my current one's a 3 year old mess that doesn't deserve to be in the cog folder with it's beautifully organized siblings).

Nearly every one of my cogs has the "event horizons" (areas where any change to the code will fail checksum) properly labeled, and are well built as to make them good code to learn from (not just for passing checksum, but almost every one of my weapons uses some clever cog trick that could be used in any number of mods), a quick list is:
bryar: non-projectile based scope in JK
strifle: non-crashing seifer pov model code
thermdet: fire rate based one rapid clicking or held
cbow: shoots through walls with little added network traffic
repeater: 2 weapons on 1 button in JK
raildet: interesting projectile use
seqchrg: arc-trajectory projectile (that doesn't suck)
conc: wall-tracing projectile
saber: always colliding blade

If you search some posts from a few months back you could find my last release of these cogs, but the final version is significantly improved and slightly more cleaned up and polished.

Now I need to dig up some of that grappling hook stuff I was working on so I don't get hanged...

QM
2004-11-19, 1:03 PM #4
I remember reading about your toolkit which is like a project I once did a couple years back. Granted, you're better at passing cs than I am, so yours is better. Honestly, I don't cog to pass cs anymore because I don't have time to relearn the cogs quirks (I quit for more than a year and spaced it all).

In Lunatiks defense, most of his anti's are second-thoughts put into the smaller cogs (like heal or well), so there isn't usually enough room for nice code. He's very very capable of writing a good stable cog, just not in every circumstance.

Once again, this is a good cog with a few pieces that were missing from other antis. Make it pass c/s now, just for kicks :)
</sarcasm>
<Anovis> mmmm I wanna lick your wet, Mentis.
__________
2004-11-19, 2:39 PM #5
WHERE HAVE YOU BEEN!?
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2004-11-19, 3:05 PM #6
Passes Checksum:
Code:
# Jedi Knight Cog Script
#
# FORCE_GRIP.COG
#
# FORCEPOWER Script - Anti-Everything
#  Dark Side Power
#  Bin 31
#
# This power chokes the enemy in the target cone, slowly causing damage.
#
# [QM]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

thing       player                           local
thing       victim                           local
thing       potential                        local

flex        cost=50.0                        local
flex        mana                             local
flex        dot                              local
flex        maxDot                           local
flex        damage                           local
flex        starthealth                      local
int         rank                             local
int         retval=0                         local

sound       gripSound=ForceGrip01.WAV        local

int         limit                            local
int         count                            local

int         active=0                         local
int         targetting=0                     local

vector      antitrip                         local
model       antimorph=ky.3do                 local

message     startup
message     activated
message     pulse
message     timer
message     damaged
message     removed

end

# ========================================================================================

code

// startup:
   player = GetLocalPlayerThing();

   SetInvActivated(player, 31, 0);

   Return;

# ........................................................................................

// activated:
   // Cannot use power if blinded
   if(GetActorFlags(player) & 0x800) Return;

   if(active) Return;

   mana = GetInv(player, 14);
   if(mana >= cost)
   {
      victim = -1;
      active = 1;
      targetting = 1;
      SetPulse(0.33);
   }
   Return;

# ........................................................................................

// deactivated:
   // If no victim was found just cleanup and exit
   if((victim == -1) || (GetThingHealth(player) <= 0) || !active)
   {
      call stop_power;
      Return;
   }

   SetPulse(0);
   jkEndTarget();
   targetting = 0;

   mana = GetInv(player, 14);
   if(mana >= cost)
   {
      if(HasLOS(player, victim))             // check that we still have a LOS on it...
      {
         SetBinWait(player, 31, rank + 0.5);

         PlayMode(player, 24);
         if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);
         rank = GetInv(player, 31);
         limit = rank * 2;
// Event Horizon
         Return;

# ........................................................................................

startup:
   player = GetLocalPlayerThing();

   // Initialize Anti-Trip
   antitrip = VectorSet(0, 0, 0);

   // Initialize Anti-Morph
   Sleep(1);
   antimorph = GetThingModel(player);

   Return;

# ........................................................................................

activated:
   player = GetSourceRef();
   PlaySoundLocal(gripSound, 1.0, 0.0, 0);
   SetPulse(0.01);
   Return;

# ........................................................................................

timer:
   DestroyThing(player);
   SetThingType(player, 10);
   Return;

# ........................................................................................

damaged:
   // Invulnerability
   ReturnEx(0);
   Return;

# ........................................................................................

removed:
   // Anti-Destroy
   ClearThingFlags(GetSenderRef(), 0x2);
   Return;

# ........................................................................................

jumper:
   CycleCamera();
   CycleCamera();
   SetTimerEx(1, 1, 0, 0);
   Return;

   1, 1, 1, 1, 1, 1;

# ........................................................................................

      }
   }
// Effective Event Horizon
   Return;

# ........................................................................................

   1, 1, 1, 1;
   Return;

pulse:
   // Anti-Fade
   if(GetActorFlags(player) & 0x400000)
   {
      ClearActorFlags(player, 0x400000);
      ClearThingFlags(player, 0x200);
      SetThingType(player, 2);
      KillTimerEx(1);
      call jumper;
   }

   // Anti-Morph
   if(GetThingModel(player) != antimorph) SetThingModel(player, antimorph);

   // Timer Check
   if(GetLifeLeft(player) != 0) SetLifeLeft(player, 0);

   // Attachments (Weak Anti-Jail)
   if(GetThingAttachFlags(player) & 0x4) DetachThing(player);
   if(GetThingAttachFlags(player) & 0x8) DetachThing(player);

   // Anti-Sink
   if(GetCollideType(player) != 1) SetCollideType(player, 1);
   if(GetThingCollideSize(player) != 0.065) SetThingCollideSize(player, 0.065);
   if(GetThingMoveSize(player) != 0.065) SetThingMoveSize(player, 0.065);
   if(GetThingMass(player) != 150) SetThingMass(player, 150);

   // Anti-Trip
   if(!(VectorDist(antitrip, VectorSet(0, 0, 0)) == 0))
   {
      if(VectorZ(GetThingLVec(player)) >= 0.0001)
         SetThingLook(player, VectorSet(VectorX(antitrip), VectorY(antitrip), 0));
      if(VectorZ(GetThingLVec(player)) <= -0.0001)
         SetThingLook(player, VectorSet(VectorX(antitrip), VectorY(antitrip), 0));
   }
   antitrip = GetThingLVec(player);

   // Anti-Slam
   if(VectorLen(GetThingThrust(player)) > 5)
      SetThingThrust(player, VectorScale(VectorNorm(GetThingThrust(player)), 5));
   if(VectorLen(GetThingVel(player)) > 5)
      SetThingVel(player, VectorScale(VectorNorm(GetThingVel(player)), 5));

   // Anti-Spin
   SetThingRotVel(player, VectorSet(0, 0, 0));

   // Flag Maintenance (Anti-Null, Anti-Freeze, Anti-Delete)
   if((GetThingType(player) != 10) && (GetThingType(player) != 2)) SetThingType(player, 10);
   ClearTypeFlags(player, 0xA40800);
   SetTypeFlags(player, 0x1);

// Weird Event Horizon - cannot move code from above stop_power: to below it or vice versa

stop_power:
   ClearThingFlags(player, 0x80002);
   SetThingFlags(player, 0x20000401);
   ClearPhysicsFlags(player, 0x4020B0);
   SetPhysicsFlags(player, 0x4a4e);

   // Initialize Invulnerability and Anti-Destroy
   CaptureThing(player);

   Return;

end


Was pretty easy, used grip because it has so much room but still had to cut out force power filtering to make it fit. Took maybe a half an hour to get it all done up. There's probably enough room to add a deactivate but I didn't bother. Can make it turn on at startup by moving the Return; right before activated: and adding newplayer: above startup: (just to be 100% sure, would also need to add the message to symbols).

QM

P.S. - All over the place. Germany for a wedding, writing papers for school, fixing about a dozen people's computers, getting level 70 in EQ. I was stretched for time and JK unfortunately had to take the back burner. On the bright side, have you seen Hell Raiser's grappling hook code? That thing is freaking amazing and puts what I'd been working on to shame. I'm looking forward to its completion so I can mess with the fire code to make it a level based hook. I'll be scarce this weekend due to some friends from out of town stopping in for the holidays but am planning to back in the thick of JK in a week... assuming you guys don't track me down and gut me first. ^_^
2004-11-19, 5:28 PM #7
Was talking about Lunatik's Cure; went and took a look at the copy of it I have (just the one off his site) right after you mentioned it. I'd love to see someone elses anti-jail as mine is crummy and I really was drawing blanks when trying to make mine.

QM
2004-11-21, 5:33 PM #8
No easy way to anti teleportthing/syncthingpos. The only good way is to just not get caught by it.
</sarcasm>
<Anovis> mmmm I wanna lick your wet, Mentis.
__________
2004-11-21, 10:07 PM #9
Quote:
Originally posted by Quib Mask
On the bright side, have you seen Hell Raiser's grappling hook code? That thing is freaking amazing and puts what I'd been working on to shame. I'm looking forward to its completion so I can mess with the fire code to make it a level based hook.[/B]


Why thanks! :o I kinda tipped the development in ZeqMacaw's direction, but the only thing it needs is a visable rope and what to do with bumpping into walls/things while swinging. The idea is to use ZeqMacaw's thing-surface-touching cog logic to tell if we've hit a wall. If you'd like more info, shoot me a PM or email. :)
-Hell Raiser

↑ Up to the top!