Jump to content
Sign in to follow this  
harold5187

Syntax Question to resolve my problem, can someone help me out please

Recommended Posts

The layout of my mission is this:

10 Bluefor units on the map at mission start all playable units.

9 Opfor units on the map at mission start all playable units, under which during gameplay, more Opfor units are spawned under each of these Team Leaders Command...

Bluefor names of units:

WestSlot1 through WestSlot10

Opfor names of units

E101, E201, E301, E401, E501, E601, E701, E801, E901

I'm trying to delete all bodies, whether they were in the mission at mission start, as well as those spawned in-mission.

Here is what I've been using, codewise:

Question:

Is this the right syntax here...


"O_Soldier_AR_F" createUnit [position E101, group E101,"E102R = this;UE102R = this addMPEventHandler ['MPkilled', {Null = _this execVM 'removeBody.sqf'}];", 0.2, "corporal"];

...to replace this code...


"O_Soldier_AR_F" createUnit [position E101, group E101,"E102R = this;", 0.2, "corporal"];
E102R addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

...which is part of the .sqs script below?

Grp1Update.sqs

? (Not(isServer)):exit;

?(G1Flg==1): goto "rtnG1Nxt";
~15

G1Flg=1;
publicvariable "G1Flg";

~2

hint "East Team 1 moving out!";

#rtnG1Nxt
"O_Soldier_AR_F" createUnit [position E101, group E101,"E102R = this;", 0.2, "corporal"];
E102R addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

~0.5

"O_Soldier_LAT_F" createUnit [position E101, group E101,"E103R = this;", 0.2, "corporal"];
E103R addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

~0.5

"O_Soldier_GL_F" createUnit [position E101, group E101,"E104R = this;", 0.2, "corporal"];
E104R addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

~0.5

"O_Soldier_F" createUnit [position E101, group E101,"E105R = this;", 0.2, "corporal"];
E105R addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

~0.5

"O_medic_F" createUnit [position E101, group E101,"E106R = this;", 0.2, "corporal"];
E106R addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

~0.5

"O_Soldier_AR_F" createUnit [position E101, group E101,"E107R = this;", 0.2, "corporal"];
E107R addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

~0.5

"O_Soldier_GL_F" createUnit [position E101, group E101,"E108R = this;", 0.2, "corporal"];
E108R addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

~0.5

"O_medic_F" createUnit [position E101, group E101,"E109R = this;", 0.2, "corporal"];
E109R addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

~2

[E102R,E103R,E104R,E105R,E106R,E107R,E108R,E109R] join grpNull;
[E102R,E103R,E104R,E105R,E106R,E107R,E108R,E109R] join EastG1;

Group E101 setGroupId ["Opfor 1"];

~2

Grp1Flg=1;
publicvariable "Grp1Flg";

@((!alive E102R)&&(!alive E103R)&&(!alive E104R)&&(!alive E105R)&&(!alive E106R)&&(!alive E107R)&&(!alive E108R)&&(!alive E109R))

Hint "East Group 1 has been wiped out!  They are requesting reinforcements!";

~5

Grp1Flg=0;
publicvariable "Grp1Flg";

exit;

Edited by harold5187

Share this post


Link to post
Share on other sites

You dont need all those MP event handlers and script executions to get rid of bodies.

put this in your init.sqf

_nul = spawn {

while {true} do {
  sleep 300; // You can change this to make this check faster or slower.
   { deleteVehicle _x } forEach allDead;
  };
};

Edited by Riouken

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  

×