Jump to content
Sign in to follow this  
SOLDIER X

Hostage rescue - Dedi server woes.

Recommended Posts

Hi

Im having trouble with a script for releasing hostages in a small co op mission.

Everything works fine in any environment other than on a dedicated server then i hit trouble.

I add an action to the hostage's init filed

_release = this addAction ["Escort Prisoner", "Release.sqf"];this disableAI "MOVE"

Which calls the following script.

Release.sqf

_pow = _this select 0;
_caller= _this select 1;
_id = _this select 2;
[_pow] joinSilent group _caller;
_pow enableAI "MOVE";
_pow setCaptive false;
_pow setUnitPos "UP";

sleep 1;

_pow removeAction _id;

The hostage will join the rescue team no problems, however if any unit other than the team-leader of the rescue group releases the hostage, the hostage will join the rescue team as normal but will not respond to any orders given.

Any help resolving this issue would be great as its a major show stopper during game play.

Best wishes "X"

.

Edited by SOLDIER X

Share this post


Link to post
Share on other sites

There is some required information on the mission set up lacking in the description. Is there a single playable group or are there multiple ones? At any rate there are two considerations to take into account. An important precondition for any AI controlled character is that the rank of the AI character is lower than any of the playable characters in the group that is joined. If the AI character outranks any of the playable units, it is possible that the AI would become group leader. Therefore it is good practice to make any AI hostage a private and preferably make the rescue team corporal and above.

Another essential related ingredient for a hostage rescue is to make sure that the joinsilent statement includes all group members. For example if hostage mcguffin is rescued by group alphasquad consisting of alpha1, alpha2, alpha3 and alpha4 one would use [alpha1,alpha2,alpha3,alpha4,mcguffin] joinsilent alphasquad;. Besides helping to keep the hostage low in the chain of command, particularly when opting to have any playable unit rank the same as the hostage, it aids in preventing the hostage from taking up position at the front of any formation.

Regards,

Sander

Share this post


Link to post
Share on other sites

Hey sander

Thanks for the reply, sorry for omitting information on mission set up.

There is only one player group ( team1 = group this) made up of 4 units named p1,p2,p3 and p4.

As you suggested other than the team leader they were all ranked private, as is the hostage. I have changed this so only the hostage is a private and have altered the joinsilent statement to ....

[p1,p2,p3,p4,_pow] joinsilent group _caller

All seems to be working, however it will be later this evening before i can test on dedi server. I'll let you know how it goes, many thanks for taking time out to help me with this matter.

Best wishes "X"

*EDIT*

The problem still persists on a dedicated server, the hostage will only follow commands when released by the team leader and the action to release remains until activated by team leader.

Edited by SOLDIER X

Share this post


Link to post
Share on other sites

I'm having the exact same problem for a mission that I'm trying to make.

Any help would be great.

Share this post


Link to post
Share on other sites

I experienced exactly the same problem, in the end i switched from a rescue mission to an assassination job. I couldn't find a fix among all the suggestions / examples in the forums, it had me beaten.

:-(

Edited by shark-attack

Share this post


Link to post
Share on other sites

A couple of things that may be worth a try. although as it's joining I can't see that being the problem.

[_pow] joinSilent group leader _caller;

[_pow] joinSilent  leader _caller;

Share this post


Link to post
Share on other sites

@F2k Sel

Thanks for your suggestions. However i just tried altering the code and the problem still remains on Dedi server.

Can anyone help me ?

Please

Share this post


Link to post
Share on other sites

Might be a locality thing? Does the locality of the HVT change when it joined the group?

I seem to remember seeing a thread a few weeks ago about when an AI joins your group it does nothing until you have it join twice or something? Can't find the thread since search here drops words like 'nothing'. :(

Share this post


Link to post
Share on other sites

Sounds plausible, i have noticed that also the action to release the hostage remains present until the leader of the rescue group executes the action, then the hostage seems to fall into line and follow orders.

It must be a locality issue as things work flawlessly in any environment other than dedi server .

Share this post


Link to post
Share on other sites

Have you tired just running the script on the server ?

try placing this at the top of the script.

if (!isServer) exitWith {};

Share this post


Link to post
Share on other sites

try this:

_pow = _this select 0;
_caller= _this select 1;
_id = _this select 2;
sleep 1;
_pow removeAction _id;  // remove action on all clients.

// execute remaining commands only on server side.
if (isServer) then {
_pow enableAI "MOVE";
_pow setCaptive false;
_pow setUnitPos "UP";
[_pow] joinSilent group _caller;
};

if then has same effect as placing F2k Sel´s code above the commands.

Share this post


Link to post
Share on other sites

@ Demonized

I just tried with the above code and now the hostage will not join the players group.

(i do have a logic named server placed in editor)

Share this post


Link to post
Share on other sites

The script from OFPEC works like a charm, great find shark-attack !

Many thanks for the heads up.

*Edit

Spoke too soon , everything other than the removal of the action works.

At the end of the mission we were still left with an action to release hostage

(x 3 one for each hostage) dedicated server only. :pet5:

three hostages named hostage_1, hostage_2 and hostage_3

Init.sqf

{[_x, 0, 0, ["0"]] execvm "hostage.sqf"; sleep 0.1;} foreach [hostage_1, hostage_2, hostage_3];

hostage.sqf by mr_book.PXS.Pvt

_hostage = _this select 0;
_liberator = _this select 1;
_action = _this select 2;
_selections = _this select 3;
_selection = _selections select 0;

switch (_selection) do
{
case "0":
{
 _trg = createTrigger ["EmptyDetector", getpos _hostage];
 _trg setTriggerArea [2, 2, 0, false];
 _trg setTriggerActivation ["west", "present", true];
 _trg setTriggerStatements ["this", format ["freeman = %1 addaction [""Free hostage"", ""hostage.sqf"", [""1""], 100]", _hostage], format ["%1 removeaction freeman", _hostage]];
 _trg attachto [_hostage];
};
case "1":
{
 [_hostage] join (_liberator);
 _hostage removeaction _action;
 deletevehicle _trg;
};
default {};
};

anyone see what the problem could be ?

"X"

Edited by SOLDIER X

Share this post


Link to post
Share on other sites

Hi SOLDIER X,

Going back to your previous script, I see some mistakes and why it does not work on a Dedicated environment and in a hosted enviroment too, if who clicks the action isn't the host.

  _pow = _this select 0;
  _caller= _this select 1;
  _id = _this select 2;

  [_pow] joinSilent group _caller;*
  _pow enableAI "MOVE";**
  _pow setCaptive false;**
  _pow setUnitPos "UP";**
  _pow removeAction _id;***

*joinSilent command arguments need to be local to the machine where you're calling, basically, since its an AI unit without a leader player in its group, it becomes local to the server. Actions are local, and its effects are also local to the machine of the player who used the action, so basically, you're using joinSilent on the player machine, not the AI machine.

**Same as above

***This will only remove the action to the player who clicked the action, all others will still see it and will be able to click it.

There are many ways to do this, one is using RE (Remote Execution)/Multiplayer Framework by placing the Functions Module on the editor and make the following changes to your script.

_pow = _this select 0;
_caller = _this select 1;
_id = _this select 2;

//We use RE to remove the action in all machines including JIP
[nil, _pow, "per", rREMOVEACTION, _id] call RE;

//We now use RE to broadcast some code to where _pow is local
[nil, _pow, "loc", rSPAWN, [_pow, _caller], 
{
  _pow = _this select 0;
  _caller = _this select 1;

[_pow] joinSilent group _caller;
_pow enableAI "MOVE";
_pow setCaptive false;
_pow setUnitPos "UP";

}] call RE;

Remember, once the AI join the player group, it will become local to that players machine.

_neo_

Edited by neokika

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  

×