Jump to content
Sign in to follow this  
avibird 1

EventHandler issues following save game function units will not take Damage.

Recommended Posts

I suspect explosions are seen slightly differently than bullets, I'm not sure of a way around this one.

Share this post


Link to post
Share on other sites

Hey f2k sel it's not the Explosions that kill the units it's the fire damage and the fact they are no forced out of the vehicles now. 

 

If you just put my old way  this addEventHandler ["HandleDamage",{ _dam = _this select 2; if (_dam > 0.9) then {_dam = 0.8}; _dam }]; into the units init when there are in a vehicle and it blows up the units are forced out on to the ground and the fire never kills them you just take damage  .9 and then you stay at .8 unconscious.

Share this post


Link to post
Share on other sites

So it would be

{
   _x addEventHandler ["HandleDamage",{
 _dam = _this select 2;
    if (_dam > 0.9) then {
        _dam = 0.8};
         _dam }
      ];

} foreach playableunits+switchableunits+[bill,tom,joe];

Seems the destruction of the vehicle kills the unit. Didn't you say you some other program was taking care of unconscious state.

Share this post


Link to post
Share on other sites

First F2k sel thank you once again. That works now :)

Yes I am using a modify DAPMAN revive  I still think it is the best one around.

 

Yes I took them out of the code  a while ago    //_player setCaptive true;
                                                                          // _player playAction "Unconscious";

 

 

These parts   

                     private ["_player", "_dam"];

                    

                     _player = _this select 0;

 

                      _player

 

I don't fully understand why it caused the issues but I am trying ;)  most of the time my aspirations are way over my knowledge base but that does not stop me from trying with the help from others like you sir.

 

 

old code with units getting killed in vehicles/fire and maybe Explosions

 {

   _x addEventHandler ["HandleDamage",{

        private ["_player", "_dam"];
    
        _player = _this select 0;
        _dam = _this select 2;
        
            if (_dam > 0.8) then {
            
                _player setDamage 0.8;
                //_player setCaptive true;
                //_player playAction "Unconscious";
            };_dam;
    }];

    } foreach playableunits+switchableunits+allplayers+[Raven_AMED,Falcon_AMED,Dove_AMed];

New code that works like it should units will never die only go Unconscious. if anyone else was following this post.

 

                    

{
   _x addEventHandler ["HandleDamage",{
 _dam = _this select 2;
    if (_dam > 0.9) then {
        _dam = 0.8};
         _dam }
      ];

} foreach playableunits+switchableunits+[Raven_AMED,Falcon_AMED,Dove_AMed];

The really cool thing is that I have limited pilot slots that can only fly. If you get shot down over the water the pilot is somewhere at  the bottom of the ocean. Makes for interesting search and rescue for the pilots with active enemy patrols in the water :)  once again thank you until my next issue.
      

Share this post


Link to post
Share on other sites

f2k sel,   barbolani  and Davidoss    I have  one small issue left.

 

 

 

 

with this code setup the units will never fully die when shot only go Unconscious however in a vehicle Explosions they will die and all the units will be deleted and you would never see the bodies on the ground But the code works following multiple game saves on the same mission.

{
    _x addEventHandler ["HandleDamage",{

        private ["_player", "_dam"];
    
         _player = _this select 0;
         _dam = _this select 2;
        
             if (_dam > 0.8) then {
            
                 _player setDamage 0.8;
                 _player setCaptive true;
                 _player playAction "Unconscious";
             };_dam;
     }];

with this code setup the units will never fully die when in a vehicle Explosions they will be ejected out of the vehicle in a state of Unconscious on the ground however following a game save the units will take damage but never fall Unconscious

{
   _x addEventHandler ["HandleDamage",{
 _dam = _this select 2;
    if (_dam > 0.9) then {
        _dam = 0.8};
         _dam }
      ];

} foreach playableunits+switchableunits+[Raven_AMED,Falcon_AMED,Dove_AMed];

How can I add the Unconscious part  back into the second code

Share this post


Link to post
Share on other sites

I know the answer for that! You have to do the following (maybe a few steps have been done, but not all, for sure):

 

- Make an Arma scripting tutorial, read it well!!!

- Check the command reference list, understand what commands are you using (addEventHandler, playableUnits etc..)

- Check Killzone Kid's documentation about MP scripting, locality, servers, etc..

- See the comunity scripts which you can research on the topics you want to see what code works and how to make it to work to suit your needs.

- Get used to see .rpt files and understand the error reports meanings when your scripts don't work.

 

And then, if you cannot make the thing work:

 

- Post here, explaining exactly what you want to achieve, how are you doing it exactly, what is dropping the .rpt, the misión file... all the relevant info, in the OP if possible.

 

Then the solution will be reached earier and the people trying to help you will be happier.

Share this post


Link to post
Share on other sites

@barbolani I just want to know how to add the Unconscious command back into the this code block

{ _x addEventHandler ["HandleDamage",{ _dam = _this select 2; if (_dam > 0.9) then { _dam = 0.8}; _dam } ]; } foreach playableunits+switchableunits+[Raven_AMED,Falcon_AMED,Dove_AMed];

A lot of this is just over my head. I enjoy messing with the editor and trying to understand codes and to read scripts. Trail and error and asking questions is the best I can do at this point. I appreciate the help but not everyone has a background in computer laguage and scripting especially using Arma scripting. This is the best I can do. If you can pass information down great if you can help me understand a little better fantastic but at the end of the day I just want to play Arma with the concept I have in my head for a mission design and if I can pass any thing to other people that you guys educated me on i will. I just don't ask questions i have attempted multiple code variations on my own with no luck. I do know that most things can be accomplished with the right information and knowledge of this language.

I

Share this post


Link to post
Share on other sites

I am not meaning you are just asking questions.

 

I am meaning you are trying to do things with no understanding of the commands and techniques you are using.

 

And try and try and try and nothing works and then you ask. I've been there.

 

And what I am trying to say is: before doing anything, understand what you are doing, understand the commands you are using, and probably you will make it work in the 20th(only) try.

 

And if it still does not work, your questions will have more sense, you will provide the info we need and everything will go more fluent.

Share this post


Link to post
Share on other sites

As you have DAPMAN handling the Unconscious bit it seems like after a game save some units are nolonger using that code.

I haven't got a clue where to go from here just putting back Unconscious will just cause the same issues as before.

 

You could try one thing

{
_x addEventHandler ["HandleDamage",{

private ["_player", "_dam"];

_player = _this select 0;
_dam = _this select 2;

if (_dam > 0.9) then {

_player setDamage 0.8;
_player setCaptive true;
_player null = spawn {sleep  0.5;_this  playAction "Unconscious"};
};_dam;
}];

It might allow time for the unit to exit the vehicle before applying playAction "Unconscious"


 

Share this post


Link to post
Share on other sites

Yes fek sel I just want to add the unconscious back to this code block

{

_x addEventHandler ["HandleDamage",{ _dam = _this select 2; if (_dam > 0.9) then { _dam = 0.8}; _dam } ]; } foreach playableunits+switchableunits+[Raven_AMED,Falcon_AMED,Dove_AMed];

I almost positive this will work with the save and not kill the units while in a vehicle. AVIBIRD

Share this post


Link to post
Share on other sites

try

{
_x addEventHandler ["HandleDamage",{_player = _this select 0; _dam = _this select 2; if (_dam > 0.9) then { _dam = 0.8;_player playAction "Unconscious"}; _dam } ]; } foreach playableunits+switchableunits+[Raven_AMED,Falcon_AMED,Dove_AMed];

.

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
Sign in to follow this  

×