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 → I'm stumped! Gahhh, this should work!
I'm stumped! Gahhh, this should work!
2003-06-01, 1:51 PM #1
But of course it doesn't.
Code:
 - cog -
# Jedi Knight Cog Script
#
# TARGET.COG
#
# Target's class cog, for the damaging stuff and yeah...
#
# [DP]
#

symbols
int         player                           local
int         type                             local
int         hitDir                           local
flex        vertDis                          local
vector      hitArea                          local

message     damaged

end

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

code

Damaged:
   player = GetSenderRef();
   // type = GetParam(1);
   PrintInt(player);
   // PrintInt(type);
   Print("Damaged");
   If(1) // This will handle all hit keys, movement, etc.
   {
      // Find the vertical distance and hitArea
      hitArea = VectorSub(GetThingPos(GetSourceRef()), GetThingPos(player)));
      vertDis = VectorZ(hitArea);
      hitArea = VectorNorm(hitArea);

      // Try to convert to 2d
      If(VectorX(hitArea) > .7071 && VectorY(hitArea) < .7071 && VectorX(hitArea) > .7071 && VectorY(hitArea) > -.7071) hitDir = 1;
      Else
      If(VectorX(hitArea) < .7071 && VectorY(hitArea) < -.7071 && VectorX(hitArea) > -.7071 && VectorY(hitArea) < -.7071) hitDir = 2;
      Else
      If(VectorX(hitArea) < -.7071 && VectorY(hitArea) > -.7071 && VectorX(hitArea) > -.7071 && VectorY(hitArea) < .7071) hitDir = 3;
      Else hitDir = 0;
      PrintInt(hitDir);
      PrintVector(hitArea);

      // This is where we "use" those numbers
      If(vertDis >= 0.037) // Head shot
      {
         Print("Head shot");
      }
      Else If(vertDis <= -0.025) // Leg shot
      {
         If(VectorX(hitArea) > 0) // Right leg shot
         {
            Print("Right leg shot");
         }
         Else If(VectorX(hitArea) < 0) // Left leg shot
         {
            Print("Left leg shot");
         }
         Else // otherwise ohhh.... that's gonna hurt
         {
            Print("Ooouch!");
         }
      }
      Else // Otherwise it must be a body shot
      {
         If(hitDir == 1) // Right arm shot
         {
            Print("Right arm shot");
         }
         Else If(hitDir == 3) // Left arm shot
         {
            Print("Left arm shot");
         }
         Else // Back/Chest shot
         {
            Print("Chest/Back shot");
            hitDir = 1 - hitDir; // Reverse if on back
            If(VectorX(hitArea)*hitDir > 0) // Right from chest // Left from back
            {
               Print("Right/Left side shot");
            }
            If(VectorX(hitArea)*hitDir < 0) // Left from chest // Right from back
            {
               Print("Left/Right side shot");
            }
         }
      }
      ReturnEx(0);
      Return;
   }
   Return;

end


 - Template -
based on: _humanactor

thingflags=0x20000401
light=0.2
model3d=ky.3do
puppet=ky.pup
size=0.065
movesize=0.065
cog=target.cog
health=4000000
maxhealth=4000000


The problem is it doesn't even spit out any of the garbage info. Can anyone help this poor old soul?

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2003-06-01, 2:54 PM #2
well just from looking it over and running it through cogwriter,
there are a few things i can see that might be the problem.
Code:
Print("Damaged");
//-This will handle all hit keys, movement, etc.
If(1)
  {
  //-Find the vertical distance and hitArea
  hitArea = VectorSub(GetThingPos(GetSourceRef()), GetThingPos(player)));

this section of the cog is what im wondering about.

1-does the "damaged" ever print?
if it doesnt you may have to put some mask flags on the 'player' symbol, and the 'player' symbol could be a thing type instead of an int.

2-that first 'if' uh... what is it checking?
not sure if that one matters but it just looks confusing.

3-VectorSub(GetThingPos(GetSourceRef()), GetThingPos(player))); cogwriter says that there is too many )'s in there.
i think it should be like this VectorSub(GetThingPos(GetSourceRef()), GetThingPos(player));.

thats what i see might be messing it up.

[edit: btw, why is this in the editing forum and not the cog forum]

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited June 01, 2003).]
Famous last words - "It seemed like a good idea at the time."
2003-06-01, 3:14 PM #3
Here's one problem...
You're in the wrong forum.

------------------
"The Just shall live by faith." - Galatians 3:11
To edit is human... To COG is divine!!
Catloaf, meet mouseloaf.
My music
2003-06-01, 5:14 PM #4
Moving to cog forum.

------------------
Have Lightsaber Will Travel JK Editing tips, troubleshooting information, resources and more.
www.swgalaxies.net For all your Star Wars Galaxies needs
The Massassi A SW Galaxies Player Association
Have Lightsaber Will Travel JK Editing tips, troubleshooting information, resources and more.
www.swgalaxies.net For all your Star Wars Galaxies needs
The Massassi A SW Galaxies Player Association

↑ Up to the top!