CMCC626 Posted February 4, 2016 Report Share Posted February 4, 2016 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: Play a mission hint with the logic [(Unit Name) (Unit Status)] when the unit goes to hospital, at hospital, to station, etc 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' LAToHospital.script Quote Link to comment Share on other sites More sharing options...
bma Posted February 4, 2016 Report Share Posted February 4, 2016 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); Quote Link to comment Share on other sites More sharing options...
CMCC626 Posted February 4, 2016 Author Report Share Posted February 4, 2016 So do you think it would likely be easier to write a standalone script over integrating this into each command script individually? Quote Link to comment Share on other sites More sharing options...
bma Posted February 4, 2016 Report Share Posted February 4, 2016 No, im just saying that the way you did it with Mission::PlayHint("%s ...") is not possible in Emergency Quote Link to comment Share on other sites More sharing options...
CMCC626 Posted February 4, 2016 Author Report Share Posted February 4, 2016 I've come up with a little script, currently testing it, I'll post it and what happens soon. Basic idea is to log status based on current action. Quote Link to comment Share on other sites More sharing options...
CMCC626 Posted February 4, 2016 Author Report Share Posted February 4, 2016 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 Quote Link to comment Share on other sites More sharing options...