Skip to content

Instantly share code, notes, and snippets.

@Benargee
Last active January 17, 2016 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Benargee/848e57cd3cba2c57cc73 to your computer and use it in GitHub Desktop.
Save Benargee/848e57cd3cba2c57cc73 to your computer and use it in GitHub Desktop.
BIS_fnc_taskHint fix
/*
Author: Jiri Wainar
Revised by: Benargee
Description:
Display a task hint.
Parameters:
_this select 0: STRING - Task name
_this select 1: STRING - Task state (optional)
Returns:
True if successful, false if not.
*/
#include "defines.hpp"
private ["_taskID","_taskVar","_taskReal","_state","_type","_cfgTaskType"];
_taskID = [_this,0,"",[""]] call BIS_fnc_param;
_taskVar = _taskID call bis_fnc_taskVar;
if (isNil{GET_DATA_NIL(_taskVar,ID)}) exitwith {["Task '%1' does not exists.",_taskID] call bis_fnc_error; false};
_state = [_this,1,_taskID call bis_fnc_taskState,[""]] call BIS_fnc_param;
_taskReal = [_taskID,player] call bis_fnc_taskReal;
if (_taskReal in simpletasks player) then
{
private["_notificationSuffix"];
_type = GET_DATA(_taskVar,TYPE);
_taskTypeTexture = "";
if (missionNamespace getVariable ["bis_taskEnhancements_enable",false]) then
{
_cfgTaskType = [["CfgTaskTypes",_type],configFile >> "CfgTaskTypes" >> "Default"] call bis_fnc_loadClass;
_taskTypeTexture = getText(_cfgTaskType >> "icon");
};
_notificationSuffix = "";
if !(isNil "BIS_taskNotificationSuffix") then {_notificationSuffix = BIS_taskNotificationSuffix}; //used for custom notifications
if (_taskTypeTexture != "") then
{
["task" + _state + _notificationSuffix + "Icon",[_taskTypeTexture,GET_DATA(_taskVar,TITLE) select 0]] call bis_fnc_shownotification;
}
else
{
["task" + _state + _notificationSuffix,[GET_DATA(_taskVar,DESCRIPTION),GET_DATA(_taskVar,TITLE) select 0,GET_DATA(_taskVar,MARKER)]] call bis_fnc_shownotification;
};
};
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment