Fonctions utilitaires avancées - GdC-Framework/GdC_lib GitHub Wiki

Préambule

Dans cette section vous trouverez les fonctions intégrées dans GDC_lib prévues pour être intégrées dans des scripts. Elles s'adressent donc à ceux ayant une expérience dans le scripting.

Sommaire :

  1. GDC_fnc_createGroupCompo
  2. GDC_fnc_getInventoryBriefing
  3. GDC_fnc_getPositionsFromReference
  4. GDC_fnc_hasKindOfRadio
  5. GDC_fnc_posToGrid
  6. GDC_fnc_urlFetch
  7. GDC_fnc_urlFetchSimple
  8. GDC_fnc_waitUntilPlayerInMarker

Fonctions

GDC_fnc_createGroupCompo

/*
* Create a group composition
* 
* Parameters
* 0 - ARRAY of STRINGs and NUMBERs : possible classnames of units with indiviual weights for each class. Ex : ["classname1",0.8,"classname2",0.5,"classname3",0.5,"classnameN",0.2] or ["classname1",0.8],["classname2",0.5],["classname3",0.5],["classnameN",0.2](/GdC-Framework/GdC_lib/wiki/"classname1",0.8],["classname2",0.5],["classname3",0.5],["classnameN",0.2)
* 1 - NUMBER or ARRAY : number of units in the group. if ARRAY then [min,moy,max]
* 2 (optionnal) - STRING : classname of the leader (default="") if "" the leader can be any classes defined in 0
*
* Return : ARRAY of STRINGs : the new group composition
*/

Cette fonction vous permet de définir des groupes (array) de classnames d'unités. ATTENTION, cette fonction ne créée pas vos unités en jeu. Vous devrez donc soit utiliser Lucy (conseillé) ou le faire manuellement.

Exemple : [["B_soldier_AR_F", 0.2], ["B_Soldier_GL_F", 0.1], ["B_soldier_LAT_F", 0.1], ["B_Soldier_F", 0.5](/GdC-Framework/GdC_lib/wiki/["B_soldier_AR_F",-0.2],-["B_Soldier_GL_F",-0.1],-["B_soldier_LAT_F",-0.1],-["B_Soldier_F",-0.5), 8, "B_Soldier_TL_F"] call GDC_fnc_createGroupCompo;. Ici, on fait spawn un groupe de 8 unités dont le leader du groupe est de classname "B_Soldier_TL_F". La somme des poids ne pas obligatoirement égale à 1 (normalisée), néanmoins pour une clarté sur l'estimation de la composition du groupe il est conseillé de garder cette convention.

GDC_fnc_getInventoryBriefing

/*
	Author: TECAK, Mystery, Sparfell

	Description:
	get the string for fn_inventoryBriefing.sqf
		
	Parameter(s):
		OBJECT : unit we need the inventory from

	Returns:
	STRING : 
*/

Cette fonction retourne un texte contenant l'inventaire de l'unité prévue pour être montré dans un briefing. Exécutée en post-init chez tous les joueurs, elle peut être utilisée pour afficher l'inventaire d'une IA.

GDC_fnc_getPositionsFromReference

Eden seulement

/*
	Author: Shinriel

	Description:
	TO BE USED FROM EDEN!
	Use in the debug console in the editor to generate in your clipboard all units or objects, their type, their position and their azimute.

	["CUP_I_GUE_Soldier_AKM", [56.8,23.74,5.99855], 240.725]
	["CUP_I_GUE_Soldier_MG", [43.4,70.73,6.0013], 71.0722]
	["billboard", [15.1,66.27,10.75], 193.479]


	To point the right object, you should debug this: "nearestobject screenToWorld getMousePosition;"
	And execute the method "call GDC_fnc_getPositionsFromReference"

	Parameter(s):
	nothing

	Returns:
	nothing
*/

GDC_fnc_hasKindOfRadio

/*
	Author: Sparfell

	Description:
	Check if player one of the specified types of radios including those mounted on vehicle racks
	Same as acre_api_fnc_hasKindOfRadio but with racks compatibility

	Parameter(s):
		STRING OR ARRAY[string] - radio classes

	Returns:
	BOLEAN

	Example :
	["ACRE_PRC117F","ACRE_PRC77"](/GdC-Framework/GdC_lib/wiki/"ACRE_PRC117F","ACRE_PRC77") call GDC_fnc_hasKindOfRadio
	["ACRE_PRC148"] call GDC_fnc_hasKindOfRadio
*/

GDC_fnc_posToGrid

/**
 * @name posToGrid
 * Extend mapGridPosition command engine for X digits grid map.
 * 
 * @param {object, group, location, array, string} [_object = player].
 * @param {number} [_number_digits = 3], Number of grid coordinates ("_number_digits" digits for each axis), 6 digits max.
 * @param {string} [_separator = ""], Symbol used to separate the x-grid and y-grid coordinates.
 *
 * @returns {string} grid coordinates.
 *
 * @author Migoyan, based on Karel Moricky's function BIS_fnc_gridToPos (For recovering offsets part).
 */

Le séparateur peut être de longueur ou symbole voulue (UTF-8).

Exemple : [player, 3, '-'] call GDC_fnc_posToGrid; retournera XXX-YYY.

GDC_fnc_urlFetch

/*
	Description:
		Make a call to an url
		[URL, { Function }] call GDC_fnc_urlFetch;

	Author & Source: http://killzonekid.com/arma-scripting-tutorials-url_fetch-callback/

	Parameter(s):
		0 : URL
		1 : Callback ( parameters [_fromUrl, _result] )

	Returns:
		string: Return nothing
*/

GDC_fnc_urlFetchSimple

/*
	Description:
		Make a call to an url
		http://127.0.0.1 call GDC_fnc_urlFetch;

	Parameter(s):
		0 : URL

	Returns:
		string: Return the result of the url call
*/

GDC_fnc_waitUntilPlayerInMarker

/*
	Description:
		Preset for a waitUntil, usesful to create a trigger that wait for players on a marker

		To be call from only one source. You could call it from HC ou server for example.

		[] spawn {
			["_mkr_objective_1"] call GDC_fnc_waitUntilPlayerInMarker;
			// Do what you want, when player are in the area
		};

	Parameter(s):
		0 : STRING - Marker area where the player have to go
		1 : (OPTIONAL) NUMBER - Time to wait between 2 checks

	Returns:
		Nothing
*/