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 → Ammo probs
Ammo probs
2002-11-07, 6:43 PM #1
Yeah, I never ever knew how these things work so I cant seem to fix my prob. How do you define which ammo is used for each gun for the HUD? Like I want to change the bryar to use its self as ammo like the thermdets and sequence chargers do.

I have gotten it to fire the correct ammo, its just the strifle's ammo is the one that shows up on the HUD.

Thanks for any help.
Team Battle.
2002-11-07, 6:44 PM #2
hmm, Its not defined in the cog :/

Maybe I should have posted this in the main editing forum.
Team Battle.
2002-11-07, 7:00 PM #3
Meh, there is problably a way to cheat with cog, I just cant think of it, becuase I have zero experiance in swapping bins like that. [http://forums.massassi.net/html/frown.gif] Im sure someone here does, though.
And when the moment is right, I'm gonna fly a kite.
2002-11-08, 12:37 AM #4
Nm, I asked dormouse and he showed me how to use a bin and copy its values over the ones on the hud. So it all works now.

Thanks anyways!
Team Battle.
2002-11-08, 4:06 AM #5
I also have a way to swap ammo or add an extra set. It probably the same way but I'll still post so GBK can learn.

Start off making a new variable for the original ammo. That is the ammo bin (e-cells in this case) that is normally displayed on the HUD.

You set that variable in Selected to reset the origanal ammo, and set the e-cell bin to the new ammo bin.

Then in fire message, change the new bin along with the ammo bin.

Then in Deselected:, reset the old bin to the variable.

For example, here's a part of a modified conc rifle with this effect.
Code:
fire:
   // Check that the player is still alive.
   if(GetThingHealth(player) <= 0)
   {
      Return;
   }

   // Check Ammo - If we are out, autoselect best weapon.
   if(GetInv(player, 12) < 8.0)
   {
      PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
      if(GetAutoSwitch() & 1)
         SelectWeapon(player, AutoSelectWeapon(player, 1));
      Return;
   }

   SetPOVShake('0.0 -.03 0.0', '4.0 0.0 0.0', .05, 80.0);
   if(mode == 0)
   {
      dummy = FireProjectile(player, projectile, fireSound, 18, '0.02 0.15 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimMaxDist);
      ChangeInv(player, 12, -8);
      ChangeInv(playerm 116, -8);
   }
   else
   {
      dummy = FireProjectile(player, projectile3, fireSound, 18, '0.0 0.0 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimMaxDist);
      ChangeInv(player, 12, -4);
      ChangeInv(player, 116, -4);
   }

   jkPlayPOVKey(player, povfireAnim, 1, 0x38);

   // Provide a kick backwards
   ApplyForce(player, VectorScale(GetThingLVec(player), -80));

   powerBoost = GetInv(player, 63);
   ChangeFireRate(player, fireWait/powerBoost);

   Return;

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

activated:
   player = GetSourceRef();
   mode = GetSenderRef();

   jkSetWaggle(player, '0.0 0.0 0.0', 0);

   powerBoost = GetInv(player, 63);
   ActivateWeapon( player, fireWait/powerBoost, mode );

   Return;

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

deactivated:
   player = GetSourceRef();
   mode = GetSenderRef();

   jkSetWaggle(player, '10.0 7.0 0.0', 350);
   DeactivateWeapon( player, mode );

   Return;

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

selected:
   player = GetSourceRef();

   // Play external mounting animation
   PlayMode(player, 41);

   // Setup the meshes and models.
   jkSetPOVModel(player, povModel);
   SetArmedMode(player, 1);
   jkSetWeaponMesh(player, weaponMesh);
   jkSetWaggle(player, '10.0 7.0 0.0', 350);

   // Play mounting sound.
   PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80);

   // Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
   // The animation is held at the last frame after it is played.
   trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
   SetMountWait(player, GetKeyLen(mountAnim));

   // Clear saber flags, and allow activation of the weapon
   jkClearFlags(player, 0x5);
   SetCurWeapon(player, 9);

   oldAmmo = GetInv(player, 12);
   SetInv(player, 12, GetInv(player, 116));

   // Check Ammo - If we are out, autoselect best weapon.
   if(GetInv(player, 12) < 2.0)
   {
      PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
      if(GetAutoSwitch() & 1)
         SelectWeapon(player, AutoSelectWeapon(player, 1));
   }

   Return;

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

deselected:
   player = GetSourceRef();

   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);

   SetInv(player, 12, oldAmmo);

   Return;
Simple huh? [edit]Italizied code are the new lines added.[/edit]

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

The Magician Saber System.

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

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!