Jump to content

Recommended Posts

Just got this working in MP with Ace 3 - it's great! 

 

Question, if I want medics recruited with Bons recruitment script to spawn with the automated Medic options, how would this be done?

  • Like 1

Share this post


Link to post
Share on other sites

Glad I landed here, could not get the script to work, had a feeling it was due to ACE. Popped davidoss's update in and *poof* magic, I thought I was going to piss myself when the guy started healing me! :dancehead:My med module is set on advanced and he'll heal me up no prob as long as I don't get whacked unconscious, he'll give it one go and then give up, I'll stop bleeding, but still be out. I'm guessing that maybe pulling the module back to basic mode, or making the medic an advanced medic would fix that? I might have to set the surgical kit and PAK to use anywhere for any status, something to play with anyway. Bardosy and davidoss - thanks for some great work!!!

Share this post


Link to post
Share on other sites

I'll have to try this - thanks...

Sent from my iPhone using Tapatalk

Share this post


Link to post
Share on other sites

Hey all,

 

Ive been using davidoss's ACE 3 edit recently and its been working brilliantly! Many thanks to bardosy and davidoss!

However my scenarios are hitting a snag with the script no longer applying to the unit after it has died and respawned.

Has anyone found a similar problem and solved it?

 

Ive been looking for some work around with the addeventhandler 'respawn' but really have limited knowledge in scripting.

The work around ive been trying is as follows:

 

unit init: 

this setGroupID ["Alpha"];

dummy = [this, units (group this)] execVM "scripts\automedic.sqf";

this addeventhandler ["respawn","_null execVM 'scripts\automedic.sqf'"];

I was getting errors regarding line 35 but havent been able to replicate to show in a .rpt file.

My guess is that the _null function isnt the correct call but honestly out of my depths to understand.

Cheers

 

Share this post


Link to post
Share on other sites

Hey thanks for the quick reply!

 

The ai is spawning in using the ace respawn module and BIS respawns for the playable ai and players. the settings are "instant" in the desciption.ext file "respawn on the postition of death" in the multiplayer settings.

I usually throw a grenade at the medic for "kill" the unit and then wait for the respawn.

(note this is for MP scenarios).

 

Hope that answers the question

Share this post


Link to post
Share on other sites

While you use ACE you are forced to use CBA_A3.

In CBA_A3 are functionality called Extended Init EventHandlers

Using this you can execute custom init for every unit spawned in game for which you have no access to its init ( spawned by mod)

You need this because first AI where you execute the  automedic is not equal to re-spawned ai

 

Otherwise if the ace re-spawn module gives possibility to inject init code for re-spawned unit there will be local variable referred to usually _this

Share this post


Link to post
Share on other sites

Ahh thats really useful! Im going to go over the CBA. XEH instructions now* and see if I can work it out. 

Thank you heaps for the direction!

 

cheers.

 

*(if i cant get it to work ill repost) 

Share this post


Link to post
Share on other sites

While I was reading through the XEH user information I came across this problem with the 

making XEH init event handlers run when a unit respawns

IMPORTANT: This feature will only work on the player's unit - AI units that respawn won't have their XEH init EH:s re-executed. (If someone can figure out a trick to identify playable units in a MP mission, this limitation could be removed)

 

You wouldn't happen to have that trick would you? 

 

Otherwise I'm trying out your other idea of using the ACE respawn modules init, but I cant figure out how to get it work in regards to the _this local variable.

Any advice is welcome :)

 

 

Share this post


Link to post
Share on other sites

XEH has working for me  for edges. You can simply try if its still works.

Other problem is from which owner AI are spawned by ACE 3 respawn module

 

Lets say the unit are spawned on client side

 

put this at bottom of description.ext

class Extended_Init_EventHandlers {

    class SoldierEB { //  SoldierEB is  for EAST side, for WEST use SoldierWB, for INDEPENDENT use SoldierGB
    
        init = "(_this select 0) call fnc_createMed";
 
    };
};


create a file called functions.sqf

put this inside

fnc_createMed = {

params ["_unit"];

    if !(getNumber(configFile >> "CfgVehicles" >> typeOf _unit >> "attendant") == 1) exitWith {};
    
        private _playerGroups = [];
        private _players = playableUnits + switchableUnits;
        {_playerGroups pushBackUnique (group _x)} forEach _players;

        if ((group _unit) in _playerGroups) then {
        
            null = [_unit, units (group _unit)] execVM "automedic.sqf";
            
        };
};

on top of init.sqf

[] call compile preprocessFileLineNumbers "functions.sqf";

If that works no need to execute automedic.sqf in any different way otherwise it will be called twice

Share this post


Link to post
Share on other sites

I had a go at entering in the code exactly as it is above to see if they worked but sadly no luck. 

I also tried it without the respawn settings at its most default with just playable units and the script.

Are there variables that i should be adding that ive left out?

 

Thank you again.

Share this post


Link to post
Share on other sites

Ok i need to test it on my self.

Can you link your test mission somewhere?

 

It means that the unit are spawned by server and joining the player group after

In that case the automedic init are fired before that.

Share this post


Link to post
Share on other sites

Of course :)

 

Its just a basic setup with 3 units (leader, medic, test subject), ace modules (respawn and revive) and mulitplayer respawn settings.

http://steamcommunity.com/sharedfiles/filedetails/?id=761301052

 

does that mean it a postinit eventhandler might work?

 

Thank you!

 

*edited: I would post the test mission I intend to use the script on but alas that would require alot of added content...

Share this post


Link to post
Share on other sites

Alright got it. In a sec have found possible fixes

null = [_unit, units (group _unit)] execVM "automedic.sqf";

should be

null = [_unit, units (group _unit)] execVM "scripts\automedic.sqf";

in your case.

 

 

Next

class Extended_Init_EventHandlers {

    class B_med_F

B_med_F, is that correct class name of medic unit?

It was always B_medic_F if i remember.

Share this post


Link to post
Share on other sites

Ive followed your steps as above but sadly have not been able to get it to work.  :(

 

description.ext  

//You are right about B_medic_F being correct.

class Extended_Init_EventHandlers {

    class B_medic_F { //  SoldierEB is  for EAST side, for WEST use SoldierWB, for INDEPENDENT use SoldierGB
    
        init = "(_this select 0) call fnc_createMed";
 
    };
};

functions.sqf

fnc_createMed = {

params ["_unit"];

    if !(getNumber(configFile >> "CfgVehicles" >> typeOf _unit >> "attendant") == 1) exitWith {};
    
        private _playerGroups = [];
        private _players = playableUnits + switchableUnits;
        {_playerGroups pushBackUnique (group _x)} forEach _players;

        if ((group _unit) in _playerGroups) then {
        
            null = [_unit, units (group _unit)] execVM "scripts\automedic.sqf";
            
        };
};

Share this post


Link to post
Share on other sites

Yes. After some test I also encountered problems with ACE 3 + XEH.

Switched to missionEventHandler instead

 

init.sqf

if (isServer) then {

	 private _handle1 = addMissionEventHandler ["EntityRespawned",{

		 params ["_newEntity", "_oldEntity"];
		 
		 if !(getNumber(configFile >> "CfgVehicles" >> typeOf _newEntity >> "attendant") == 1) exitWith {};
		 if (isPlayer _newEntity) exitWith {};
		 
		 private _playerGroups = [];
		 private _players = playableUnits + switchableUnits;
		 {_playerGroups pushBackUnique (group _x)} forEach _players;

		 if !((group _newEntity) in _playerGroups) exitWith {};
		 
		 null = [_newEntity, units (group _newEntity)] execVM "scripts\automedic.sqf";
		 deleteVehicle _oldEntity;
	}];
};

Works like it should

 

in medic init field paste this:

if !(isPlayer this) then { null = [this, units (group this)] execVM "scripts\automedic.sqf";};

Mission link

 

Need to test it in real dedicated environment

Share this post


Link to post
Share on other sites

Mate you are an absolute legend! Tested it out and it worked perfectly!

Just want to say thank you so much for the help man. learnt alot about XEH and CBA from that!

 

If im able to test it the full mission on dedicated servers ill let you know it goes.

 

Cheers again!

Share this post


Link to post
Share on other sites

Anyone know how to get the AI medic to go back to its previous waypoint (before being told to heal) ?

Share this post


Link to post
Share on other sites

I this script he is ordered to fallow leader.

You need to change that if you expecting  different behavior

Share this post


Link to post
Share on other sites

My problem is that I normally split a medic off into a sub team (normally 2x medics in a whole team of 10).  They are given a team colour and each team is given a separate waypoint.  After the medic does its heal, I need the medic to resume with it's previous waypoint. Possible ?

Share this post


Link to post
Share on other sites

I haven't tried the script but if you remove this line   _medic doFollow (leader group _medic);   would it return to previous command/waypoint

Without scripting they seem to do just that.

Share this post


Link to post
Share on other sites

Hi Davidoss

 

fantastic job!

 

In our case, we want to leave the automedic back at base, so that when a player in one of the teams gets badly injured and the medic in the team can't totally heal him (eg broken legs)  have the injured evacuated back to base where he will be properly fixed. we feel that this is a little bit more inmersive.

 

Note that the medic should be independent from the teams so that a player from any team can be attended by the automedic.  Or perhaps having it idle, and with an "add action" that would activate its healing magic... Is that possible?

 

Thanks in advance for looking into that

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×