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 → Sinc wepons
Sinc wepons
2003-02-10, 1:43 PM #1
I have made a laser and it uses the repeter cog. It works fine when I use it in single player stuff but is usesless against other players in multi-player. could anyone help me? heres the cog:

Code:
symbols

model       povModel=rptv.3do                   local
model       weaponMesh=rptg.3do                 local

keyframe    mountAnim=RptVmnt.key               local
keyframe    dismountAnim=RptVdis.key            local
keyframe    povfireAnim=RptVpst1.key            local
keyframe    holsterAnim=kyhlstr.key             local

sound       mountSound=df_bry_ready.wav         local
sound       dismountSound=PutWeaponAway01.wav   local
sound       fireSound=-1              local
sound       fireSound1=-1             local
sound       outSound=-1                local

vector      fireOffset                          local
vector      adjOffset                           local
vector      shakePos                            local
vector      shakeAngle                          local

template    projectile=+slaser            local
template    projectile=+slaser2			local	

thing       player                              local

flex        fireWait=0                        local
flex        powerBoost                          local
flex        lastFireTime=0                      local
flex        curFireTime=0                       local
flex        autoAimFOV=25                       local
flex        autoAimMaxDist=5                    local
flex        numExpectedFires                    local
flex        extraSimTime                        local
flex        holsterWait                         local

int         trackID=-1                          local
int         mode                                local
int         fireChannel=-1                      local
int         dummy                               local
int         ammoCost                            local
int         holsterTrack                        local

message     startup
message     activated
message     deactivated
message     selected
message     deselected
message     newplayer
message     killed
message     autoselect
message     fire
message     timer

end

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

code

startup:
   player = GetLocalPlayerThing();
   fireOffset = '0.0186 0.0102 0.00';

   Return;

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

activated:
   mode   = GetSenderRef();
   jkSetWaggle(player, '0.0 0.0 0.0', 0);

   if(mode > 1) Return;

   if (mode == 0) ammoCost = 1.0;
   else if (mode == 1) ammoCost = 3.0;
   if(GetInv(player, 12) < ammoCost)
   {
      PlaySoundThing(outSound, player, 1.0, -1, -1, 0x180);
      Return;
   }

   if (mode == 0)
   {
      if(fireChannel == -1)
         fireChannel = PlaySoundThing(fireSound, player, 1.0, -1, -1, 0x181);
      fireWait = 0.1;
   }
   else
   if (mode == 1)
   {
      fireWait = 0.3;
   }

   powerBoost = GetInv(player, 63);
   ActivateWeapon(player, 001, mode);
   jkPlayPOVKey(player, povfireAnim, 1, 0x38);

   Return;

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

fire:
   mode = GetSenderRef();

   // Check that the player is still alive.
   if(GetThingHealth(player) <= 0)
   {
      if(fireChannel != -1)
      {
         StopSound( fireChannel, 0.1 );
         fireChannel = -1;
         dummy = PlaySoundThing(fireSound1, player, 1.0, -1, -1, 0x180);
      }
      Return;
   }

   if (mode == 0) ammoCost = 0.0;
   else
   if (mode == 1) ammoCost = 0.0;

   if(GetInv(player, 12) < ammoCost)
   {
      if (fireChannel != -1)
      {
         StopSound( fireChannel, 0.1 );
         fireChannel = -1;
         dummy = PlaySoundThing(fireSound1, player, 1.0, -1, -1, 0x180);
      }

      if(GetAutoSwitch() & 1)
         SelectWeapon(player, AutoSelectWeapon(player, 1));

      Return;
   }

   shakePos = VectorScale(RandVec(),.001);
   shakeAngle = VectorScale(RandVec(),1);
   

   if (mode == 0)
   {
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '0 0 0', 1.0, 0x30, autoAimFOV, autoAimFOV*2 );
   }
   else
   if (mode == 1)
   {
      dummy = FireProjectile(player, projectile2, -1, 8, fireOffset, '4.0 0 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
   }

   ChangeInv(player, 12, -ammoCost);

   powerBoost = GetInv(player, 63);
   ChangeFireRate(player, .001);

   if(GetInv(player, 12) == 0)
   {
      if (fireChannel != -1)
      {
         StopSound( fireChannel, 0.1 );
         fireChannel = -1;
         dummy = PlaySoundThing(fireSound1, player, 1.0, -1, -1, 0x180);
      }

      if(GetAutoSwitch() & 1)
         SelectWeapon(player, AutoSelectWeapon(player, 1));
   }

   Return;

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

deactivated:
   mode = GetSenderRef();

   jkSetWaggle(player, '10.0 7.0 0.0', 350);
   if(fireChannel != -1)
   {
      StopSound( fireChannel, 0.1);
      fireChannel = -1;
      PlaySoundThing(fireSound1, player, 1.0, -1, -1, 0x180);
   }
   DeactivateWeapon( player, mode );

   Return;

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

selected:
   PlayMode(player, 41);
   PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);

   jkSetPOVModel(player, povModel);
   SetArmedMode(player, 1);
   jkSetWeaponMesh(player, weaponMesh);
   jkSetWaggle(player, '10.0 7.0 0.0', 350);

   trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
   SetMountWait(player, GetKeyLen(mountAnim));

   jkClearFlags(player, 0x5);
   SetCurWeapon(player, 6);

   Return;

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

deselected:
   if(fireChannel != -1)
   {
      StopSound(fireChannel, 0.1);
      fireChannel = -1;
   }

   PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
   jkPlayPOVKey(player, dismountAnim, 0, 18);

   holsterWait = GetKeyLen(holsterAnim);
   SetMountWait(player, holsterWait);
   holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
   SetTimerEx(holsterWait, 2, 0.0, 0.0);
   if (trackID != -1)
   {
      jkStopPOVKey(player, trackID, 0);
      trackID = -1;
   }
   jkSetWaggle(player, '0.0 0.0 0.0', 0);

   Return;

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

newplayer:
//   // Make sure that if the player is respawning, the old mount isn't playing anymore.
//   if(trackID != -1) jkStopPOVKey(player, trackID, 0);

   if(fireChannel != -1)
   {
      StopSound(fireChannel, 0.1);
      fireChannel = -1;
   }

   Return;
   
# ........................................................................................

killed:
   if (player == GetSenderRef())
   {  
      if(fireChannel != -1)
      {
         StopSound(fireChannel, 0.1);
         fireChannel = -1;
      }
   }
   Return;

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

autoselect:
   // If the player has the weapon
   if(GetInv(player, 6) != 0.0)
   {
      // If the player has ammo
      if(GetInv(player, 12) != 0.0)
      {
         ReturnEx(800.0);
      }
      else
      {
         ReturnEx(-1.0);
      }
   }
   else
   {
      ReturnEx(-1.0);
   }

   Return;

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

timer:
   StopKey(player, holsterTrack, 0.0);
   Return;

end


------------------
see me at: http://www.geocities.com/star_trekguy/
2003-02-10, 4:01 PM #2
I think it's local. I didn't cange much in the cog.

------------------
see me at: http://www.geocities.com/star_trekguy/
2003-02-10, 4:02 PM #3
Go to Mellennium. And find the tut on custom projectiles in MP. Follow that and it shall work. BTW - don't include the PlaySoundThing() because it's already done by the cog.

------------------
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-10, 4:05 PM #4
Quote:
<font face="Verdana, Arial" size="2">Originally posted by sskakarot51:
The laser beam needs to be local other wise no one else can see it </font>


1 more thing, WTF does that mean? I don't know what you're talking about! If you aren't sure exactly what to do, say that you aren't sure.

------------------
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-11, 10:22 AM #5
DP: I find it somewhat annoying when people answer questions sounding like they know what they are talking about, when it reality they are clueless. It happens pretty frequently on here unfortunately and just confuses the person more than if you had said nothing at all.
2003-02-11, 10:57 AM #6
I think what he meant to say was:

The laser beam needs to be global other wise no one else can see it.

[http://forums.massassi.net/html/biggrin.gif]
Team Battle.
2003-02-11, 2:10 PM #7
Someone posted something about it being local and then deleted it. strange.

------------------
see me at: http://www.geocities.com/star_trekguy/
2003-02-11, 2:14 PM #8
See my quote. edit - did ya get it to work?

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

The Magician Saber System.

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

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!