OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: DOA on 13 Feb 2005, 00:55:06

Title: "SetViewDistance" 2 questions.
Post by: DOA on 13 Feb 2005, 00:55:06
How can I use the "SetViewDistance" to set the view distance in my custom made missions? Where do you place this command?  What is the proper syntax?

Thanks.
Title: Re:"SetViewDistance" 2 questions.
Post by: oyman on 13 Feb 2005, 01:44:34
you can put in in the Init of any vehicle or soldier

the code is

this setviewdistance x

x= your desired viewing distance

so like

this setviewdistance 2000
Title: Re:"SetViewDistance" 2 questions.
Post by: General Barron on 13 Feb 2005, 03:47:15
Quote
this setviewdistance x
Not quite. You don't pass an object to the command, only a number:

setviewdistance x

This sets the maximum distance the player can see on his screen. I'm not sure if it has any effect on the AI. You can put that line in any place that you would normally put script-lines: init fields, "on activation" fields (of triggers/WPs), scripts, etc.

Keep in mind that if the player has resistance, then he can manually adjust the viewdistance himself (by going into his video options), even after you set it with this command.

Check here for the com ref entry:
http://www.ofpec.com/COMREF/index.php?action=details&id=322

EDIT

I see this was posted in the MP board, so I assume you want to know how it works in MP. I believe the viewdistance will be the same for all players, but I could be mistaken. There is a script here that automatically negotiates the VD for MP:
http://ofpec.com/editors/resource_view.php?id=473
Title: Re:"SetViewDistance" 2 questions.
Post by: Killswitch on 13 Feb 2005, 06:09:17
I see this was posted in the MP board, so I assume you want to know how it works in MP. I believe the viewdistance will be the same for all players, but I could be mistaken. There is a script here that automatically negotiates the VD for MP:
http://ofpec.com/editors/resource_view.php?id=473
viewDistance is "one of those commands".  Old man locality again ;)

The effect of a viewDistance call is local to the machine where it is issued.

What does that mean for MP mission editing?Example of how do do #3 above, different VD for different player roles. Imagine there being a bunch of normal foot soldier player slots and two pilot slots. The playable pilots are named "CASPilot" and "SARPilot" in the mission editor.
Code: [Select]
; init.sqs
; View distance is 900 m by default in MP. We'll use 1000 for grunts and 2000 for pilots here
_vdist = 1000

? player in [CASPilot, SARPilot]: _vdist = 2000

setViewDistance _vdist

Good luck!
Title: Re:"SetViewDistance" 2 questions.
Post by: DOA on 13 Feb 2005, 06:57:40
Thank you gentlemen, outstanding replies.  Yes I wan to set he VD longer in a MP mission for pilots. Being able to set a greater view distance for seperate players is great. Thank you all...DOA