deleteVehicle: Difference between revisions
No edit summary |
No edit summary |
||
Line 46: | Line 46: | ||
'''deleteVehicle''' ''unit1'' | '''deleteVehicle''' ''unit1'' | ||
(3) If you '''deleteVehicle''' ''unit1'' you cannot use ''unit1'' later in commands like '''? alive''' ''unit1'' ''': hint "he's alive"''', it will cause a Crash to Desktop. So you have to ask '''? isNull''' ''unit1'' ''': exit''' before using any command (this goes especially for addon scripts). | (3) If you use '''deleteVehicle''' ''unit1'' you cannot use ''unit1'' later in commands like '''? alive''' ''unit1'' ''': hint "he's alive"''', it will probably cause a Crash to Desktop. So you have to ask '''? isNull''' ''unit1'' ''': exit''' before using any command (this goes especially for addon scripts). |
Revision as of 16:38, 20 May 2006
deleteVehicle object
Operand types:
object: Object
Type of returned value:
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:
(1) 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.
( 2) 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 safe way to delete unit1 if it is, or might be, inside a vehicle is:
unassignVehicle unit1
unit1 setPos [0,0,0]
deleteVehicle unit1
(3) If you use deleteVehicle unit1 you cannot use unit1 later in commands like ? alive unit1 : hint "he's alive", it will probably cause a Crash to Desktop. So you have to ask ? isNull unit1 : exit before using any command (this goes especially for addon scripts).