Script for small command map HUD?

Hi all,
does anyone know a good script that produces a small map on the hud, much like the command center map but without entering the command screen (and become paralized).

thanks in advance :)

Comments

  • edited April 2014
    Check http://www.chaingunned.org/sling/index.php for all your scripting needs. just search for .vl2 or .cs if you want to browse entire sites collection

    Copy to notepad change extension to .cs and put in base/scripts/autoexec folder

    First four lines of script have the controls for zoom and moving the map, just change those to whatever keybind you prefer if default does't work for you.
    // #name = borCCMap
    // #version = 1.2
    // #date = October 26, 2002
    // #author = borlaK|RT
    // #email = borlak@borlak.org
    // #web = http://www.borlak.org
    // #description = CommandMap HUD display on playgui.  Focuses on you, turns on sensors while in vehicles.  Use + and - on keypad to zoom, and shift+ and shift- to resize.  You have to go into CC once before this will work.
    // #status = working
    
    moveMap.bindCmd( keyboard, numpadadd, "CommanderMap.cameraMove(in, true);", "commanderMap.cameraMove(in, false);" );
    moveMap.bindCmd( keyboard, numpadminus, "CommanderMap.cameraMove(out, true);", "commanderMap.cameraMove(out, false);" );
    
    moveMap.bind( keyboard, "shift numpadminus", borDecreaseHudSize);
    moveMap.bind( keyboard, "shift numpadadd", borIncreaseHudSize);
    
    
    function borCCMapToggle(%val)
    {
    	if(!$borCCMapInit)
    	{
    		new ShellFieldCtrl(borCCHud) {
    			profile = "GuiChatBackProfile";
    			horizSizing = "left";
    			vertSizing = "top";
    			position = "785 520";
    			extent = "200 200";
    			minExtent = "8 8";
    			visible = "0";
    		};
    
    		playGui.add(borCCHud);
    		if(isObject(HudMover))
    			hudmover::addhud(borCCHud, "Commander Map");
    		$borCCMapInit = 1;
    	}
    
    	if(CommanderMapGui.firstWake)
    	{
    		clientCmdBottomPrint("You must go into the CC screen before this will work.", 3, 2);
    		return;
    	}
    	
    	if(%val)
    	{
    		$borCCHudOn = !$borCCHudOn;
    		borCCHud.visible = $borCCHudOn;
    		if($borCCHudOn)
    			borOpenCCHud();
    		else
    			borCloseCCHud();
    	}
    }
    
    function borCloseCCHud()
    {
    	borCCHud.remove(CommanderMap);
    	CommanderMapGui.add(CommanderMap);
    	CommanderMap.position		= "0 0";
    	CommanderMap.extent		= $borCCHudDefaultExtent;
    	CommanderMap.rendertext		= $borCCHudDefaultrendertext;
    	CommanderMap.minIconSize	= $borCCHudDefaultminIconSize;
    	CommanderMap.iconProjLen	= $borCCHudDefaulticonProjLen;
    }
    
    function borOpenCCHud()
    {
    	CommanderMapGui.remove(CommanderMap);
    	borCCHud.add(CommanderMap);
    	CommanderMap.position		= "3 3";
    	CommanderMap.extent		= getword(borCCHud.extent, 0) - 6 SPC getword(borCCHud.extent, 1) - 6;
    	CommanderMap.rendertext		= 0;
    	CommanderMap.minIconSize	= 30; // 20 default
    	CommanderMap.iconProjLen	= "35.0"; // 20 default}
    }
    
    function borWatchLastTarget()
    {
    	CommanderMap.followLastSelected();
    }
    
    function borIncreaseHudSize(%val)
    {
    	if(%val && borCCHud.visible)
    	{
    		borCCHud.extent		= getword(borCCHud.extent, 0)+25 SPC getword(borCCHud.extent, 1)+25;
    		CommanderMap.extent	= getword(borCCHud.extent, 0) - 6 SPC getword(borCCHud.extent, 1) - 6;
    	}
    }
    function borDecreaseHudSize(%val)
    {
    	if(%val && borCCHud.visible)
    	{
    		borCCHud.extent		= getword(borCCHud.extent, 0)-25 SPC getword(borCCHud.extent, 1)-25;
    		CommanderMap.extent	= getword(borCCHud.extent, 0) - 6 SPC getword(borCCHud.extent, 1) - 6;
    	}
    }
    
    package borCCMap {
    
    function GuiCommanderMap::onSelect(%this, %targetId, %nameTag, %typeTag, %select)
    {
    	if(%select)
    	{
    		$borCCMapTargetID = %targetId;
    		CommanderTV.watchTarget(%targetId);
    	}
    	parent::onSelect(%this, %targetId, %nameTag, %typeTag, %select);
    }
    
    
    function CommanderMapGui::onWake(%this)
    {
    	if($borCCHudOn)
    		borCloseCCHud();
    	parent::onWake(%this);
    }
    
    function CommanderMapGui::onSleep(%this)
    {
    	if(!$borCCHudDefaultExtent)
    	{
    		$borCCHudDefaultExtent		= CommanderMap.extent;
    		$borCCHudDefaultrendertext	= CommanderMap.rendertext;
    		$borCCHudDefaultminIconSize	= CommanderMap.minIconSize;
    		$borCCHudDefaulticonProjLen	= CommanderMap.iconProjLen;
    	}
    
    	if($borCCHudOn)
    		borOpenCCHud();
    
    	parent::onSleep(%this);
    }
    
    function clientCmdSetDefaultVehicleKeys(%inVehicle)
    {
    	parent::clientCmdSetDefaultVehicleKeys(%inVehicle);
    	passengerKeys.bindCmd( keyboard, numpadadd, "CommanderMap.cameraMove(in, true);", "commanderMap.cameraMove(in, false);" );
    	passengerKeys.bindCmd( keyboard, numpadminus, "CommanderMap.cameraMove(out, true);", "commanderMap.cameraMove(out, false);" );
    	passengerKeys.copyBind( moveMap, borCCMapToggle );
    
    	if(%inVehicle)
    		CommanderMap.rendersensors = 1;
    	else
    		CommanderMap.rendersensors = 0;
    }
    
    function OptionsDlg::onWake(%this)
    {
    	if(!$borCCMapSelect)
    	{
    		$RemapName[$RemapCount] = "CCMap HUD";
    		$RemapCmd[$RemapCount]  = "borCCMapToggle";
    		$RemapCount++;
    		$borCCMapSelect = true;
    	}
    	parent::onWake(%this);
    }
    
    };
    activatePackage(borCCMap);
    
    callback.add(PlayerSpawn, "borWatchLastTarget();");
    
  • Thanks. Very nice code.
Sign In or Register to comment.