Jump to content
Purzel

AI not leaving vehicle and customchat-problem

Recommended Posts

Hi Folks,

 

Mission:

A BLUFOR-hostage was taken by enemy spetznaz-unit as hostage and is handcuffed with its kidnappers in a ural-truck driving away from the scene.
The BLUFOR-player-units have to stop the truck, free the hostage and bring him back the base.
If all spetznaz are dead, the hostage should free himself, get out the truck and run to the nearest player.
It is a multiplayer-mission running on a dedicated server!

Setting:

a ural-truck (named "ural"), the hostage (named "hvt" /grouped as "geisel"), the group (grouped as "spetznaz", truckdriver named "uralD").

some waypoints etc.

a trigger (not serversided!), which checks the distance playableunits <> ural then calls the following script:

 

CODE:

if (isServer) then 
{
	["task1"] call FHQ_fnc_ttGetTaskState == "succeeded";

	// Ural starts, max. speed 15, because of stupid AI and driving behaviour...
	ural setfuel 1;
	ural limitSpeed 15;
	ural forceSpeed 15;

	// Wait until Ural wheels hit oder driver shot,
	waitUntil  
	{
		(
			1 == 
			{
				if (1 == ural getHit ("wheel_" + _x + "_steering")) exitWith {1};
			} count ["1_1", "1_2", "2_1", "2_2"]
		) OR 
		{
			!alive driver ural
		}
	};

	while {(count (waypoints spetznaz)) > 1} do 
	{
		deleteWaypoint ((waypoints spetznaz) select 1);
		sleep 0.1;
	};
};

// just as confirmation for me, when testing...
hint "Ural hit!";

[west, "Base"] sideRadio "rogerbeep";

// CUSTOMCHAT BROKEN?
[hvt,[1,"Help - I want out of here!"]] remoteExec ["customChat", WEST, false];

//---------------
if (isServer) then 
{
	// From here vehicle-Stop!
	ural setfuel 0;
	ural forceSpeed 0;

	// Spetznaz should get out
	{unassignVehicle (_x);} foreach units spetznaz;
	{commandGetOut (_x);} foreach units spetznaz;

	["task2"] call FHQ_fnc_ttGetTaskState == "succeeded";
	spetznaz setCombatMode "RED";
	spetznaz enableIRLasers true;

	// Wait until all Spetznaz out and dead
	waitUntil {(!(alive _x) count (units spetznaz)) == count (units spetznaz); };
	waitUntil {({!(alive _x) && !(_x in ural)} count (units spetznaz)) == count (units spetznaz); };

	// hostage frees himself, de-blindfolds himself aussteigen lassen
	[hvt, false] call ACE_captives_fnc_setHandcuffed;

	// CUSTOMCHAT BROKEN?
	//[[[west, hvt],"Help! Where am I? Help me!!"], "sidechat",WEST,false] call BIS_fnc_MP;

	sleep 3;

	removeGoggles hvt;
	commandGetOut hvt;
	doGetOut hvt;
	geisel leaveVehicle ural;
	hvt action ["getOut", ural];

	// CUSTOMCHAT BROKEN?
	//[[[west, "hvt"],"Wo are you? Help me!!"], "sidechat",WEST,false] call BIS_fnc_MP;

	// Ural gets fuel again just in case players need to flee with it.
	ural setfuel 1;

	// Backup-Jeep starts a few kilometers away (OPFOR)
	gaz setfuel 1;

	// Funktion call for getting nearest player to hostage, to which the hostage will talk and run, after free'd
	// _dichtesterSpieler = [hvt] call fnc_findNearestPlayer;

	["task3"] call FHQ_fnc_ttGetTaskState == "succeeded";

	sleep 4;

	[west, "Base"] sideRadio "rogerbeep";
	[[[west,"Base"],"Get the target and get out of there!"], "sidechat",WEST,false] call BIS_fnc_MP;

	sleep 30;

	// Patrol1 starts nearby and moves toward players(OPFOR)
	pat1 setfuel 1;

	sleep 120;

	// The hostage ist vulnerable again!
	hvt allowdamage true;
	hvt setcaptive false;
};

 

 

PROBLEMS:

- Its working until Trucks wheels  oder driver are shot.
- If truck-crew spots BLUFOR, the driver stops the truck.

- Sometimes not all spetznaz leave the truck.

- Sometimes some spetznaz get in cargo again.
- If some spetznatz shot in cargobay, this script seems not to continue and stops.

- Hostage should get out of ural, when all spetznaz are dead, but it stays seated, but you can see a get-up-animation, which stops on half and repeatedly tries to step up, but hes catched in that animation.

(Hostage will only stay in the enemy truck, when handcuffed in its init with ACE-function from above (of course with "true" instead of "false": [hvt, true] call ACE_captives....). All "moveInCargo"/"assignAsCargo"-stuff wont stay him in an emeny truck!)
- customchat isnt working at all. I´ve given an identity in Init.sqf and named the blue-square over its head also.

Does anybody have some clues, why spetznatz are disembarking the truck and trying to get in again?

Some commands are only group-related, so I had to use name and groupname in that script. (e.g.   Unit: hvt,  group: geisel, blue square over unit: hostage)
I´ve searched the forum-theads, but I'm stuck...

 

Any suggestions/solutions for all that problems?
Im sitting here since four days and getting more and more desperated...

Greetz Purzel
 


 

Edited by Purzel
Formatted Code from opusfmspol embedded

Share this post


Link to post
Share on other sites

If you are not using the -showscripterrors startup param, use it.  It will flash errors on screen as they occur.  It helps you to identify exactly when an error occurs in a mission.  Just be aware that with singlePlayer and MP hosted, it flashes on the host both server and client errors, but using dedicated server it only flashes errors as they occur on client, not errors as they occur on server.

 

If you are using the -nologs startup param, don't use it.  -nologs prevents errors from being logged in .rpt for review.  When playing missions you might want to disable logging, but when debugging you want to review the .rpt logs for errors.  With singlePlayer and MP hosted, the host .rpt will log both server and client errors.  With a dedicated server the .rpt log for server and client are usually found separate.  The client .rpt logs the client errors and the server .rpt logs the server errors.

 

For others who may wish to help with your problem, I reformatted your script above for better readability here:

Spoiler

if (isServer) then 
{
	["task1"] call FHQ_fnc_ttGetTaskState == "succeeded";

	// Ural starts, max. speed 15, because of stupid AI and driving behaviour...
	ural setfuel 1;
	ural limitSpeed 15;
	ural forceSpeed 15;

	// Wait until Ural wheels hit oder driver shot,
	waitUntil  
	{
		(
			1 == 
			{
				if (1 == ural getHit ("wheel_" + _x + "_steering")) exitWith {1};
			} count ["1_1", "1_2", "2_1", "2_2"]
		) OR 
		{
			!alive driver ural
		}
	};

	while {(count (waypoints spetznaz)) > 1} do 
	{
		deleteWaypoint ((waypoints spetznaz) select 1);
		sleep 0.1;
	};
};

// just as confirmation for me, when testing...
hint "Ural hit!";

[west, "Base"] sideRadio "rogerbeep";

// CUSTOMCHAT BROKEN?
[hvt,[1,"Help - I want out of here!"]] remoteExec ["customChat", WEST, false];

//---------------
if (isServer) then 
{
	// From here vehicle-Stop!
	ural setfuel 0;
	ural forceSpeed 0;

	// Spetznaz should get out
	{unassignVehicle (_x);} foreach units spetznaz;
	{commandGetOut (_x);} foreach units spetznaz;

	["task2"] call FHQ_fnc_ttGetTaskState == "succeeded";
	spetznaz setCombatMode "RED";
	spetznaz enableIRLasers true;

	// Wait until all Spetznaz out and dead
	waitUntil {(!(alive _x) count (units spetznaz)) == count (units spetznaz); };
	waitUntil {({!(alive _x) && !(_x in ural)} count (units spetznaz)) == count (units spetznaz); };

	// hostage frees himself, de-blindfolds himself aussteigen lassen
	[hvt, false] call ACE_captives_fnc_setHandcuffed;

	// CUSTOMCHAT BROKEN?
	//[[[west, hvt],"Help! Where am I? Help me!!"], "sidechat",WEST,false] call BIS_fnc_MP;

	sleep 3;

	removeGoggles hvt;
	commandGetOut hvt;
	doGetOut hvt;
	geisel leaveVehicle ural;
	hvt action ["getOut", ural];

	// CUSTOMCHAT BROKEN?
	//[[[west, "hvt"],"Wo are you? Help me!!"], "sidechat",WEST,false] call BIS_fnc_MP;

	// Ural gets fuel again just in case players need to flee with it.
	ural setfuel 1;

	// Backup-Jeep starts a few kilometers away (OPFOR)
	gaz setfuel 1;

	// Funktion call for getting nearest player to hostage, to which the hostage will talk and run, after free'd
	// _dichtesterSpieler = [hvt] call fnc_findNearestPlayer;

	["task3"] call FHQ_fnc_ttGetTaskState == "succeeded";

	sleep 4;

	[west, "Base"] sideRadio "rogerbeep";
	[[[west,"Base"],"Get the target and get out of there!"], "sidechat",WEST,false] call BIS_fnc_MP;

	sleep 30;

	// Patrol1 starts nearby and moves toward players(OPFOR)
	pat1 setfuel 1;

	sleep 120;

	// The hostage ist vulnerable again!
	hvt allowdamage true;
	hvt setcaptive false;
};

 

 

My first observation, is that you say the trigger is not server-side, yet the script the trigger calls has two server-only blocks.  In singlePlayer and MP hosted, those blocks of script will run for the host.  But on dedicated server the trigger does not exist, and the script is run on clients, so those blocks in the script will not get run at all.

 

- edit:  I should say "scopes" instead of "blocks".  They're properly called scopes.  But I'm a blockhead.  :hm:

Edited by opusfmspol
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

THX opusfmspol,
I've just embedded your formatted code.

So I have to use a server-sided trigger...
Yes, I have the scripterrors activated.

 

Quote

Just be aware that with singlePlayer and MP hosted, it flashes on the host both server and client errors, but using dedicated server it only flashes errors as they occur on client, not errors as they occur on server.

That was new to me. Thanks!

I hate locality... I try to understand, but its a problem to me.
I'll try to catch some errors and come back here with them.

Wait...

Share this post


Link to post
Share on other sites

I've changed the trigger to server-sided. Below is a short video-clip, which explains the problems:
And still no customchat-messages - in console I tried it all hostage-names: These are the two occuring errors:
By the way: sidechat is working in BIS_fnc_MP / remoteExec code

 

Type group - expecting string                                                                                                                                 Type string - expecting object
fehler16kjsh.jpg     fehler26zkhq.jpg

 

Video:

Link to video - click here!

 

 

Share this post


Link to post
Share on other sites
12 hours ago, Purzel said:

Type string - expecting object

well yes, why are you passing a string to a command that wants a unit? "hostage" is not a unit, its a string, its wrong.

I can only advise to read the wiki https://community.bistudio.com/wiki/customChat

 

12 hours ago, Purzel said:

Type group - expecting string   

Well yes, why are you passing a group/unit to a command that wants a string? geisel is not a string, seems to be a group, its wrong.

I can only advise you to read the wiki https://community.bistudio.com/wiki/sideChat

 

If you give wrong parameters to commands, they won't work.

  • Thanks 1

Share this post


Link to post
Share on other sites
Quote

If you give wrong parameters to commands, they won't work.


I tried "hvt", which is the units name. Theres also nothing happening.

Share this post


Link to post
Share on other sites
17 hours ago, Purzel said:

I tried "hvt", which is the units name.

"hvt" with quotes is still a string. Passing a string to a command that wants an object will never work.

  • Thanks 1

Share this post


Link to post
Share on other sites

Ah sorry, I tried it with quotes, but without

 

tell me whats wrong, I can´t find any errors:

[[[west, hvt],"Sidechat - BIS_fnc_MP!"], "sidechat",WEST,false] call BIS_fnc_MP;

 

[[[west, hvt],"Customchat - BIS_fnc_MP!"], "customchat",WEST,false] call BIS_fnc_MP;

Share this post


Link to post
Share on other sites
On 3/14/2020 at 6:38 AM, Purzel said:

tell me whats wrong

BIS_fnc_MP in itself is already wrong.

 

sideChat takes array of side and string. You are now giving it side and object.

customChat doesn't take array as left argument, it takes an object.

Please read the wiki pages (like i told you days ago already) for the commands you are using to know how to use them:

 

https://community.bistudio.com/wiki/customChat

https://community.bistudio.com/wiki/sideChat

  • Thanks 1

Share this post


Link to post
Share on other sites

Ok, now I´m close to the solution.

It depends of what order the codelines have.
I´m on it, I'll post a working solution here as soon as I can.

 

 

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

×