Jump to content

Recommended Posts

I want to start a mission straight into the virtual arsenal. I'm creating a story-based mission and I want the player to create his/her character before it all begins. I don't want the player to look at a box and select the aresenal. I want them to spawn into the arsenal, one time only.

 

I also want to:

  • pause the scripted events at the mission start while the player is in the arsenal.
  • give the player objectives and waypoints.
  • display text on screen and dialogue from NPCs.
  • speak to NPCs, conversation wheels, which trigger events such as spawning, objectives and waypoints.
  • delete unwated NPCs and objects.

 

Its been a few years since I worked with ArmA. Could somebody point me in the right direction?

Share this post


Link to post
Share on other sites

To open the arsenal on startup use this in the init.sqf (SP) or initPlayerLocal.sqf (MP & SP):

waitUntil {isPlayer player};
sleep 1; // Anything less will spawn you as a random unit (WTF?)
["Open",true] spawn BIS_fnc_arsenal;

 

2 hours ago, mikemhz said:
  1. pause the scripted events at the mission start while the player is in the arsenal.
  2. give the player objectives and waypoints.
  3. display text on screen and dialogue from NPCs.
  4. speak to NPCs, conversation wheels, which trigger events such as spawning, objectives and waypoints.
  5. delete unwated NPCs and objects.
  1. What are those scripted events? on first guess I'd use conditions to suspend other scripts.
  2. The task system is what you are looking for. Also addWaypoint for waypoints
  3. cutText
  4. addAction for each topci (or a GUI just because I'm a big fan of those)
  5. Depends on what you want to achieve. There is already a system (Garbage Collector) ingame.

Share this post


Link to post
Share on other sites

Thanks, that helped a ton!

As regards #1, I want the player to take control during an evolving scenario, in the presence of enemies in a position to attack, directly after leaving the arsenal. But I don't want anything to happen while the player is in the arsenal.

Share this post


Link to post
Share on other sites

So I could change the game time to be very slow in the init.sqf

 

But how to execute code when the player closes the arsenal.

Share this post


Link to post
Share on other sites

Here is a topic about detecting wether the arsenal is opened or closed: 

 

On 21.12.2014 at 11:48 PM, Larrow said:

There are likely lots of ways you can accomplish this BL1P.

Using the uiNameSpace variable BIS_fnc_arsenal_cam will tell you whether the arsenal is open or not, its objNulll if its not open.

How to check for this could also be written slightly differently dependent on how/where your calling the arsenal in the first place e.g from an ammo box, player action or from inventoryOpened.

Heres some code from a quick test. It checks via an onEachFrame, its stacked ID is added to the player in a variable called "VAcatch" just incase you maybe want to turn the stacked event off (no sense checking for arsenal ever frame if the only place you can use it is while your back at base). It also checks to see if the player has changed their uniform and reapplies their insignia. Not thoroughly checked but should give you something to go from..

 


player setVariable [ "VAcatch", [ "VAcatch", "onEachFrame", {
if ( !( isNil { _this getVariable "VAcatch" } ) && { !( isNull ( uiNamespace getVariable [ "BIS_fnc_arsenal_cam", objNull ] ) ) } ) then {
	_this setVariable [ "VAcatch", nil ];
	_thread = _this spawn {
		_uniform = uniform _this;
		waitUntil { isNull ( uiNamespace getVariable [ "BIS_fnc_arsenal_cam", objNull ] )  };
		_faction = _this getVariable [ "Faction", nil ];
		if ( _uniform != uniform _this && { !( isNil "_faction" ) } ) then {
			[ _this, _faction ] call BIS_fnc_setUnitInsignia;
		}; 
		_this setVariable [ "VAcatch", "VAcatch" ];
	};
}; 
}, player ] call BIS_fnc_addStackedEventHandler ];
 

 

As i said above there are likely better ways to implement this based on what you actually need but the above serves as a catch all example.

 

A more simple but fragile approach woul be this one:

waitUntil {!isNull findDisplay -1};
systemChat "ARSENAL";
waitUntil {isNull findDisplay -1};
systemChat "NO ARSENAL";

The problem is that the arsenal has no IDD and therefore might as well interfere with other displays which share the same IDD (-1). However the code works ¯\_(ツ)_/¯.

 

Or even better:

waitUntil {! (isNull ( uiNamespace getVariable [ "BIS_fnc_arsenal_cam", objNull ] ))  };
// ARSENAL
waitUntil { isNull ( uiNamespace getVariable [ "BIS_fnc_arsenal_cam", objNull ] )  };
// NO ARSENAL

Detects when the arsenal is closed. 

Share this post


Link to post
Share on other sites

I'm using something similar:

 

!isNull (uiNamespace getVariable ["RscDisplayArsenal", displayNull])

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

×