Cog Quiz

Week 1 - Answer

Prev - Exit - Next

Show Quiz

Level 1

GetSenderRef() in fire: message will return the fire mode pressed by the user.

It returns "0" for pressing primary fire and "1" for pressing secondary fire. Thus using PrintInt();, which prints out integers including variables, over GetSenderRef(); pressing the primary fire button will print out "0" onto the display.


Level 2

DeactivateWeapon(); itself takes away the fire message activation activated by ActivateWeapon();. But if you try to retrieve a variable from that verb, it will return the time spent the fire key was held down by the player.

(Message activated: gets called upon pressing, fire: while pressing, and deactivated: when you let go of your finger.)

For example the Bowcaster uses this method for shooting out single or multiple shots for primary fire.


Level 3

Since the cog is flagged as an item in items.dat, (0x002), even though activated and deactivated gets called by pressing the hotkey, it won't trigger the fire message as it does in weapons with ActivateWeapon();. So in order to achieve the same effect, simply use pulse: message.

   activated:
   SetPulse(fireWait);
   return;

   pulse:
   FireProjectile();
   return;

   deactivated:
   SetPulse(0);
   return;

If the cog was flagged as a force (0x8) in the items.dat, rather use De/ActivateBin(); to replace De/ActivateWeapon();. That will call the fire message as well.