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 → It's gotta be a bad week
It's gotta be a bad week
2003-02-23, 4:30 PM #1
Another question, though this one might be a little less brain fry. Some has been omited to keep the use of the cog a little secret, but you could probably guess anyways what it does. [http://forums.massassi.net/html/wink.gif]
Code:
# Jedi Knight Cog Script
#
# OMIT.COG
#
# omit
# omit
#
# [DP]
#

symbols
thing       console
vector      camPos
vector      camLvec
int         camSector
vector      pos
int         posSector
vector      Lvec                        local
int         dummy                       local
int         current=0                   local
int         pholo=0                     local
int         player                      local
int         origanalCam                 local
int         on=0                        local
int         canMove                     local
thing       cam                         local
template    ghost=ghost                 local

template    sign
template    sign1
template    sign2
template    sign3
template    sign4
template    sign5
template    sign6
template    sign7
template    sign8
template    sign9

template    holo
template    holo1
template    holo2
template    holo3
template    holo4
template    holo5
template    holo6
template    holo7
template    holo8
template    holo9

message     Activated
message     Pulse
message     Timer

end

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

code

Activated:
   player = GetLocalPlayerThing();
   If(!on)
   {
      SetInv(player, 68, 1);
      cam = CreateThingAtPos(ghost, camSector, camPos, camLvec);
      Lvec = GetThingLvec(player);
      SetActorFlags(player, 0x40000);
      origanalCam = GetCurrentCamera();
      If(GetCurrentCamera()) CycleCamera();
      SetCameraFocus(0, cam);
      dummy = CreateThingAtPos(sign[current+pholo], posSector, pos, '0 0 0');
      SetPulse(.05);
      on = 1;
   }
   Else
   {
      SetInv(player, 68, 0);
      DestroyThing(cam);
      DestroyThing(dummy);
      SetThingLook(player, Lvec);
      ClearActorFlags(player, 0x40000);
      If(GetCurrentCamera() != origanalCam) CycleCamera();
      SetPulse(0);
      on = 0;
   }
   canMove = 1;
   Return;

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

Pulse:
   If(GetCurrentCamera()) CycleCamera();
   SetThingLook(player, Lvec);
   If(canMove)
   {
      If(IsThingCrouching(player))
      {
         pholo = 10 - pholo;
         SetTimer(.5);
         canMove = 0;
      }
      Else If(VectorY(GetThingRotVel(player)) > 0)
      {
         current = current + 1;
         If(current > 9) current = 0;
         SetTimer(.5);
         canMove = 0;
      }
      Else If(VectorY(GetThingRotVel(player)) < 0)
      {
         current = current - 1;
         If(current < 0) current = 9;
         SetTimer(.5);
         canMove = 0;
      }
   }
   Else
   {
      DestroyThing(dummy);
      dummy = CreateThingAtPos(sign[current+pholo], posSector, pos, '0 0 0');
   }
   Return;

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

Timer:
   canMove = 1;
   Return;

end
Crashes when I turn on a second time.

------------------
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-02-23, 4:43 PM #2
An explination and code comments would help speed up the process (at least you got some tabs).

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2003-02-23, 5:55 PM #3
Try not destroying the thing the camera is looking from. [http://forums.massassi.net/html/tongue.gif] Set the view back before you destroy cam.

------------------
-Hell Raiser
Remember kiddies, trial and error.
Without struggles there is no progress
DBZ: The Destruction is Real
-Hell Raiser
2003-02-24, 3:46 AM #4
Stupid, stupid stupid me!! A thanks to HR.

------------------
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-02-24, 3:58 AM #5
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Emon:
An explination and code comments would help speed up the process (at least you got some tabs).

</font>

Emon, this is a simple cog, and comments aren't really nessecary on any cog that is less then 200 lines or only 1 or 2 things that are to be accomplished. I believe this fits that criteria.

------------------
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-02-24, 2:23 PM #6
Not only that, but the problem was obvious after following the code. [http://forums.massassi.net/html/tongue.gif]

------------------
-Hell Raiser
Remember kiddies, trial and error.
Without struggles there is no progress
DBZ: The Destruction is Real
-Hell Raiser

↑ Up to the top!