Jump to content
CMCC626

Unit status to system log & mission hint (Adding FMS to Mayberry)

Recommended Posts

I am trying to modify my already heavily modified Mayberry to play similarly to Winterberg, but without years of work. Two simple scripting goals I am trying to accomplish are:

  1. Play a mission hint with the logic [(Unit Name) (Unit Status)] when the unit goes to hospital, at hospital, to station, etc
  2. Write to log when the same happens with the same logic to plug into the FMS tool with a custom XM

Where I am having trouble is not so much the unit status but rather identifying the specific unit that pressed the action when playing a mission hint or writing to the log, does anyone know how to write this into the code so that which ever unit pressed the button is show in the script.

 

For now I have just added the mission hint portion of what I would like to do, next I want to add the log file part so that this can integrate with the FMS tool, below is an example:

 

object DummyGoHome : CommandScript
{
	DummyGoHome()
	{
		SetGroupID(20);
	}

	bool CheckTarget(GameObject *Caller, Actor *Target, int ChildID)
	{
	}

	void PushActions(GameObject *Caller, Actor *Target, int ChildID)
	{
		if(ChildID == 1)
		{
			Vehicle v(Target);
			Game::ExecuteCommand(CMD_GOHOME, &v, &v);
			Mission::PlayHint("%s Returning to Quarters",v.GetName());
		}
		if(ChildID == 2)
		{
			Vehicle v(Target);
			Game::ExecuteCommand(CMD_TOFIRESTATION, &v, &v);
			Mission::PlayHint("%s Returning to Quarters",v.GetName());
		}
	}
};

The problem is that when the unit releases from the hospital (or to hospital/at hospital) all I get for a hint is '%s Returning to Quarters' instead of 'Ambulance 1 Returning to Quarters'

 

:nixweiss:

LAToHospital.script

Link to comment
Share on other sites

It is because you cannot put together strings that way in emergency. 

 

The only wat to put together strings is something like this:

char MessageForAmbulance[20];

char AmbulanceName = v.GetName();
        snprintf(Overall, 20, "%s Returning to Quaters", AmbulanceName); //Event

Mission::PlayHint(MessageForAmbulance);

 

Link to comment
Share on other sites

I'm having a problem with this somewhere... It's just a start right now, I'd like to get these basic status' done prior to adding anything else.

...	

void PushActions(GameObject *Caller, Actor *Target, int childID)
	{
		Vehicle v(Caller);
		SetGroupID(Status3);
		SetGroupLeader(true);
		if (v.IsCurrentAction("MoveTo");
			char MessageEnRoute
			Char UnitName = v.GetName();
			snprintf(Overall, 20, "%s En Route", UnitName); // Status Message
			// System::Log(MessageEnRoute);
			Mission::PlayHint(MessageEnRoute);
			SetIcon(Status3);
	} else

...

UnitStatus.script

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...