Please or Register to create posts and topics.

on Mouse-press output?

Hey Guys.
Some of you may know the few maps with the "GelCube" wich are postet here and in the workshop, where a Lasecube hase the use of a paintgun and sprays paint if you press the rigth mousebutton.
I really like the Idea and I want to make a remake of "Tag - The Power of Paint" compared with some own Ideas, using this new type of Cube, so I went to Hammer and tryed to re-create the Cube like in the Maps. But I've still a Problem. I can't find out the Output for paintspraying while prssed the Mousebutton. At the Moment my Cube automatically starts spraying Paint when its Picked up, and stop it when its dropped, but thats sometimes very anoying to controll, especially when the Cube covers itself with paint while picking up.
So, can please someon tell me what I must inset in the Outputs of the Cube, that it only SPrays Paint when I press the Right (or the Left) Mousebutton?
Thanks.

I think you might be able to get the paint gun instance from the creator.. perhaps motanum
as for mouse clicks....
create an entity with the "game_ui" class, then the player must activate this entity.
so you CAN NOT have some auto relay activate it on map spawn...no, the player must activate it, the way I usually do this is through a trigger brush. Have the output send the activate command to the game_ui entity you have.
On the game_ui entity you'll see some fun outputs, like "PressedAttack" or "PressedAttack2" this would be your left and right mouse clicks respectively (if you have default settings of course)

EDIT:
If anyone is interested I've copied the code for this entity's activate method(From EP2) below... you can see how they are using the activator to find the player... they probably could have just grabbed a reference to the player object, but this probably is designed with multiplayer in mind when there is more than one player to worry about.

Code: Select all
void CGameUI::InputActivate( inputdata_t &inputdata )
{
   CBasePlayer *pPlayer;

   // Determine if we're specifying this as an override parameter
   if ( inputdata.value.StringID() != NULL_STRING )
   {
      CBaseEntity *pEntity = gEntList.FindEntityByName( NULL, inputdata.value.String(), this, inputdata.pActivator, inputdata.pCaller );
      if ( pEntity == NULL || pEntity->IsPlayer() == false )
      {
         Warning( "%s InputActivate: entity %s not found or is not a player!n", GetEntityName().ToCStr(), inputdata.value.String() );
         return;
      }

      pPlayer = ToBasePlayer( pEntity );
   }
   else
   {
      // Otherwise try to use the activator
      if ( inputdata.pActivator == NULL || inputdata.pActivator->IsPlayer() == false )
      {
         Warning( "%s InputActivate: invalid or missing !activator!n", GetEntityName().ToCStr(), inputdata.value.String() );
         return;
      }

      pPlayer = ToBasePlayer( inputdata.pActivator );
   }

   // If another player is already using these controls3, ignore this activation
   if ( m_player.Get() != NULL && pPlayer != m_player.Get() )
   {
      // TODO: We could allow this by calling Deactivate() at this point and continuing on -- jdw
      return;
   }

   // Setup our internal data
   m_player = pPlayer;
   m_playerOn.FireOutput( pPlayer, this, 0 );

   // Turn the hud off
   SetNextThink( gpGlobals->curtime );

   // Disable player's motion
   if ( FBitSet( m_spawnflags, SF_GAMEUI_FREEZE_PLAYER ) )
   {
      m_player->AddFlag( FL_ATCONTROLS );
   }

   // Store off and hide the currently held weapon
   if ( FBitSet( m_spawnflags, SF_GAMEUI_HIDE_WEAPON ) )
   {
      m_player->m_Local.m_iHideHUD |= HIDEHUD_WEAPONSELECTION;

      if ( m_player->GetActiveWeapon() )
      {
         m_hSaveWeapon = m_player->GetActiveWeapon();

         m_player->GetActiveWeapon()->Holster();
         m_player->ClearActiveWeapon();
         m_player->HideViewModels();
      }
   }

   // We must update our state
   m_bForceUpdate = true;
}



Also, I made a map just for you! Sunset
Click Here to view my Workshop and play my puzzlemaker maps

There are instances in the FGEMOD, although the paint spray is a little slow. You can just open up the info_paint_sprayer's settings and change that.

I used the same method Reepblue did for these: the player picking up the cube activates the game_ui, and dropping it deactivates it.

Falsi sumus crusto!

Exactly what I need in my map.
...Maybe.
Thanks for the C++ BenVlodgi btw, useful for Indie devs and devs alike.
I'm not gonna steal it though. That's cheating. :D
-LCLover

So, how are you holding up. BECAUSE I'M A POTATO.
LCLover wrote:
Exactly what I need in my map.
...Maybe.
Thanks for the C++ BenVlodgi btw, useful for Indie devs and devs alike.
I'm not gonna steal it though. That's cheating. :D
-LCLover

haha, yah well you can get it from HL2EP2, which is open source



Also, I made a map just for you! Sunset
Click Here to view my Workshop and play my puzzlemaker maps