Jump to content
  • 0

Can you toggle a variable (dome) on and off during gameplay? (Mouse-Wheel Menu)


DY357LX

Question

I've added the dome script from dayz.st to a few Admin bases and it's working fine.

I use the custom base that MaxPowers made as my base and think it would be a good location for an invade-type-event.

(Players have 1 hour to get in, grab the loot and get out. Whilst the Admins defend or the other players get into a free-for-all.)

 

Is it possible to alter the dome code so that a mouse-menu can switch on and the dome or does this kind of stuff in ArmA 2 require a restart?

 

Something like AxeCop's starter box code:

if ((getPlayerUID player) in ["12345678"]) then { // list of admin UID's who can use the script
	if (_canDo && (speed player <= 1)) then {
		if (s_player_domeOn < 0) then {
			s_player_spawnBox = player addaction [("<t color=""#007ab7"">" + ("Dome ON") +"</t>"),"scripts\domeOn.sqf","",5,false,true,"",""];
		};
	} else {
		player removeAction s_player_domeOn;
		s_player_domeOn = -1;
	};
};

Annoyingly, I have a good idea how to do all this in C++ but can't get my head around ArmA 2's use of variables.

 

Any ideas are welcome! Thanks!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

If i understood you correctly, there is an easy way to do this, by setting values ON the player.

Example:

if ((getPlayerUID player) in ["12345678"]) then { // list of admin UID's who can use the script
    if (_canDo && (speed player <= 1)) then {
    _loadDome = player getVariable["LoadDome", false]; //Is dome loaded or not (default value is false)
    if (s_player_domeOn < 0) then {
         if( !_loadDome ) then {
            s_player_spawnBox = player addaction [("<t color=""#007ab7"">" + ("Dome ON") +"</t>"),"scripts\domeOn.sqf","",5,false,true,"",""];
         } else {
            s_player_spawnBox = player addaction [("<t color=""#007ab7"">" + ("Dome OFF") +"</t>"),"scripts\domeOff.sqf","",5,false,true,"",""];
         };
    };
    } else {
        player removeAction s_player_domeOn;
        s_player_domeOn = -1;
    };
};

    Then somewhere on the top of domeOn.sqf you put:

_player = _args select 0;
_player setVariable["LoadDome", true, false]; // Ok dome is up, disable the ON selection in the menu, and enable the OFF

Now, i dont know what you are doing in your domeOn.sqf, but i guess your domeOff.sqf would just do the opposite stuff :)

Also add this to your domeOff.sqf

_player = _args select 0;
_player setVariable["LoadDome", false, false]; // Ok dome is down

IF you dont have a domeOn or domeOff sqf and you just made that up hoping to make the script....my guess would be that you need to 'make' a trigger (sensor) in your On script that will have all the dome code in it, and then in your Off script you delete that sensor.

I am not sure if arma allows you to make sensors on the fly...like it does with vehicles. I dont think there should be a problem...but i'd rather wait for a more experienced person to answer that :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...