Jump to content
Sign in to follow this  
mandoble

Object placement problem

Recommended Posts

The problem:

You place a building in the editor, then you pickup several objects and place them inside a building using objectname setPos [x,y,z]. For example a table in the second floor of the building, a chair near the table, a telephone over the table, etc.

Then you play the mission and everything seem ok. But, you change the terrain detail level, terrain elevations change and some of your objects are suddenly flying or sunk into the floor.

Is there any fix to this effect?

Share this post


Link to post
Share on other sites

This problem was spotted during the beta testing of Abandoned Armies. THobson could only find one cure for the problem.. forcing the terrain detail to normal.

Share this post


Link to post
Share on other sites

That is, a constant setTerrainGrid 12.5 command being executed every second, for example.

Thanks.

Share this post


Link to post
Share on other sites

It is generally not a good idea to hard code the setTerrainGrid command. Someone with a low end machine might not be able to play your mission. Avoid placing items in buildings that are on slopes?

Share this post


Link to post
Share on other sites

The lodge in Abandoned Armies was on a very shallow slope, but it would raise into the sky and sink into the ground anyway. It was alos the most CPU intensive mission for OFP I've ever heard of.... So if THob can do it, why not others?

Share this post


Link to post
Share on other sites

That lodge is containing only a table with a radio and a mash gabinet, right? It was only that building the reason to lock terrain grid resolution?

Share this post


Link to post
Share on other sites

if your mission param1 or param2 allows for selecting different terrain grids, then you can use that variable value to define the setpos locations for those specific items.

eg

if(param1 == 12.5)then{setTerraingrid 12.5;ObjectA setpos [getpos ObjectB select 0, getpos ObjectB select 1,3.2]}else{SetterainGrid 6.25; ObjectA setpos [getpos ObjectB select 0, getpos ObjectB select 1,3.7]}

3.2 and 3.7 being the height settings required for the differing set terraingrids

you may find that you need to split the setteraingrid command and the object setpos command into different lines, to give the engine some time, eg 2 or 3 seconds, to remap the island prior to placement of the object

Share this post


Link to post
Share on other sites

I see no clear way to:

1 - Check wich terrain grid is being used by the player.

2 - Allow the player to select a terrain grid as a parameter just before the intro of the mission starts (objects are placed) so that objects are placed depending on this setting.

Share this post


Link to post
Share on other sites

Using a dialog menu to select the player's terrain setting and a lot of if's in a script that camCreates the wanted objects...

And yes, I believe THobson did lock the terraingrid for that one object. At least, I only saw pictures of the lodge in the air, no other buildings.

Share this post


Link to post
Share on other sites

Maybe you should setpos the objects relative to the house in all three axes. Some extra work yes but not too bad if you have only a few objects.

Share this post


Link to post
Share on other sites
I see no clear way to:

1 - Check wich terrain grid is being used by the player.

2 - Allow the player to select a terrain grid as a parameter just before the intro of the mission starts (objects are placed) so that objects are placed depending on this setting.

<span style='color:red'><< DESCRIPTION.EXT >>></span>

titleParam1 = "Terrain Detail";

valuesParam1[] = {6.25,12.5,25};

defValueParam1 = 12.5;

textsParam1[] = {"High","Normal","Low"};

<span style='color:red'><<< INIT.SQS >>></span>

setteraingrid param1

~2

if(Param1 == 6.25) then {<span style='color:blue'>run my setpos code for that terrain grid setting</span>}

if(Param1 == 12.5) then {<span style='color:blue'>run my setpos code for that terrain grid setting</span>}

if(Param1 == 25) then {<span style='color:blue'>run my setpos code for that terrain grid setting</span>}

example of

<span style='color:blue'>run my setpos code for that terrain grid setting</span>

as seen in my above post

NB>> All clients + server should run the same terrain grid, if not the ai and / or other players will behave in a way you dont want,

eg if you have a high level terrain detail and another player has a low level, himself or his ai will be able to shoot you, because on his client, the land will be smooth and to him, you will not be hiding in dead ground, also this will defintely create desync

Share this post


Link to post
Share on other sites

This may sound like a dumb question but how a player can choose between parameter values before the intro starts in SP missions?

Share this post


Link to post
Share on other sites

sorry didnt realise it was SP, u need to use a dialog system then

Share this post


Link to post
Share on other sites
Guest

Hello, would like to ask in this thread what exactly would be the proper force terrain detail for 'normal' setting? I looked into Thobsons Abandoned Armies scripts and couldnt find it to refere to.

The proper way to input this then would be 'setTerrainGrid number' then also, and have it loop executing every second, correct?

Share this post


Link to post
Share on other sites
Quote[/b] ]1 - Check wich terrain grid is being used by the player.

If the amount the object is displaced by, reamins the same each time you run your mission. Then you should be able to detect and adjust for the current terrain detail.

Oh, just in case you don't know. There is a bug with GetPos and static objects. It won't return an accurate value, so be carefull if you want to set something relative to a buildings position.

Share this post


Link to post
Share on other sites
Guest

edit// oops sorry, thought previous post was directed towards my question.

moving on

Share this post


Link to post
Share on other sites
Hello, would like to ask in this thread what exactly would be the proper force terrain detail for 'normal' setting? I looked into Thobsons Abandoned Armies scripts and couldnt find it to refere to.

The proper way to input this then would be 'setTerrainGrid number' then also, and have it loop executing every second, correct?

no you dont need to reloop setteraingrid, you run that piece of code once in the INIT.sqs at the start of the mission

Share this post


Link to post
Share on other sites

If you run this only once, and then the player changes this setting from OPF video options while in the game, terrain elevations will change with the corresponding effect in your already placed objects.

Share this post


Link to post
Share on other sites
Guest
If you run this only once, and then the player changes this setting from OPF video options while in the game, terrain elevations will change with the corresponding effect in your already placed objects.

Thanks, I figured that was the case. Can anyone tell me what the proper terraingrid setting number is that is equal to the 'normal' setting?

Share this post


Link to post
Share on other sites

Video options for terrain detail are:

very low, low, normal, high and very high.

Valid terrain grids for setTerrainGrid are:

50 (very low), 25 (low), 12.5 (normal), 6.25 (high) and 3.125 (very high).

Share this post


Link to post
Share on other sites
Guest

Great. Thanks Mandoble.

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  

×