clearVehicleInit – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search

Are the effects of this command global or local? --ViperMaul 11:54, 25 June 2007 (CEST)

Seems to be local to me. The vehicle's local init string is deleted, remote versions of the same string are not affected. --Ceeeb 13:56, 17 February 2009 (CET)

Should this be run before a vehicle is deleted? --Doolittle 21:01, 13 July 2007 (CEST)

No, no need for that. --raedor 10:52, 14 July 2007 (CEST)

Example error

The example used, is incorrect as far as my tests show. It should be:

tank1 setVehicleInit "hint 'hi all'"; clearVehicleInit tank1; processInitCommands;

clearVehicleInit, clears the pending init commands, not those already processed. Once the init commands are processed, they can not be removed. Even if the vehicle is killed or deleted.

It might also be worth noting that the timing of processed init commands during JIP means any functions loaded by init.sqf and certain commands like player. Will fail, unless the user intervenes with some sort of conditional loop or delay beforehand.

My usual disclaimer applies, this was tested using a dedicated server running on the same machine as the client. So I may be wrong if it's running on a proper remote, dedicated server. UNN 13:31, 16 July 2007 (CEST)

This is true on all dedicated servers in JIP. A simple waituntil is required if array/variable setup is done by init.sq[f|s]. Salisan

I'm going to assume the "clears the pending init commands" is true; in this case the command is never safe to use because another thread can invoke processInitCommands at any time. You should instead be holding off on actually executing setVehicleInit until the last moment, when you're sure that's what you want. --MaHuJa 13:59, 23 March 2012 (CET)