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 → Shooting through walls...
Shooting through walls...
2004-06-29, 8:53 AM #1
Finally came up with a way to put functional projectiles through walls. I'm sure this has been done before, but not sure if anyone did it quite the way I did.

First of all, my 2 templates used were the default +repeaterball (I make it go through walls and people) and +punchcloud.

In my weapon cog, I have this:
Code:
error = FireProjectile(player, projectile3, fireSound2, 18, '0.0207 0.0888 0', '0 0 0', powerBoost*3, 0x2, 0, 0);
CaptureThing(error);
ClearWeaponFlags(error, 0x400);


Then, I add "message removed" to the symbols section of the weapon cog, and down farther add:
Code:
removed:
if(VectorDist(GetThingPos(GetSenderRef()), GetThingPos(player)) < 10)
{
   errorVec = FireProjectile(GetSenderRef(), projectile, -1, -1, '0 .125 0', '0 0 0', 0, 0, 0, 0);
   error = FireProjectile(player, projectile3, -1, -1, '0 0 0', '0 0 0', powerBoost*3, 0x2, 0, 0);
   CaptureThing(error);
   TeleportThing(error, errorVec);
   SetThingVel(error, VectorScale(GetThingLVec(GetSenderRef()), 4));
   SetThingLook(error, GetThingLVec(GetSenderRef()));
   ClearWeaponFlags(error, 0x400);
}
Return;


When the +repeaterball hits something, and is removed, it fires a +punchcloud out in front of it just a little ways. You fire a new +repeaterball and then teleport it to the +punchcloud and give it the proper LVec and approximately the correct velocity.

Why teleport? It puts the new projectile into the correct sector so it does damage. I'll be updating my checksum passing mod later tonight with this coding in action so you can see it if you don't wanna code it.

Quib Mask

P.S. - ClearWeaponFlags(error, 0x400); makes the projectile a jedi killer (isn't blocked by lightsaber). I did this so reflected shots would stop burrowing into the ground and causing minor slowdown.

Edit - Check http://everbot.tripod.com/toolbox.htm and grab the new version of the Tool Box. Weapon 5's secondary shoots through walls. Other changes are just minor fine tuning. I added a Powerboost mode to the lightsaber: grab a Powerboost, switch to the inside (first person) view, and fire. I also added the Saber Bot as an available download. I use it on my JK "dedicated" server, so there's always something to fight... even if it's a deranged, easy-to-fool saber maniac.

[This message has been edited by Quib Mask (edited June 29, 2004).]
2004-06-29, 3:55 PM #2
Wow thats really cool. Thanks for sharing it!

------------------
nil nip nada zip zero naught lip zil
This is retarded, and I mean drooling at the mouth
2004-06-29, 5:25 PM #3
You're right that it's not new, but still very cool. It is always better to have multiple methods and implementations of the same thing out there. A shame no one used it in a mod years ago.

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2004-06-30, 5:55 AM #4
Its good job. However, one drawback, it only works for the punch up to .125 units. If the next thing to be hit is too far away, it doesn't register a hit for me, or something... I dunno, it just doesn't work 100% of the time.

------------------
Major projects working on:
SATNRT
JK Pistol Mod
Aliens TC

[This message has been edited by Descent_pilot (edited June 30, 2004).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2004-07-01, 5:12 AM #5
"I dunno, it just doesn't work 100% of the time."

I figured out what I did wrong: TeleportThing simply gives the thing the sector of what it teleports to. When the +punchcloud was being forced through a wall by the .125 offset, it wasn't giving itself the correct sector (which I thoguht it was at first, hence why I used this method) so when I'd try teleporting the new +repeaterball to the +punchcloud, it'd fail the teleport and you'd see a messed up line of +punchcloud's when you shot through a wall. I've almost finished a better version that gives the new projectile the correct sector and fixes the problem. I'll post it, and update my cog pack in a few hours once I get it all finished.

Quib Mask
2004-07-02, 3:49 PM #6
Jeez o' pete. It took me two days to put together a better "shoot through walls" code, and here's what I've got. I made a system that works flawlessly... but it caused massive lag in MP for both the client and host (and other players) so I had to come up with an efficient system.

Code:
touched:
   if(!Haslos(player, GetSourceRef())) Print("Hit");
   entryValue = -2;
   call jumperone;
   Return;

removed:
   if((GetThingUserData(GetSenderRef()) < 10) && (entryValue == -1))
   {
jumperone:
      errorVec = FireProjectile(GetSenderRef(), projectile, -1, -1, '0 .25 0', '0 0 0', 0, 0, 0, 0); // .125
      error = FireProjectile(player, projectile3, -1, -1, '0 0 0', '0 0 0', powerBoost*3, 0x2, 0, 0);
      CaptureThing(error);
      SetThingUserData(error, GetThingUserData(GetSenderRef())+1);
      if(entryValue == -1)
      {
         for(i=0; i < GetSectorCount(); i=i+1)
         {
            for(j=0; j < GetNumSectorVertices(i); j=j+1)
            {
               if(VectorDist(GetSectorCenter(i), GetSectorVertexPos(i, j)) >= VectorDist(GetSectorCenter(i), GetThingPos(errorVec)))
               {
                  for(k=0, x=0; k < GetNumSectorVertices(i); k=k+1)
                  {
                     if(j != k)
                     {
                        if(!(VectorDist(GetSectorCenter(i), GetSectorVertexPos(i, k)) >= VectorDist(GetSectorCenter(i), GetThingPos(errorVec)))
                        && !(VectorDist(GetSectorVertexPos(i, j), GetSectorVertexPos(i, k)) >= VectorDist(GetSectorVertexPos(i, j), GetThingPos(errorVec))))
                        x=1;
                        if((k == GetNumSectorVertices(i)-1) && (x == 0))
                        {
                           errorVec = CreateThingAtPos(projectile, i, GetThingPos(errorVec), '0 0 0');
                           call jumpertwo;
                           Return;
                        }
                     }
                  }
               }
            }
         }
      }
jumpertwo:
      TeleportThing(error, errorVec);
      SetThingVel(error, VectorScale(GetThingLVec(GetSenderRef()), 6));
      SetThingLook(error, GetThingLVec(GetSenderRef()));
      ClearWeaponFlags(error, 0x400);
   }
   else
   {
      entryValue = -1;
   }
   Return;


That should be semi-dependable, non-laggy, shoots through walls code. Make sure you add a "message touched" to the symbols section of your cog. I'm still trying to condense this to pass checksum, so I haven't updated my cog pack yet.

Quib Mask

[This message has been edited by Quib Mask (edited July 02, 2004).]

[This message has been edited by Quib Mask (edited July 02, 2004).]

↑ Up to the top!