Jump to content
Sign in to follow this  
cobra4v320

Using configname in a hint format

Recommended Posts

I am randomly spawning groups using BIS_fnc_spawngroup and would like them to show up in a hint format when they spawn in. Ive played around with this for a while and cannot get it to funciton.

waituntil {!isnil "bis_fnc_init"};

_WestSquad 	= ["US_DeltaForceTeam","US_WeaponsSquad","US_RifleSquad","US_Team"];
_unit 		= player;
_westHQ		= CreateCenter West;
_infgrp 	= CreateGroup West;

private ["_name","_infgrp"];

if (isServer) then {

_infgrp = [(getpos _unit), side _unit, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Infantry" >> _westSquad select (random count _westSquad))] call BIS_fnc_spawnGroup;

_name = getText (configFile >> "cfgGroups" >> "West" >> "BIS_US" >> "Infantry" >> _infgrp >> "displayName");


hint format ["There is a %1 enroute to your location.", _name];

};

Edited by cobra4v320

Share this post


Link to post
Share on other sites

I keep getting the error: error >>: type group expected string

Share this post


Link to post
Share on other sites

At first glance I think you need to pick your group type from _WestSquad first, then use that value in both the spawning the and _name = part.

Share this post


Link to post
Share on other sites

waituntil {!isnil "bis_fnc_init"};

_WestSquad = ["US_DeltaForceTeam","US_WeaponsSquad","US_RifleSquad","US_Team"];

_unit = player;

_westHQ = CreateCenter West;

_infgrp = CreateGroup West;

private ["_name","_infgrp"];

if (isServer) then {

_squadType = _westSquad select (random count _westSquad);

_infgrp = [(getpos _unit), side _unit, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Infantry" >> _squadType)] call BIS_fnc_spawnGroup;

_name = getText (configFile >> "cfgGroups" >> "West" >> "BIS_US" >> "Infantry" >> _squadType >> "displayName");

hint format ["There is a %1 enroute to your location.", _name];

};

Is there a displayName config for these groups?

Share this post


Link to post
Share on other sites

Not sure but if they dont that would make sense as to why this isnt working. I looked under the config.bin and did not see anything.

Edited by cobra4v320

Share this post


Link to post
Share on other sites

Yeah, in my example it's returning an empty value (maybe null/nil, didn't check. :P)

Share this post


Link to post
Share on other sites

Yeah your example works but it doesnt show the group name. I will keep scratching my head and try to come up with something that works. :j:

---------- Post added at 03:21 AM ---------- Previous post was at 03:04 AM ----------

I figured it out, I just totally removed the (configFile >> "CfgGroups" and use

_WestSquad = ["US_DeltaForceTeam","US_WeaponsSquad","US_RifleSquad","US_Team"];

_infgrp = [(getpos _veh), side _unit, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Infantry" >> _westSquad select (random count _westSquad))] call BIS_fnc_spawnGroup;

_squadType = _westSquad select (random count _westSquad);

hint format ["There is a C130 enroute with %1 units",_squadtype];




Share this post


Link to post
Share on other sites

You generate two different random numbers when spawning the group and displaying the hint, suggest you assign the random number to a variable at start and then use the variable in those two lines.

You could also create a second array for the hint if you don't like using the classname in it.

Share this post


Link to post
Share on other sites
You generate two different random numbers when spawning the group and displaying the hint, suggest you assign the random number to a variable at start and then use the variable in those two lines.

That's what my rewrite did. :)

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
Sign in to follow this  

×