OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: CAS_Daniel on 21 Apr 2008, 21:11:47

Title: Setviewdistance and setterrain
Post by: CAS_Daniel on 21 Apr 2008, 21:11:47
Hi,
Evolution has an action menu option at the start that allows the player an option to change some settings while they're in the hanger.
I'd like something similar for my training island.
I've found the script that sets the options but I can't find anything to do with making the option appear in the hanger.

Anyone else looked at this or know a good way of letting players set their own terrain/viewdistance in MP?

Cheers,

Daniel
Title: Re: Setviewdistance and setterrain
Post by: Rommel92 on 22 Apr 2008, 01:09:16
I can't see why you couldn't do it via an action menu, or a dialog. Just play around with execution parameters of the script you found. And or wait till I get home and I'll make a funky little dialog (I need it too  :yes:) with some options... question is.

What other options should there be?

SetViewDistance - SetTerrain

Any others....???
Title: Re: Setviewdistance and setterrain
Post by: Shadow.D. ^BOB^ on 22 Apr 2008, 11:57:10
If need be take a look at the latest BAS_f mission templates, one of the scripts included is the viewdistance.

http://www.ofpec.com/forum/index.php?topic=31182.0
Title: Re: Setviewdistance and setterrain
Post by: CAS_Daniel on 22 Apr 2008, 19:15:42
At the moment i'm just thinking a simple action menu option at the starting point of the mission with setterrain for people that can't handle the grass, and setviewdistance for pilots. Can't really think of any others off the top of my head.
Cheers Shadow, i'll look into that, and Rommel, an example mission would be awesome.  :D

Cheers guys.
Title: Re: Setviewdistance and setterrain
Post by: Rommel92 on 27 Apr 2008, 20:49:30
Sorry for the delay mate, wasn't sure if you still wanted it, but as requested.
The dialog is from the dialog framework by Dr Eyeball, but its been modified specifically for a mission of mine, and with a small amount of editing it suited the basic functions of yours. A simple copy paste of everything in that folder to your mission should work. (You may have to edit in if it overrides files)

Regards,
Romm.
Title: Re: Setviewdistance and setterrain
Post by: CAS_Daniel on 28 Apr 2008, 00:31:44
Awesome mate, much appreciated! I'll give it a spin now.  :)

EDIT: Works perfectly, can't seem to get it to remove the action after a set time though. Just want the action menu to be available at the start of the mission.

Cheers,
Dan
Title: Re: Setviewdistance and setterrain
Post by: Rommel92 on 28 Apr 2008, 21:00:26
Change the "scripts\init.sqf"
Code: [Select]
/* If (isServer) exitwith {}; Change when uploading to a Dedicated server. */
waitUntil {!(isNull player)};

_action = player addAction ["My Status", "Scripts\PopupMenu\ActivatePopupMenuViaAction.sqf", [], 0, false, false, "teamSwitchPrev"];
sleep 60.0;
player removeAction _action;

 ;)
Title: Re: Setviewdistance and setterrain
Post by: CAS_Daniel on 29 Apr 2008, 18:08:15
Ah, nice one Romm! All sorted now.  :)
Title: Re: Setviewdistance and setterrain
Post by: Spooner on 29 Apr 2008, 18:30:40
You can tell whether you are on a dedicated server, so you don't have to do:
Code: [Select]
/* If (isServer) exitwith {}; Change when uploading to a Dedicated server. */

Instead, try:
Code: [Select]
// Exit on a dedicated server, but not on an SP or hosted server.
if (isServer and (isNull player)) exitwith {};

In SP or hosted games, the value of player on the server is set correctly at the very start of the mission, but on an MP server it is always null. Remember that this method is only valid at time == 0, since after that, the server-player could be dead (so player may, or may not, be null after this time).

On an MP client, player is initially null, but is set correctly when the player syncs.