Jump to content

Recommended Posts

Hey!

 

Quick question. I'm trying to set up a mission that uses ALICE 2 to spawn civs and traffic, but I don't want the player to be able to hitch a free ride off of them, as all the vehicles spawned are unlocked. How can I change this so they're all locked at spawn? Thanks!

Share this post


Link to post
Share on other sites

SILVIE is the random vehicles module, which I only assume you are using.

 

It has an optional variable to set the init for each vehicle it creates.  The variable is code {} and the only parameter passed into it is the created vehicle, referred to in the code as _this.  The code is run by the server.

 

- Put this in the editor module's init field:

this setVariable ["vehicleinit", {_this lock true}];

 

- Or in a server script that created the logic ("SILVIElogic" being reference to the module logic):

SILVIElogic setVariable ["vehicleinit", {_this lock true}];

Share this post


Link to post
Share on other sites
18 hours ago, opusfmspol said:

SILVIE is the random vehicles module, which I only assume you are using.

 

It has an optional variable to set the init for each vehicle it creates.  The variable is code {} and the only parameter passed into it is the created vehicle, referred to in the code as _this.  The code is run by the server.

 

- Put this in the editor module's init field:

this setVariable ["vehicleinit", {_this lock true}];

 

- Or in a server script that created the logic ("SILVIElogic" being reference to the module logic):

SILVIElogic setVariable ["vehicleinit", {_this lock true}];

Does ALICE 2 incorporate SILVIE for its vehicles? If so then yeah, I am. Thanks for your advice, will try it out!

Share this post


Link to post
Share on other sites
11 hours ago, zeroip said:

Does ALICE 2 incorporate SILVIE for its vehicles?

 

Hmmm... apparently not.  SILVIE creates empty cars.  It looks like ALICE2 creates its own vehicles for civilians to drive around in, apart from SILVIE.  It doesn't have a custom init for the vehicles.  It has custom init from the logic, and custom init for towns but both get applied to the civilians being created.

 

When a driver is created, the custom inits run on the driver before being placed in the vehicle.  But if a vehicle has cargo seating, a passenger is created and placed in the vehicle before the passenger's custom inits run.  That could help.

 

Putting this in the Alice2 module "init" field might work:

this setVariable ["ALICE_civilianinit",[{if (vehicle _this != _this) then {(vehicle _this) lock true;};}]];

 

When the passenger is created, they lock the car.

 

Edited by opusfmspol
Revised code block after testing

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

×