Jump to content
Sign in to follow this  
fambaa

Little Problem, new to scripting

Recommended Posts

So me and a couple of friends started to play Arma2 OA ACE with our own version of Domination 2.54 West AI Ace which we are horribly editing and modifying ;) (Thanks to Xeno for the map)

Thats my problem:

We want to be able to be in a Group together, but since we are so few we also like to use AIs.

Whenever the Teamleader dies the lead gets switched to the second player in that group, but I want to be able to give the command back.

In the init of the original Teamleader I have this:

this setGroupID ["Alpha"] ;player addAction ["Teamleader", "Leader.sqf","alpha_1"]

alpha_1 is the name of the unit.

and this is my Leader.sqf so far:

_host = _this select 0;

_caller = _this select 1;

_id = _this select 2;

_string = _this select 3;

And now Im kinda stuck, I tried setLeader, selectLeader with _this , _string and all kinds of crazy combinations.

I think I need to pass the group and the name of the unit somehow but the group object is non-functional in MP the wiki says.

Thanks in advance.

Share this post


Link to post
Share on other sites

The groupchange works when I put this:

Group player selectLeader player;

but like I wrote in the above post, the "Group" command doesn't work in MP. And since noone is anserwing, just reading noone came up with a solution yet I guess?

edit:

Anyone tried to make a trigger and simply activate it by a radio command and in the init: group player selectLeader player; ?

It seems to work when I host it, but Im not sure if its compatible with MP .

Edited by fambaa

Share this post


Link to post
Share on other sites

I don't think you can use the radio if your not group leader.

I don't now much about MP so this probably won't work.

place a trigger 0,0 size on the map.

Condition

!alive Player

In Act

null=[] execvm "restore.sqf"

Script

WaitUntil {alive player};
group player selectLeader player; 
hint Format ["New Leader is %1 ",name player];

I now it works in single player but how it works when you have two players I don't know.

If Group is non functional in MP then I don't know.

You could try changing the rank to make sure it's the highest in the group.

player setUnitRank "captain";

instead of the Group player line, this will work in SP unless the leader is already selected.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Thanks for the input F2k.

Unfortunately the radio trigger caused a ton of scripterrors from the beginning, the isledefense script was inactive all domination features (grey actioncommands) were gone, and to all of that you were right.

Since we are kind of RPing Im gonna use a walk-in trigger with the condition and the selectLeader, that way I have an RP way of doing it, and it shouldnt cause any JIP problems.

Im going to report back if that works anyways, because many COOP maps and even Bennys warfare had/have this problem sometimes.

Share this post


Link to post
Share on other sites

how about putting this in leaders initline:

_null = [this] execVM "restoreleader.sqf";

restoreleader.sqf:

// leader rejoin org team as leader after death.

_leader = _this select 0;
_group = group _leader;

while {true} do {
while {alive _leader} do {
	if (alive _leader) then {
		_group = group _leader;
	};
	sleep 5;
};
waitUntil {alive _leader};
sleep 5;
if (_group != (group _leader)) then {
	[_leader] joinSilent _group;
};
if ((leader _group) != _leader) then {
	_leader = leader _group;
};
};

Share this post


Link to post
Share on other sites

Hmm that looks so complicated to me that I think you solution will work fine Demonized ;)

My Triggersolution did not work btw. Anyone who walked into the tent got shortly control over the squad he was in but then lost it again. The recruited soldiers however stayed in formation. It was very strange.

Im going to use you script now Demonized, and then I report back if it works, and this time I have a good feeling, unless Xenos scripts do something similar...

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  

×