Home   Help Search Login Register  

Author Topic: Need a script to remove ( or hide ) bodies  (Read 1047 times)

0 Members and 1 Guest are viewing this topic.

oneillcol

  • Guest
Need a script to remove ( or hide ) bodies
« on: 10 Sep 2002, 16:38:48 »
Anybody know of a script to remove ( or hide ) infantry bodies ( but not destroyed tanks or jeeps ) when the player has moved 500m away from the "battle area", without specifically naming each unit in the script........ is such a thing possible!!

red devil

  • Guest
Re:Need a script to remove ( or hide ) bodies
« Reply #1 on: 11 Sep 2002, 19:31:05 »
I need this to cos.... I just do ok, God whats with all the questions

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Need a script to remove ( or hide ) bodies
« Reply #2 on: 11 Sep 2002, 22:20:28 »
The only way I can think of doing this is by having arrays with the infantry units stored in them.  See if this works for you.

1. In the initialization field of each leader of each squad, put variations of the following code:

squad1 = units group this

Where squad1 is the name of the array you want to use for an individual squad.  So, for example, you might have squad1, squad2, squad3, and squad4 for your arrays, if you only had 4 squads.  Use whatever names you prefer.

2. Make a trigger with a 500m radius and give it a condition of west not present.

3. In the trigger's activation field, put the following code:

[squad1,squad2,squad3,squad4] exec "deleteBodies.sqs"

Where squad1 through squad4 are example arrays, as per step 1.  Again, replace with whatever array names you really use.

4. Create the "deleteBodies.sqs" script.  Put the following code in your script:


; Assign the read-in squad arrays to a local variable.

_squads = _this

_n = count _squads

; Initialize an array that will contain all of the units to check.

_units = []

; The following loop consolidates the units of the read-in squads into one array.

#Loop

_n = _n - 1

_units = _units + (_squads select _n)

? _n > 0 : goto "Loop"

_i = count _units

; The following loop checks if each unit is dead, and if so, it deletes it.

#DeleteUnits

_i = _i - 1

? not alive (_units select _i) : deleteVehicle (_units select _i)

? _i > 0 : goto "DeleteUnits"

Exit


Note: there may be an easier way to do this, but this is the only way I know how.
Ranger