Topic: Trying to add a comm button  (Read 4425 times)

0 Members and 1 Guest are viewing this topic.

Offline rogerbacon

  • Lt. Junior Grade
  • *
  • Posts: 5
Trying to add a comm button
« on: June 27, 2014, 08:35:06 pm »
I've taken the Mul_FreeForAll as my starting point and I want to add a button to every ship at the beginning of the mission. I followed the scripting guide but the button is not appearing.

In CommonShip.h I added
   enum eCommStates
   {
      CommonShipBaseState,
   };

In CommonShip.cpp I have
void tCommonShip1::mSetupCommState()
{
   tTeamInfo*   CommonTeam = fMissionInfo->mGetTeamHandle( mGetTeam() );
   CommonTeam->mRegisterCommMessage(CommonShipBaseState, CommonShipBaseState, mGetShipID(), kLaunchFightersButton, kFighterSpawned_msg);
   CommonTeam->mGotoCommState(mGetShipID(), CommonShipBaseState);
}

In MissionText.h and .cpp I've set up the appropriate text label and message

In CommonShipBaseState I have a simple debug message (but I can't even get this far since the button never appears)
void tCommonShip1BaseState::mOnCommButtonPress( tShipInfo* ship, int32 buttonID, tShipInfo* targetShip )
{
      if (buttonID == kLaunchFightersButton)
   {
      fMissionInfo->mDebugMessage("This is where I should launch a PF.");
   }

}

Can anyone tell me where I might have missed something?

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 938
  • Gender: Male
Re: Trying to add a comm button
« Reply #1 on: February 20, 2015, 07:38:25 am »
Where do you want this button to appear? On the fleet command bar? What's your goal? There is a hotkey to launch Fighters and PF's.