Jump to content
Sign in to follow this  
chronicsilence

Making objects non-interactable

Recommended Posts

I have an object that I would like to make non-interactable. It's a light source (specifically the construction cone with light), and I need to keep it so that the light still works (i.e. enableSimulation false is not an option) but it can't be moved or destroyed. If you put the allowDamage false on it, the light still stops blinking if you shoot it and it can still get knocked over.

I also need to make sure that it doesn't become a rigid structure that things can hit. What I really need is a way to just make everything, including bullets and grenade shockwaves, go through it. Is there any command to do such a thing, that won't have a horrendous performance impact?

Share this post


Link to post
Share on other sites

I'm sure there's some witty command / way out there. In the mean time, you could always store the position of the cone. If it's moved from the position or "hit" by a projectile such as a bullet, have it either delete the cone and create a new one at the correct position, or have it reposition the cone back into the correct spot. disableCollisionWith command may also come in handy. Though idk if it will work with a road cone.

Share this post


Link to post
Share on other sites

The cone still gets knocked over though with the handleDamage EH. Unless I'm missing the point of the OP. I think he wants the cone to not be able to be knocked over.

---------- Post added at 14:30 ---------- Previous post was at 14:28 ----------

In any case, I may as well post my most shitty work around.

cone init:

_nul = [this] execVM "cone.sqf";

cone.sqf

_rc = _this select 0;
_rcPos = getPosATL _rc;

while {true} do {
   waitUntil {_rc distance _rcPos > 0};
   deleteVehicle _rc;
_rc = createVehicle ["RoadCone_F", _rcPos, [], 0, "CAN_COLLIDE"]; 
sleep 1;
};

---------- Post added at 14:42 ---------- Previous post was at 14:30 ----------

Or maybe you can make clever use of the HIT eventHandler. Whenever the object is hit by a projectile, move it back into position and set it's vector (incase it was knocked down). Though I don't believe getting runover counts as getting "hit"? Not sure. Or you could have a global cone cleanup loop. Which would automatically delete all cones and create new ones at their positions once every <insert time here>

Edited by Iceman77

Share this post


Link to post
Share on other sites

Try this:

Call your cone: cone1

cone1 enableSimulation false;

Then run this script:


_pos = getPosATL cone1;

while {true} do
{
_light = "#lightpoint" createVehicle _pos;
_light setLightBrightness 0.7;
_light setLightAmbient[0.001, 0.0007, 0];
_light setLightColor[1, 0.7, 0];
_light lightAttachObject [cone1, [0,0,0.24]];
_light setLightFlareMaxDistance 400;
_light setLightDayLight false;
_light setLightIntensity 1000;
_light setLightUseFlare true;
_light setLightAttenuation [0, 1, 1, 1];
sleep 1;
deleteVehicle _light;
sleep 1;
};

It's not exactly the same, but it's pretty close. You can play with the numbers to suit your taste.

Your cone should now be a ghost, but still emitting light!

Share this post


Link to post
Share on other sites

I miss read that bit.

this addEventHandler ["handledamage",{(_this select 0)  setCenterOfMass [[0,0,-0.4],3],0}]; // self righting cone

or

gl being the name of a game logic placed somewhere on the map

this addEventHandler ["handledamage",{0}];
this attachto [gl];

Share this post


Link to post
Share on other sites
Attachto the cone to an invisible helipad.

Nice and simple - like it :)

EDIT: It's funny seeing all the different ways of thinking coming up with 9 ways to skin a cat :)

Share this post


Link to post
Share on other sites
Attachto the cone to an invisible helipad.

brilliant lol

---------- Post added at 15:06 ---------- Previous post was at 14:57 ----------

this addEventHandler ["handledamage",{(_this select 0) setCenterOfMass [[0,0,-0.4],3],0}]; // self righting cone

Ahh that's really clever. Nice one.

@ the OP - Either one of these suggestions is better than what Das and I suggested IMO. Less loops = good.

Edited by Iceman77

Share this post


Link to post
Share on other sites
Attachto the cone to an invisible helipad.

That sounds interesting. How do I create an invisible helipad though, and attach something to it?

Share this post


Link to post
Share on other sites

AttachAttachti is cone attachTo [heli, pos]; I believe that is it anyway and invisible heli I don't know.

Share this post


Link to post
Share on other sites

Use of attachto is in post six, the heli pad is in the editor under signs. I used a game logic myself but the result is the same.

You don't need the position for this sort of attach the object will remain in place. you can attach multiple objects to the same logic or heli pad.

multiple attach method c1 refers to the name you give each cone.

my_pad would be the name you give the pad

{_x addEventHandler ["handledamage",{0}];_x attachto [my_pad]} foreach [c1,c2,c3,c4,c5,c6];

If you still want then to remain working when shot I think you will still need the eventhandler.

If you have more than a few cones you would be better using nearest objects to find them

I don't have the actual road cone type at hand but when you place a cone you should see the name in the top right of the smaller editor.

Just repace xxxxx with the correct name.

{
_x addEventHandler ["handledamage",{0}];
 _x attachto [my_pad]
 } foreach (nearestobjects [my_pad,["xxxxxxxxxx"],100] );

that should find all cones within 100 meters of the pad or game logic.

Edited by F2k Sel

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  

×