Extended_Init_EventHandler for Man, not firing?

  1. 8 years ago

    I'm struggling to see why this fails. Can anyone see the obvious issue at hand?

    In description.ext at the bottom:

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

    civInit.sqf:

    private "_civ";
    _civ = _this select 0;
    
    if ((side _civ == Civilian) and (!isPlayer _civ)) then {
        _civ addEventHandler ["Killed", {
            _unit = (_this select 0);
            _killer = (_this select 1);
            
            if (isPlayer _killer) then {
                _id = format ["civID%1", _unit];
                _text = format ["%1 killed %2", name _killer, name _unit];
                
                _marker = createMarker [_id, getPosASL _unit];
                _marker setMarkerShape "ICON";
                _marker setMarkerType "hd_warning";
                _marker setMarketText _text;
                _marker setMarkerColor "colorRed";
                _marker setMarkerAlpha 0.5;
                
                _currentReinforcementCount = ([ALIVE_globalForcePool, "OPF_G_F"] call ALIVE_fnc_hashGet);
                [ALIVE_globalForcePool, "OPF_G_F", (_currentReinforcementCount + 5)] call ALIVE_fnc_hashSet;
            };
        }];
    };

    Can't figure out why it's not firing.

  2. Civilians spawned are under the side Civilian, correct? I'm struggling to debug the issue here, any help or direction to look would be greatly appreciated.

  3. Yes ((side _unit) == civilian) should work

  4. Well, it is not working, that is the whole issue.

  5. I was simply answering your 2nd post, to my knowledge it appears it should work, I would just double check you made no syntax errors using -showScriptErrors.. I see no problems with it but I would make the eventhandler call a file that simply displays a hint so you can confirm it is beinng called up correctly.

  6. @SpyderBlack723 I was simply answering your 2nd post, to my knowledge it appears it should work, I would just double check you made no syntax errors using -showScriptErrors.. I see no problems with it but I would make the eventhandler call a file that simply displays a hint so you can confirm it is beinng called up correctly.

    Ok, I'll do that. I've tried stripping it down in various ways, to see if I can get any response from it. It seems to never fire at all, but I'll make double sure there's no syntax errors now.

  7. Edited 8 years ago by Bosenator

    Thanks for that Spyder, I was a complete idiot. Issue if anyone is wondering is line 16.

     _marker setMarketText _text;

    _marker setMarketText _text;

  8. Edited 8 years ago by SpyderBlack723

    Good catch, unfortunate how one thing can spoil an entire script, does it work in it's entirety now?

  9. @SpyderBlack723 Good catch, unfortunate how one thing can spoil an entire script, does it work in it's entirety now?

    There's one other alteration to it, that I made before the typo. That is ((side _civ == Civilian) is now (((faction _civ) == "CIV_F") so it can be altered to match module alterations.

    Works properly, yes. I can't be for sure on the reinforcement pool though. Does one in the pool represent one armed unit?

  10. Edited 8 years ago by SpyderBlack723

    I am not sure, I have not messed with forcepool before. I believe it should but I could be wrong.

  11. AFAIK it is one unit, not one group.

    I read that code at least 3 times and didn't notice the market :)

    Use Notepad++ for your editor it will show these errors

  12. I use Qt Creator. There's no plugin for the Arma 3 library, so I cannot get correct syntax highlighting on inbuilt functions. Just basic C derivative.

  13. Link to notepad plugin:
    http://www.armaholic.com/page.php?id=8692

  14. Thank you for the suggested help, but I'm just very comfortable with Qt Creator, having to deal with it on a daily basis for work.

  15. No worries I understand.. thought I'd post a link in case :)

  16. I actually didn't have that so thank you Savage.

  17. You're welcome it's saved my ass a few times lol

 

or Sign Up to reply!