Jump to content
Sign in to follow this  
TechnoTerrorist303

Joinsilent problem, or is it something else?

Recommended Posts

I need a system that forces any player entering an a10 to join a specific group. I have an eventhandler on the plane that says if anyone gets in then it should run a script called a10groups.sqf.

I know the script is running because it spawns an officer in front of me. What I am not sure of is why the rest of it doesn't work.

caspilotgroup = creategroup west;
bpf1 = "usmc_Soldier_Officer" createunit [getMarkerPos "Bob", caspilotgroup];
bpf1 leader caspilotgroup;

array = _this;
_vehicle = _this select 0;
_position = _this select 1;
_man = this select 2;
_man joinsilent caspilotgroup;

I have probably cocked this up majorly but any help would be much appreciated.

Share this post


Link to post
Share on other sites

I cant see what _this refers to, but try

_man = _this select 2;
[_man] joinsilent caspilotgroup;

Note both the _ before this select 2 and the [] around _man. (IIRC its ''array' join 'group/unit'')

Share this post


Link to post
Share on other sites

sorry, should have posted clearer the first time...

casGROUP = this addEventHandler ["getin", {_this execvm 'a10groups.sqf'}];

is in the init line of an a10

caspilotgroup = creategroup west;
bpf1 = "usmc_Soldier_Officer" createunit [getMarkerPos "BOB", caspilotgroup];
bpf1 leader caspilotgroup;

array = _this;
_vehicle = _this select 0;
_position = _this select 1;
_man = _this select 2;
[_man] joinsilent caspilotgroup;

Is the code but it still doesn't work...

Share this post


Link to post
Share on other sites

1. The version of createUnit that you are using doesn't return anything, so the variable "bfp1" is not getting assigned to anything. Use the createUnit (array) version instead.

2. The leader command does not assign the leader of a group; it merely returns it, so it is of no use to you here. Bfp1 (once he's been created properly) should become the de facto leader of the group anyway because all members will be of equal rank and he joined first, but if for some reason he doesn't, set his rank higher using setRank.

Share this post


Link to post
Share on other sites

Do you mean to spawn a new guy each time it's run?

This works though:

Init of A-10:

this addEventHandler ["GetIn", {_this execVM "boardA10.sqf"}];

boardA10.sqf:

// if you don't need to spawn a new guy each time, skip this part.
caspilotgroup = creategroup west;
bpf1 = caspilotgroup createUnit ["US_Soldier_Officer_EP1", getMarkerPos "BOB", [], 0, "FORM"];
caspilotgroup selectleader bpf1;
// end of possible skip

[_this select 2] joinSilent caspilotgroup;

Share this post


Link to post
Share on other sites
you fail...

That explains it...

Ok cool thanks for that, I'm watching masterchef at the moment so I'll give it a go when I'm allowed back on the main PC :)

Kylania, thanks for the script. I don't need to create a new guy each time, it's just for testing purposes at this stage.

Edited by TechnoTerrorist303

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  

×