Unable to add 'Addaction' to spawning units

  1. ‹ Older
  2. 9 years ago

    Hello Dixon13,

    I appreciate the help, but the civilians still do not spawn with the 'addaction'.

  3. Oh sorry didn't notice you had said, "however, no civilians had the 'talk' action..."; I will test myself and see if I can get you a solution.

  4. Init.sqf:
    class Extended_Init_EventHandlers {
    class Man {
    init = "_this call (compile preprocessFileLineNumbers 'script.sqf')";
    };
    };

    script.sqf:
    if (side _this == CIV) then {_this addAction ["Talk","talk\talk_init.sqf"] };

    Top scripting tip: Always do it the simplest way first until you know it works, then you can clean it up and optimise it. :)

  5. Edited 9 years ago by Tiberius

    Hello Spencer42, thanks for your input. Following your steps unfortunately does not lead to any other result. No one has the action other than the units I gave it to manually. Not the civilians that spawn through the civilian placement module, and the other civies placed in the editor (as a test). I don't really have a clue whats going on or what I'm doing wrong. I think I messed something up somewhere.

    But I solved the problem by placing units with the addaction in the editor and run them through a cache script . Might not be as nice as using ALiVE, but it is effective ;). I cant spend any more time on this problem... :=(

    Thanks for your help spencer42 and dixon13.

    greets,

    Tiberius

  6. 8 years ago
    Edited 8 years ago by Tiberius

    Hello Everybody,

    Apologies for reopening an old conversation. I'm trying to achieve the same thing as before.
    Spawn Alive civilians with an addaction so I can walk up to them and start a custom conversation.
    I still not managed to achieve this.

    To practice I tried to add custom gear, by following the example as given here :

    However, It didn't work for me... :-(

    This is the code I used:

    description.ext

    class Extended_Init_EventHandlers {
     class Man {
      init = "_this call (compile preprocessFileLineNumbers 'script.sqf')";
     };
    };

    script.sqf

    private "_this";
    _this = _this select 0;
     
    if (side _this == civ) then 
    {
      _this addHeadgear "H_CrewHelmetHeli_B";
    };

    I know this is pretty much the same as Dixon13 and Spencer42 suggested I should do...
    Can any1 give me some advice on how to approach this? I have no time-limit anymore.

    Thanks in advance!

    Cheers
    Tiberius

  7. Edited 8 years ago by dixon13

    script.sqf should look like this... since the first script doesn't place your 'this' variable into an array.

    if (side _this == civ) then {
        _this addHeadgear "H_CrewHelmetHeli_B";
    };

    No need to state _this = _this select 0 since _this is not referring to an array but rather an object.

  8. Deleted 8 years ago by dixon13
  9. Thanks again for your help Dixon13.

    It changed it to what you suggested, but it still doesn't work for me... No units spawn with helmets...
    Is it even possible to spawn units with an addAction?

  10. Does anyone have any input for this. All help will be greatly appreciated :)

  11. Edited 8 years ago by SpyderBlack723

    Is it even possible to spawn units with an addAction?

    Definitely possible, I'll give it a shot and see if I can figure it out. I have done it before though.

    Edit: Alright, this is how I got it to work

    This is the line I used in the description.ext

    class Extended_Init_EventHandlers {
     class Man {
      init = "_this call (compile preprocessFileLineNumbers 'script.sqf')";
     };
    };

    And this is what I used in the script.sqf file

    private "_unit";
    _unit = _this select 0;
    
    if (side _unit == east) then {
    	removeHeadgear _unit;
    	_unit addHeadgear "H_CrewHelmetHeli_B";
    };

    So for you it could be something like

    private "_unit";
    _unit = _this select 0;
    
    if (side _unit == civ) then {
    	talk= _unit addAction ["Talk", "talk\talk_init.sqf", [true, false, false, false];
    };

    You could also use the addActionMP version that Dixon posted. If this doesn't work for you, test using vanilla civilians/units to make sure it is not a mod problem.

  12. Hello Spyder, Thanks for your suggestion. I will give this a try first thing tomorrow!

  13. Edited 8 years ago by dixon13

    I have been testing this lately and you must use _this select 0 so disregard what I said earlier in this thread. Here is what I said earlier.

  14. Also, if you are finding issues with Extended Event Handlers not running on units, then try enabling CBA's XEH Auto PBO, which can be found in their mod under 'optionals'.

  15. highhead

    25 Jun 2015 Administrator

    correct, your should make sure the Addon is CBA XEH compatible.
    For existing addons you may put the cba_enable_autoXEH.pbo (or similiar) from the CBA optionals folder to the /addons folder.

    If you are doing an addon yourself you may want to ping CBA dev team, they can help you with it!

  16. Hello all, thanks for your help and your advice. However, I still have zero results. Civilians do not spawn with helmets and civilians also do not spawn with the Addaction (I tried to fill script.sqf with all options). I copied what everyone posted in the files... I also tried it with different mod combinations. Last time I just used Alive and CBA. So there is no mod issue.

    I'm clueless about whats going on and why this is not working. Do you guys get it to work with the exact same code?

  17. I got mine to work with that exact code, I'll redo it and upload a repro mission for you to test. If that somehow does not work then I do not know what to say :(

  18. Hello Spyder, that would be great :)
    I'm sure i'm making a dumb mistake somewere.. But I just don't see it.
    If you could upload a version I can see the difference :D

  19. Edited 8 years ago by SpyderBlack723

    Ok here is a repro mission that 100% works with only ALiVE and CBA running.

    http://www.mediafire.com/download/1zzjda8mt2kofir/CBA+EH+Addaction.Stratis.rar

    Hopefully this works for you

  20. Thanks Spypder for you help. your mission indeed worked perfectly!
    Thanks allot!

    the next step is to figure out what I did wrong :-). But for now this totally fixes my problem!

  21. No problem, glad it worked.

    Let us know if you need help figuring it out further.

 

or Sign Up to reply!