OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started 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.
-
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
-
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
-
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?- You can call VD in the init line of an object and it will be issued on all machines, making things "just work".
- Calling viewDistance <x> in the mission's init.sqs will do the same since it is run on all machines
- One can imagine having different view distances for different players. Classic example: high VD for pilots, lower for grunts.
- AI:s are affected by the view distance, so don't forget to issue it on the (possibly dedicated) server too
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.
; 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!
-
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