Jump to content
Sign in to follow this  
Ace22

add/remove sling loading eh's (need help)

Recommended Posts

I'm looking for some help with adding/removing sling loading event handlers within safezones.

I don't want people to be able to sling load vehicles in a safe zone.

Should I use the rope attach, (thus people can still drop off vehicles, just not pick pick them up)

I'd like to incorporate into my safezone script which defines the safezone distances.

RopeAttach

Triggered when a rope is attached to an object.

In the case of sling loading, this event handler must be assigned to the helicopter and will trigger for each attached rope.

object 1: Object - Object to which the event handler is assigned.

rope: Object - The rope being attached between object 1 and object 2.

object 2: Object - The object that is being attached to object 1 via rope.

Will this work?

_EHaddsling = helicopter addEventHandler ["ropeAttach", object1]

_EHremovesling = helicopter removeEventHandler ["ropeAttach", object]

I know how to assign an eh to player, but if I want it to apply to all helicopters will using "helicopter" work? Does each helicopter type need to be listed?

Thoughts help would be greatly appreciated!!

Share this post


Link to post
Share on other sites

I think it would be easier to use enableRopeAttach on vehicles entering and exiting the zone rather than trying to use the eventHandlers.

Command works on both attaching and attached vehicles.

Share this post


Link to post
Share on other sites
I'm looking for some help with adding/removing sling loading event handlers within safezones.

I don't want people to be able to sling load vehicles in a safe zone.

Should I use the rope attach, (thus people can still drop off vehicles, just not pick pick them up)

I'd like to incorporate into my safezone script which defines the safezone distances.

RopeAttach

Triggered when a rope is attached to an object.

In the case of sling loading, this event handler must be assigned to the helicopter and will trigger for each attached rope.

object 1: Object - Object to which the event handler is assigned.

rope: Object - The rope being attached between object 1 and object 2.

object 2: Object - The object that is being attached to object 1 via rope.

Will this work?

_EHaddsling = helicopter addEventHandler ["ropeAttach", object1]

_EHremovesling = helicopter removeEventHandler ["ropeAttach", object]

I know how to assign an eh to player, but if I want it to apply to all helicopters will using "helicopter" work? Does each helicopter type need to be listed?

Thoughts help would be greatly appreciated!!

basically im assuming you already have a trigger, you could make it in the conditions that it should only detect helicopters within the area.

condition = this && ({_x isKindOf "Helicopter"} count thisList > 0)

then once the condition is met it will add the event handler, now since we want to deactivate it later we actually either need to make it setVariable'd or global variable which will not meet our needs so setVariable it is!

onActivation = { if ((_x isKindOf "Helicopter") && (_x getVariable ["ropeAttachEH",-1]) == -1) then { _ropeEH = _x addEventHandler ["ropeAttach",{ {(_this select 0) ropeDetach _x;}forEach ropes(_this select 0)}]; _x setVariable ["ropeAttachEH",_ropeEH,true]; } }forEach thisList;

and then finally we need to make the on Deactivation part which we simply remove the the eventhandler which we assigned as ropeAttachEH

onDeactivation = { if (!(vehicle player in thisList) && (vehicle player isKindOf "Helicopter") && ((vehicle player getVariable ["ropeAttachEH",-1]) != -1)) then { vehicle player removeEventHanlder ["ropeAttach",(vehicle player getVariable "ropeAttachEH")]; }; };

or as Fight9 said you could replace the eventHandler's and use enableRopeAttach

Edited by Lala14

Share this post


Link to post
Share on other sites

geeze, you guys are on the next level. thanks!

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  

×