Adding a vehicle init

shinkicker

Administrator
Staff member
Hi F0rd,

Within the arma editor there is an 'init' that can be used where you can exec sqf scripts. Do you know of an equivalent for vehicles in DayZ?
 
you can use setVehicleInit and processInitCommands


Still trying to figure out the cleanest part to place these? Does rocket use inherent Arma classes for vehicle repairs and interaction that comes up from addAction?

I need to do something like follows:

Vehicle Init:


this setVariable ["InitState", false, true];
this addAction ["ActionOne", "my_script.sqf", ["Do Action One"], 51, false, true, "", "!(_target getVariable 'InitState')"];
this addAction ["ActionTwo", "my_other_script.sqf", ["Do Action two"], 50, false, true, "", "(_target getVariable 'InitState')"];

Which config.cpp would you recommend I run my setvehicleinit from?
 
sorry. i test setVehicleInit. it work only once. after rejoin - do not work...

That's what I figured would be the difficult part, making it persist. Perhaps this would need a servers side change, as I would expect that something in dayz_server parses the objects tables and then runs createvehicle to spawn the objects within the mission. Perhaps I could hook the setVehicleInit there somewhere.

On work laptop now, will have a look later.
 
Hmm, this one is tough.

I was going to an DefaultEventhandlers for the 'land' vehicle class


class DefaultEventhandlers;

class CfgVehicles
{
class AllVehicles;

class Land;

class LandVehicle : Land
init = <my init>
};
};
};

But that overwrites all of the existing EH's. I might give this a try:

http://www.armaholic.com/page.php?id=2605

Strike that out, its in CBA.

https://dev-heaven.net/projects/cca/wiki/Extended_Eventhandlers

I will drop sickboy a message see if he thinks its viable.

That will stop me overwriting all the CA stuff.

What do you think?
 
XEH work , but it only workaround (again). also, must be on clientside too.
 
No need for client side, since all vehicles are created on the server side (except the local ones).

No, he is right CBA needs to be both client and server side or it stil overwrites the event handler. Source: One of the CBA devs.
 
Have you made any progress here Shinkicker?

I'm trying to make all air units be first person only.
It's next to impossible without a vehicle init!!!
 
I think this is achievable now looking back on this with a bit more experience.

You could do this:

Lets say the model is called InGameClass, inherit it to a new class as follows


class InGameClass_DZ : InGameClass {
class EventHandlers
{
init="<your_statement>";
};
};

You could test it out with just one.

If you want to amend the orginal classes, this is a little more tricky as you will overwrite all of the arma default event handlers. To do that you need to CBA it seems:

http://opendayz.net/index.php?threads/adding-a-vehicle-init.91/#post-835



If this is no good (as it would need every to use the new class names (*_DZ), then
 
Back
Top