Jump to content
Sign in to follow this  
SWIFT88

Event handlers

Recommended Posts

I want to attach a vehicle to another vehicle however Im having issues doing this, all i want to do is have the second vehicle turn up with the first on loading

ive got the event handlers ready but nothing is coming from it

From config

class EventHandlers

{

init = "[_this select 0]exec""\CVRT\shar.sqs""";

};

from shar.sqs

_This vehicle select=0

_vehicle = "Rear" createvehicle [0,0,0]

exit

hope you can help

cheers

Share this post


Link to post
Share on other sites

Take a minute and think about your shar.sqs script again. The first line doesnt really make sense, and the second creates your rear-vehicle at the position [0,0,0]. The init-event is executed on all connected machines in a multiplayer game, that means that multiple rear-vehicles will be created per front?-vehicles in a mp game.

It should be more like this, shouldn't it?

private["_pos","_vehicle"];
if(isServer) then {

[indent]_pos = getPos (_this select 0);
_vehicle = "Rear" createVehicle _pos;[/indent]


};
exit;

Share this post


Link to post
Share on other sites

class DefaultEventhandlers;

class EventHandlers : DefaultEventhandlers

{

init = "_this exec ""\CVRT\shar.sqs"" ";

};

from shar.sqs

_a = _this select 0

_vehicle = "Rear" createvehicle (getPos _a)

exit

"_this exec ""\CVRT\shar.sqs"" ";

_this already is an array including the vehicle.

Where and how do you add the Event Handler? May there is something wrong far bevore adding it.

I really don't understand, what you are trying to do with this?

In the "shar.sqs" you are creating something at position [0,0,0]

Try

hint str _a

to get a debug showing you that the script was executed or not.

Share this post


Link to post
Share on other sites

You need to use the attachTo command. Now you are just creating (or trying to) something at the world position [0,0,0] (top left corner of the map). I think you are trying to do this...

_vehicle = _this select 0

_rear_end = "Rear" createvehicle (getpos _vehicle)

_rear_end attachTo [_vehicle,[0,0,0]]

That requires you have defined a vehicle class "Rear" (in CfgVehicles).

Share this post


Link to post
Share on other sites

An use XEH to avoid breaking compatibility. :)

Share this post


Link to post
Share on other sites

I'm inserting it into the CFG vehicles,

Its basically a object that I want to add on the rear of a vehicle

Share this post


Link to post
Share on other sites

First better try doing this with a script and in the editor.

Check the position of where you like to attach the object and then go to config scripting.

Trying to do this by config editing and with not the needed scripting skills may is a waste of time.

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
Sign in to follow this  

×