Jump to content
Sign in to follow this  
r3v0ltz

ForcePos objects?

Recommended Posts

I am trying to figure out how to get the ForcePos to work with objects. I read some of the strings and that on the createVehicle wiki, but it doesn't go into detail about ForcePos.

My issue is that I sometimes have players who knock certain objects away from where they originally are, what I mean by that is I have Sign stands setup to be used as a shop system, but some players will take vehicles and knock them down or away from the area.

Would ForcePos stop them from knocking them down? How would I go about making this work?

This is what I have it as

_vehicle_23094 = objNull;
if (true) then
{
_this = createVehicle ["Infostand_2_EP1", [4057.35, 11662.7, 0.000128174], [], 0, "CAN_COLLIDE"];
_vehicle_23094 = _this;
_this setDir 207.046;
_this setPos [4057.35, 11662.7, 0.000128174];
forcePos = true;
};

Share this post


Link to post
Share on other sites

forcePos doesn't appear here, google doesn't give anything related either, what exactly are you referring to?

You might be able to use attachTo with a "HeliHEmpty" (invisible object) vehicle to achieve what you want (I thought initially that it would've disabled clipping altogether but apparently not (quite; try for yourself)). Or set the position in OnEachFrame or a regular loop.

Edited by geqqo
Posting went odd and kind of doubleposted

Share this post


Link to post
Share on other sites
forcePos doesn't appear here, google doesn't give anything related either, what exactly are you referring to?

You might be able to use attachTo (effectively disables any clipping at all for the object) with a "HeliHEmpty" (invisible object) vehicle to achieve what you want. Or set the position in OnEachFrame or a regular loop.

---------- Post added at 22:46 ---------- Previous post was at 22:41 ----------

forcePos doesn't appear here, google doesn't give anything related either, what exactly are you referring to?

You might be able to use attachTo (effectively disables any clipping at all for the object) with a "HeliHEmpty" (invisible object) vehicle to achieve what you want. Or set the position in OnEachFrame or a regular loop.

https://resources.bisimulations.com/w/index.php?title=createVehicle

createVehicle [type,position,markers,placement,special,local,asl,noClip,symbol,forcePos]

I have this set now

_vehicle_23102 = objNull; //Bandit
if (true) then
{
 _this = createVehicle ["Infostand_2_EP1", [1623.8, 7800.66, 0.00140381], [], 0, "CAN_COLLIDE", false, false, false, "", true];
 _vehicle_23102 = _this;
 _this setDir -239.602;
 _this setPos [1623.8, 7800.66, 0.00140381]; 
};

But the object wont appear anymore.

Share this post


Link to post
Share on other sites

You are referring to the VBS wiki, this functionality doesn't appear in createVehicle_array (the Arma 2 version).

attachTo applied to your code (preserving usage of the two different variables that you are using for the vehicle) would look something like the following:

_vehicle_23094 = objNull;
_this = createVehicle ["HeliHEmpty",[4057.35, 11662.7, 0.000128174],[],0,"CAN_COLLIDE"];
_this setDir 207.046;
_vehicle_23094 = createVehicle ["Infostand_2_EP1", [4057.35, 11662.7, 0.000128174], [], 0, "CAN_COLLIDE"];
_vehicle_23094 attachTo [_this,[0,0,0.9]];
_this = _vehicle_23094;

Edited by geqqo
Added example

Share this post


Link to post
Share on other sites
You are referring to the VBS wiki, this functionality doesn't appear in createVehicle_array (the Arma 2 version).

attachTo applied to your code (preserving usage of the two different variables that you are using for the vehicle) would look something like the following:

_vehicle_23094 = objNull;
_this = createVehicle ["HeliHEmpty",[4057.35, 11662.7, 0.000128174],[],0,"CAN_COLLIDE"];
_this setDir 207.046;
_vehicle_23094 = createVehicle ["Infostand_2_EP1", [4057.35, 11662.7, 0.000128174], [], 0, "CAN_COLLIDE"];
_vehicle_23094 attachTo [_this,[0,0,0.9]];
_this = _vehicle_23094;

It works!

Now how do I make it so that its just on the ground instead of it being a little above it?

My guess would be editing the z coord in the attachto?

Edited by R3V0LTZ

Share this post


Link to post
Share on other sites
My guess would be editing the z coord in the attachto?

That's right (in my quick test case it looked quite ok), or you can go a step further and use worldToModel and modelToWorld

_vehicle_23094 attachTo [_this,_this worldToModel (_vehicle_23094 modelToWorld [0,0,0])];//Not using the modelToWorld/worldToModel in either case caused some inconsistencies

If I look really close, it actually still seems a little off ground (good enough though).

EDIT: Viba's solution below is naturally much simpler :D

Edited by geqqo

Share this post


Link to post
Share on other sites
That's right (in my quick test case it looked quite ok), or you can go a step further and use worldToModel and modelToWorld

_vehicle_23094 attachTo [_this,_this worldToModel (_vehicle_23094 modelToWorld [0,0,0])];//Not using the modelToWorld/worldToModel in either case caused some inconsistencies

If I look really close, it actually still seems a little off ground (good enough though).

EDIT: Viba's solution below is naturally much simpler :D

Yeah my infostand keeps disappearing on server restart.

Share this post


Link to post
Share on other sites

What kind of exact code/solution are you currently using?

It happens only on restart (so it's okay the first time the server's started)?

Where/how are you calling this?

Share this post


Link to post
Share on other sites

I think it might be due to is a player hits the infostand with a vehicle or a bike it will disappear on server restart.

Calling it from server_functions.sqf using

call compile preProcessFileLineNumbers "\z\addons\dayz_server\bankzones\banks.sqf";

Here is my banks file

_vehicle_23092 = objNull; // Stary
if (true) then
{
_this = createVehicle ["Infostand_2_EP1", [6324.71, 7787, 0.00143433], [], 0, "NONE"];
_vehicle_23092 = _this;
_this setDir 244.89;
_this setPos [6324.71, 7787, 0.00143433];  
};

_vehicle_23094 = objNull; //Bash
if (true) then
{
_this = createVehicle ["Infostand_2_EP1", [4057.35, 11662.7, 0.000128174], [], 0, "NONE"];
_vehicle_23094 = _this;
_this setDir 207.046;
_this setPos [4057.35, 11662.7, 0.000128174]; 
};

_vehicle_23096 = objNull; //Klen
if (true) then
{
 _this = createVehicle ["Infostand_2_EP1", [11461, 11348.6, 0.00143433], [], 0, "NONE"];
 _vehicle_23096 = _this;
 _this setDir 132.225;
 _this setPos [11461, 11348.6, 0.00143433];
};

_vehicle_23098 = objNull; //Air
if (true) then
{
 _this = createVehicle ["Infostand_2_EP1", [12063.9, 12636, 0.0584259], [], 0, "NONE"];
 _vehicle_23098 = _this;
 _this setDir 190.5211;
 _this setPos [12063.9, 12636, 0.0584259];
};

_vehicle_23100 = objNull; //Hero
if (true) then
{
 _this = createVehicle ["Infostand_2_EP1", [12944.4, 12766.1, 0.00157166], [], 0, "NONE"];
 _vehicle_23100 = _this;
 _this setDir 4.05031;
 _this setPos [12944.4, 12766.1, 0.00157166];
};

_vehicle_23102 = objNull; //Bandit
if (true) then
{
 _this = createVehicle ["Infostand_2_EP1", [1623.8, 7800.66, 0.00140381], [], 0, "NONE"];
 _vehicle_23102 = _this;
 _this setDir -239.602;
 _this setPos [1623.8, 7800.66, 0.00140381];
};

Share this post


Link to post
Share on other sites

As to why they would disappear on server restart, can't really tell as I would expect none of the previous info to carry over. Server restart shouldn't be any different from the first start, if it's a full mission restart from the lobby.

Probably unrelated but if that's the full file in its literal form then the if(true) checks and using a _this variable wouldn't seem to be necessary.

Share this post


Link to post
Share on other sites
As to why they would disappear on server restart, can't really tell as I would expect none of the previous info to carry over. Server restart shouldn't be any different from the first start, if it's a full mission restart from the lobby.

Probably unrelated but if that's the full file in its literal form then the if(true) checks and using a _this variable wouldn't seem to be necessary.

I'll try getting rid of that and seeing if it fixes it or not.

Share this post


Link to post
Share on other sites

They don't spawn when I get rid of if (true) .

Share this post


Link to post
Share on other sites

_vehicle_23094 = objNull;
if (true) then
{
_this = createVehicle ["Infostand_2_EP1", [4057.35, 11662.7, 0.000128174], [], 0, "CAN_COLLIDE"];
_vehicle_23094 = _this;
_this setDir 207.046;
_this setPos [4057.35, 11662.7, 0.000128174];
};

---->

_vehicle_23094 = createVehicle ["Infostand_2_EP1", [4057.35, 11662.7, 0.000128174], [], 0, "CAN_COLLIDE"];
_vehicle_23094 setDir 207.046;
_vehicle_23094 setPos [4057.35, 11662.7, 0.000128174];

Share this post


Link to post
Share on other sites

Enable simulation worked perfectly well for me.

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  

×