Jump to content
Sign in to follow this  
daza

ungrouping a unit in a script...?

Recommended Posts

Hi guys,

Ive done alittle bit of a search on here and other forums. But unable to find the solution to my problem.

My (MP) mission has a sequence where a player goes to a certain point where via addaction a civilian is created and automatically joins the player's group.

But i want another player to be able to tell that unit to join his group.

(this is for a vip mission, incase the original player the civilian was assigned to, is killed, i want other players to be able to assign the civilian to their group.)

So what i have done is added another addaction to the civilian thus "follow me" which calls up this sqf script (below) i wrote, but its not working.

The civilian is already assigned to _group of player to begin with. So i tried to ungroup it with the grpnull command. But nothing happens. I must be using the command improperly..or there is another way to ungroup and reassign...

the called Script:

player removeaction tm1;

_group = grpnull;

_group = player;

vpciv1= _group;

Thanks for your help :)

Daza

Share this post


Link to post
Share on other sites

The script doesn't do anything afterthe removeAction line!

Maybe

vpciv1 join (group player);

is all it takes?

Share this post


Link to post
Share on other sites

Thanks for your reply Mr Feni,.

vpciv1 join (group player);

That didnt seem to work either. I also tried

vpciv1 joinsilent player; that didnt work. :(

Any other ideas? The alternative is not assigning civ to player but having a dofollow, dostop script. But i think it would be better to have them in players group, so you can have more specific commands such as go prone, move there etc. So i really would like to get this working.

Thanks again for your help,

Daza

Share this post


Link to post
Share on other sites

Awesome! thanks IndeedPete that worked great! :D

Share this post


Link to post
Share on other sites

My previous posts on this topic i havent yet worked out and had left it.

But i have a new TvT VIP Mission (i will finish the one above too) but im still stuck with this getting the Vip to join another group/player.

This script below does work first time its run in MP, but if another player tries to get the vip to join player, nothing happens. Even if handler of VIP is shot dead. [vipdude] join grpnull; should reset his availability to be joined to a player like at the start right...so why isnt this working?

This script is fired from an addaction...

If (!local player) exitwith {};

_targ= cursortarget;

if (_targ != vipdude) exitwith {Hint "He is not your target";};

_dist  = player distance _targ; 

if (_dist <5) then

{
//incase vip handler is not dead.
[vipdude] join grpnull;

sleep 1;

[vipdude] join player;

};

if (!captive vipdude) then

{vipdude setCaptive true;

};

sleep 2;

//If handler dies, VIP will be released from players group.
waituntil {(!alive player)};

vipdude setcaptive false;

[vipdude] join grpnull;

Any ideas to get this working?

Im sure there are other beginner scripters who could benefit from learning how to do this too.

**** UPDATE *****

I'm thinking its not possible to do what i want to do (Above).

So i will have to use the other method, of getting the VIP to follow, stop etc via script. Which works in SP, and only for one player in MP whether it be client or host.

It seems who triggers the create vip unit is the master of the Vip and scripts as it were, the scripts on client machines do run, but do not affect the vip unit as if the VIP will only answer to its master.

So what do i need to do so that whoever (any other MP player) actions a script that is attached to the VIP, so that X script will be current to the VIP and it will obey the script running.

VIP script that creates Vip when actioned by player...

if (!local player) exitwith {};

dor1 setvehicleInit "dor1 removeaction knock";

processInitCommands;

playSound "knocking_door";

if (alive vpciv1) exitwith

{hint "VIP1 Has already been taken into custody."};

_plyr=player;

//_group = group player;

GrpVp = Creategroup civilian;

vpciv1 = grpvp createunit["sportswoman1", getpos player, [], 0, "form"];

vpciv1 setVehicleInit "this addaction ['Follow me','scriptVP1\follw1.sqf']";

vpciv1 setVehicleInit "this addaction ['Stop there','scriptVP1\wthere1.sqf']";

vpciv1 setVehicleInit "this addaction ['Get up','scriptVP1\getup1.sqf']";

vpciv1 setVehicleInit "this addaction ['Get in Vehicle','scriptVP1\vh1.sqf']";

vpciv1 setVehicleInit "this addaction ['Get out of vehicle','scriptVP1\gout1.sqf']";

vpcom=_plyr addaction ['Stay with me','scriptVP1\follw1.sqf'];

vpcom2=_plyr addaction ['Wait there','scriptVP1\wthere1.sqf'];

vpcom3=_plyr addaction ['Crouch down','scriptVP1\squat.sqf'];

processInitCommands;

dostop vpciv1;

vpciv1 dowatch _plyr;

vpl1=true;

publicvariable ="vpl1";

The Followme Script that should be able to be actioned by any player near VIP.

Follw1.sqf

If (!local player) exitwith {};

_plyr=player;

hint "Follow me script running";

vpciv1 setunitpos "up";

_distance = vpciv1 distance _plyr;

waituntil {sleep 1; vpciv1 domove getpos _plyr; (vpciv1 distance _plyr <= 5)};

dostop vpciv1;

hint "Tell me when to move again.";

sleep 4;

call talkv1;

Edited by Daza

Share this post


Link to post
Share on other sites

Ive updated my post, it seems i need to give it a bump to get seen.

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  

×