Page tree
Skip to end of metadata
Go to start of metadata

Introduction

PlanView controls are used to display 2D layouts of buildings or vehicles.
These plans consists of image files that have been assigned to a model via its config file.
An object can have multiple plans associated with it: one for every room, every floor, or whatever the model designer saw appropriate.
If any units (players or AI) are currently inside one of the areas that are covered by the plans, they will be displayed dynamically (i.e. moving).
Displayed plans can be zoomed and panned by the user.
(Instructions on how to create and configure plans will be available in the developer reference.)

Related commands: Interactions - User Dialogs - PlanViews

Demo mission: PlanViewDemo.zip

Usage

Plans are always associated with one specific object (building or vehicle), and this object must be present in the mission, in order to display its plan.
The orientation of the plan is always the same - it depends on how it was originally created, and not how the associated object is oriented on the map.
The current plan is centered within the defined control dimensions, maximizing either the height or width, depending on the plan's proportions.
Some plan-related commands (planGetSectionCoords & planGetUnits) can ONLY be executed after the plan has been initialized via planViewSection, and a brief sleep; without this they may return nothing or even generate a syntax error.


Properties

Only properties unique to this control type are listed. For general properties, see the Properties page.

Properties
NameTypeRemark
typeIntegermust be 113 (or CT_SECTION_VIEWER, if using constants)
styleIntegeralways 0
unitDeadColorColorColor of dead units on map (non-functional).


Event Handlers

Several event handlers can be assigned to PlanViews (e.g. to detect when a unit enters or leaves a room, or when the user click a location on the plan). Check Reference List, and look for events that have a "scope" of "PV".

Example

Creates a simple dialog with a plan control, and cycles through the available sections when the player presses a button.
(Similar to example used in Dialog_Plan2.Intro, included with the PlanViewDemo.zip.)
description.ext:

class Dlg {
  idd = 20000;
  movingEnable = true;

  class controls {
    class PLAN {
      idc   = 20000;
      type  = 113;  // CT_SECTION_VIEWER
      style = 0;
      x     = .2; y = .13;
      w     = .6; h = .6;
    };
  };
};

display.sqf:

// available sections on plan
_sections = ["GroundFloor","FirstFloor","OutHouse"]; 

// open the dialog
createDialog "Dlg";
waitUntil {dialog};	

// and display the first section
_ctrl = (findDisplay 20000) displayCtrl 20000;
_ctrl planViewSection [house, _sections select 0, true];

// if <Arrow Up> is pressed, show the next section
_idx = 0;
waitUntil {
  if (isKeyPressed 0xC8) then {        // <Arrow Up> was pressed
    _idx = if (_idx==count _sections-1) then {0} else {_idx+1};  // increment the section index
    _ctrl planViewSection [house, _sections select _idx, true];  // show the new section
    waitUntil {!(isKeyPressed 0xC8)};  // wait until <Arrow Up> is released
  };
  !dialog
};