deleteVehicle: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 31: Line 31:
'''Example:'''
'''Example:'''


'''deleteVehicle''' tankOne
'''deleteVehicle''' tankOne




'''Comments:'''
'''Comments:'''


*Since this function will not delete a player unit, a useful multiplayer application is the removal of AI created by players leaving the game.  If you run '''deleteVehicle''' for every playable soldier, the AI units will be removed.
*Since this function will not delete a player unit, a useful multiplayer application is the removal of AI created by players leaving the game.


*If ''unit1'' is a living unit that is currently located inside a vehicle then
If you run '''deleteVehicle''' for every playable soldier, the AI units will be removed.
'''deleteVehicle''' ''unit1''
will result in some very strange, and unwelcome, things happening. A safe way to delete ''unit1'' if it is, or might be, inside a vehicle is:


[[unassignVehicle]] ''unit1''
*If ''unit1'' is a living unit that is currently located inside a vehicle then:
''unit1'' [[setPos]] [0,0,0]
'''deleteVehicle''' ''unit1''
'''deleteVehicle''' ''unit1''
will result in some very strange, and unwelcome, things happening.
 
A safer way to delete ''unit1'' if it is, or might be, inside a vehicle is:
 
 
[[unassignVehicle]] ''unit1''
 
''unit1'' [[setPos]] [0,0,0]
 
'''deleteVehicle''' ''unit1''
 
 
*You need have no concern over attempting to access deleted units in subsequent scripts.


*You need have no concern over attempting to access deleted units in subsequent scripts.<br>
The line below works just fine for units that have been deleted.
The line below works just fine for units that have been deleted.
[[if]] ([[alive]] ''unit1'') [[then]] {[[hint]]"He is alive"} [[else]] {[[hint]]"Oh no he's not"}
 
[[if]] ([[alive]] ''unit1'') [[then]] {[[hint]]"He is alive"} [[else]] {[[hint]]"Oh no he's not"}

Revision as of 11:41, 4 July 2006


deleteVehicle object


Operand types:

object: Object

Type of returned value:

Nothing

Compatibility:

Added in version 1.34

Description:

Delete any unit or vehicle.

Only vehicles inserted in editor or created during mission can be deleted.

Player unit cannot be deleted.


Example:

deleteVehicle tankOne


Comments:

  • Since this function will not delete a player unit, a useful multiplayer application is the removal of AI created by players leaving the game.

If you run deleteVehicle for every playable soldier, the AI units will be removed.

  • If unit1 is a living unit that is currently located inside a vehicle then:

deleteVehicle unit1 will result in some very strange, and unwelcome, things happening.

A safer way to delete unit1 if it is, or might be, inside a vehicle is:


unassignVehicle unit1

unit1 setPos [0,0,0]

deleteVehicle unit1


  • You need have no concern over attempting to access deleted units in subsequent scripts.

The line below works just fine for units that have been deleted.

if (alive unit1) then {hint"He is alive"} else {hint"Oh no he's not"}