Not all 'PushAction" commands executing

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

Information: The EMERGENCY community board is completely free and is financed by advertisement. Please deactivate adblocker if you use this site. Thank you!

  • Not all 'PushAction" commands executing

    I'm trying to add some functionality to a mod, but I'm running into an Issue I can't get past.
    First of all: I'm an experienced coder, I'm not familiar with C++ though.

    So I've got the following setup:

    C Source Code

    1. void PushActions(GameObject *Caller, Actor *Target, int childID) {
    2. Vehicle myVehicle(VehicleList(Caller->GetName()).GetVehicle(0));
    3. int myVehicleID = myVehicle.GetID();
    4. PersonList myCrew(myVehicle.GetName());
    5. System::Log("Start loop");
    6. for (int i=myCrew.GetNumPersons()-1; i > -1; i--)
    7. {
    8. Person *person = myCrew.GetPerson(i);
    9. person.PushActionWait(ACTION_NEWLIST, 0.1f);
    10. person.PushActionLeaveCar(ACTION_APPEND, &myVehicle);
    11. person.PushActionExecuteCommand(ACTION_APPEND, "GetFirehose", &myVehicle, 0, false);
    12. person.PushActionWait(ACTION_APPEND, 1.0f);
    13. person.PushActionExecuteCommand(ACTION_APPEND, "AttachFireHose", Target, 0, false);
    Display All
    Odly, the person does get out of the vehicle, and does grab the firehose, but after that, he simply doesn't do anything anymore. If I manually tell him to attach the firehose to the target, it works just fine.

    Now comes the really strange part: If I take the code from GetFireHose and replace person.PushActionExecuteCommand(ACTION_APPEND, "GetFirehose", &myVehicle, 0, false); with that code, the person gets out, grabs the hose and does attach it to the target. I haven't got the slightest idea what could be causing this, does anyone else have an idea?

    To clarify, I'm utterly confused by all the different pointers and doodads that C++ uses, so it's very possible I got a & or * wrong somewhere. If someone could explain those to me in EM4 terms that would be great.

    The post was edited 1 time, last by Timmiej93: Added how I get the person variable for clarity. ().

  • It’s possible that GetFirehose clears any other action by pushing a new action with ACTION_NEWLIST set. If you set the s_debug property in your config file to a value of 1 (or maybe even 2, it‘s been a while) you should be able to select a game object and have the game show the current state of the push action stack.

    The most important thing about pointers in EM4 is not to confuse -> and . for member access. IIRC PAExecuteCommand expects an pointer of an Actor (where Actor > GameObject > Vehicle) as third parameter. Using & here to reference myVehicle is the proper thing to do.
    [EM4] Matchmaking Server | Das Original mit dem Blubb