Jump to content
  • 0

M113 Help


Defent

Question

Hey, I've been trying to get a fix working for a slight annoyance that has been going on on my servers.

People have been able to survive when the M113 gets blown up and camps the wreck or logs out. 

To combat this, I have decided to kill those who manage to survive the crash but the script doesn't really work. 

 

Anyone got any ideas?

// work around for m113 bug

_vehicle = ["M113Ambul_TK_EP1"];
_hasCrew = player in (crew _vehicle);

waitUntill {not alive _vehicle};
	if (_vehicle and _hasCrew) then {
	sleep 1;
		player setDamage 1;
	};
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

// work around for m113 bug

_vehicle = ["M113Ambul_TK_EP1"];

_hasCrew = player in (crew _vehicle);

_vehicleDamage = damage _vehicle;

waitUntill {_vehicleDamage = 1};

    if (_vehicle and _hasCrew) then {

    sleep 1;

        player setDamage 1;

    };

 

 

That was more simple than I thought. Thank you. I also believe that !alive may have been better than "not alive". 

 

Edit: Wouldn't !alive be better than checking for damage = 1? Or whats the difference?

Link to comment
Share on other sites

  • 0
// work around for m113 bug
_vehicle = ["M113Ambul_TK_EP1"];
_playerVeh = (vehicle player) in _vehicle;
_hasCrew = player in (crew _vehicle);
_vehicleDamage = damage _vehicle;
waitUntil {_vehicleDamage == 1}; //It is important to put two '=' AND it is WaitUntil not WaitUntill
    if (_playerVeh && _hasCrew) then {
        sleep 1;
        player setDamage 1;
    };

By the way;

once ONE M113 is going to get exploded, the script will stop because of the WaitUntil.

I'd put a While loop in.

 

Maybe some typo's, check again if using the code above.

 

forgot im scripting in a few languages and there are diffrences

Link to comment
Share on other sites

  • 0
// work around for m113 bug
_vehicle = ["M113Ambul_TK_EP1"];
_playerVeh = (vehicle player) in _vehicle;
_hasCrew = player in (crew _vehicle);
_vehicleDamage = damage _vehicle;
waitUntil {_vehicleDamage == 1}; //It is important to put two '=' AND it is WaitUntil not WaitUntill
    if (_playerVeh && _hasCrew) then {
        sleep 1;
        player setDamage 1;
    };

 

Just a quick question. Why check for players twice? If I were to do that, why not make it an OR statement instead:

    if (_playerVeh or _hasCrew) then {
        sleep 1;
        player setDamage 1;
    };

I can't see much difference between these two:

_playerVeh = (vehicle player) in _vehicle;
_hasCrew = player in (crew _vehicle);

Wouldn't it just be easier with the !alive statement then? 

// workaround for m113 bug

_vehicle = ["M113Ambul_TK_EP1"];
_playerVeh = (vehicle player) in _vehicle;
_hasCrew = player in (crew _vehicle);
while {!alive _vehicle}; 
	uiSleep 25; 
	// probably exists some fancier way to do OR
    if (_playerVeh or _hasCrew) then { 
        player setDamage 1;
    };

Also, this is "bug" is apparently common across many other vehicles, where it gets blown up and you stay alive inside. I'm not too sure I want that on my servers. We'll see.

 

 

Edit:

_hasCrew = player in (crew _vehicle);

Doesn't work:

 

Error crew: Type Array, expected Object

 

I don't think I can convert an array in to an object so I'll use the other way that was mentioned.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...