Jump to content
Sign in to follow this  
meatball

Redefine unit name/group on trigger fire?

Recommended Posts

Short of it is I have a mission where certain ingame and end game triggers are set using player unit names and player group name. If players go unconscious and are not revived (using the BTC Revive script) they respawn in a detention center. I've already figured out how to remove all gear/weapons/etc., but I can't figure out how to change peoples group and unit name.

Related question. For troubleshooting purposes, is there a variable name I can call using hints to show me what the unit name/group membership is of something?

Share this post


Link to post
Share on other sites

Why would you change the name of the player or their group?

You can use something like:

player sideChat format["My unitID is %1 and my groupID is %2", player, groupID group player];

Share this post


Link to post
Share on other sites

you mean unit names like "Rifleman AT (Xyberviri)" if thats the case then you need to change the playable model to another one like how they do in dayz. however your going to have issues

As far as changing group membership you create the new group first then joinsilent the player to the new group.

_newGroup = createGroup (side player); //create a new group on side (in this case players side)
player joinSilent _newGroup;

now for changing the "name" its always going be along the lines of "<unit type> (player name)" you need create a new unit and then select it a working example of this can be found here: https://dev-heaven.net/projects/clanbase-aas/repository/revisions/master/entry/core/cb_aas_20_ChernarusTemplate.Utes/changePlayerModel.sqf

username guest pw guest

it would be easier to just select a unit with a more generic description. There might be a way to override what the name of your cursor target is but honestly i haven't ever tried

Share this post


Link to post
Share on other sites
Why would you change the name of the player or their group?

I'm not looking to actually change the character type/model, just the dummy name you can give a unit in the editor and refer to in scripts/triggers. Reason being I have things like helicopter pickups triggered to take off only if playername is dead or playername is on board. For example where b1-b6 are the players

((!alive b1) or (b1 in heli)) and ((!alive b2) or (b2 in heli)) and ((!alive b3) or (b3 in heli)) and ((!alive b4) or (b4 in heli)) and ((!alive b5) or (b5 in heli)) and ((!alive b6) or (b6 in heli));

If I don't change the players name, the helicopter will never lift back off because b1 or b3 is sitting in the detention center.

I have similar issues with the captured players having their same group name, and when I say groupname, I mean the groupname I set in their init with "groupname=group this". I have scripts (spunFin's ambient combat and reinforcement heli scripts, Nomadd's SLP Spawning scripts, etc) that will key around a specific group name that the players all start in. I don't want that stuff popping up near the prison, but just around the still alive/un-captured players.

Edited by MeatballCB

Share this post


Link to post
Share on other sites

Easy fix is to have players fly transport and not AI. :) Or get rid of silly things like detention centers, no one likes sitting around while others get to play. xy's idea of changing groups would probably be best. Just have playerGroup = group this; in your player's init. Create prisonGroup group for people who are sitting around doing nothing and move players into there.

Then have your helicopter change to:

{alive _x && _x in heli} count units playerGroup == {alive _x} count units playerGroup

That'll wait for all alive members of playerGroup to be in the heli.

Share this post


Link to post
Share on other sites

Excellent. Do I even need to create the group first? Wouldn't setting a trigger for the first person in the prison "prisoners = group this" automatically create the prisoners group?

And I totally agree about forcing players to not sit in a prison. My mission allows people unlimited revives, assuming another player in the group can revive them, and they have 10 minutes to revive fallen team members, but if the whole platoon gets wiped out, the mission is over. Granted, the chance of some people getting knocked unconscious and not revived in 10 minutes while other players are still up is slim, but it could happen.

Share this post


Link to post
Share on other sites
Wouldn't setting a trigger for the first person in the prison "prisoners = group this" automatically create the prisoners group?

Ideally you'd create it in the init.sqf or somewhere like placing a unit on the map with this init:

prisoners = group this; deleteVehicle this;

That'll create the group and you can just

[player] joinSilent prisoners;

when they die.

Share this post


Link to post
Share on other sites

Alright, still having issues with this. Have a unit in a group. When the player 'dies' they get teleported into a holding area. I added a trigger to the holding area on entry that does the following.

{newgroup = group _x} foreach thislist;

I created two triggers to hint me the count of the oldgroup and the newgroup. Before I go into the trigger, count of the oldgroup is 1, count of the newgroup is scalar.

After I go into the trigger, count of oldgroup and newgroup are 1...

How do I force it so the unit not only joins the newgroup, but leaves the oldgroup?

Share this post


Link to post
Share on other sites

Why bother with triggers? Just use a killed MPEventHandler or onPlayerKilled.sqf script to join them to the prisoners group and whatever else.

Share this post


Link to post
Share on other sites

Mainly because I've just started mission editing and don't have the slightest idea on how to use onPlayerKilled.sqf when I'm using BTC Revive scripts :) I'll see if I can figure out how to merge it together.

---------- Post added at 00:00 ---------- Previous post was at 22:56 ----------

Yeah, I figured out an easier way to handle all this. Threw a repeating trigger into the holding area that activates on BluFor and sets the player captive. Then it was just a simple matter of rewriting any of my 'final' checks that looks for remaining team members escaping to:

{_x in heli} count units groupname == {alive _x and !captive _x} count units groupname;

Edited by MeatballCB

Share this post


Link to post
Share on other sites

Something along the lines of :-

OnAct:

handle = [thisTrigger] spawn {
jailGroup = createGroup west;
_trig = _this select 0;
_groupList = [];
while {triggerActivated _trig} do {
	_list = +(list _trig);
	{
		if (!(_x in _groupList)) then {
			_x setVariable ["oldGroup", group _x];
			_groupList set [count _groupList, _x];
			[_x] joinSilent jailGroup;
		}
	}forEach _list;
	{
		if (!(_x in _list)) then {
			_groupList = _groupList - [_x];
			[_x] joinSilent (_x getVariable "oldGroup");
		};
	}forEach _groupList;
};
};

OnDeact:

deleteGroup jailGroup;

May need a little rearranging depending on what you need, creates a group on the first person entering the trigger, if a person leaves they are rejoined to their old group, deletes and cleans up the created group if no one is in the trigger.

Share this post


Link to post
Share on other sites

I'll try that too.

Edited by MeatballCB

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  

×