Jump to content
Mr.Price

Script working on local host but not on server

Recommended Posts

Hello fellow editors,

 

Im working now for hours on a simple script that must activate a trigger.
It works fine on my localhost, but not on my server.

I can't get it to work.

Could you please take a look at it and help me out.

There are probatly hunderds of topics about this subject, but I seached for hours and can't figger it out. (Noob :P)

 

------------------------------------------------------------------------------------------

Talk script:

 

// Quick animation.

titleText ["You: You are not allow to stand here, please move back to the barrier","PLAIN DOWN"]; 10;

sleep 8;

titleText ["Civilian: Alright, ill go.","PLAIN DOWN"]; 10;

Civbar1=true;

 

_gen = _this select 0;

_caller = _this select 1;

_id = _this select 2;

_gen playmove "AidlPercSnonWnonDnon_talk1";

------------------------------------------------------------------------------------------

initServer:

 

// ============= Variables

Civbar1 = false

publicVariable "Civbar1";

Civbar2 = false

publicVariable "Civbar2";

Civbar3 = false

publicVariable "Civbar3";

------------------------------------------------------------------------------------------

Trigger:

 

variable name: Civbar1

Condition: Civbar1

on Act: rocivbar1 enableAI "move"; 
             rocivbar2 enableAI "move"; 
             rocivbar3 enableAI "move"; 

 

trigger has a waypoint activation set

------------------------------------------------------------------------------------------

Civilian:

 

variable name: rocivbar1

init: talk1 = this addaction ["Tell civilians to move behind barrier","Scripts\interaction\Civi\CivBar1.sqf"];

 

  • Like 1

Share this post


Link to post
Share on other sites

when you host, your literally the server so you have access and can see everything going on. when you host dedicated then you are a client just like everybody else. what exactly is the issue your having though?

Share this post


Link to post
Share on other sites
4 minutes ago, gokitty1199 said:

when you host, your literally the server so you have access and can see everything going on. when you host dedicated then you are a client just like everybody else. what exactly is the issue your having though?

When I host this mission on a dedicated server, and myself as a client, the trigger won't work. 
The talkscript works fine, but when the script ends, Civbar1=true; will be activated and should the trigger let it walk to the next waypoint.

 

Share this post


Link to post
Share on other sites
36 minutes ago, Mr.Price said:

When I host this mission on a dedicated server, and myself as a client, the trigger won't work. 
The talkscript works fine, but when the script ends, Civbar1=true; will be activated and should the trigger let it walk to the next waypoint.

 

whats inside of the public variable event handler for Civbar1? also if its for a waypoint, why dont you use publicVariableServer and put the event handler on the server. read on publicVariable, it sends on all clients. you only need it on the server

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

Share this post


Link to post
Share on other sites

I´ve no clue how to use publicVariables or server ones. could you please give me an example?

Share this post


Link to post
Share on other sites
7 hours ago, Mr.Price said:

I´ve no clue how to use publicVariables or server ones. could you please give me an example?

your using publicVariable already, publicVariableServer runs only on the server. for example here if you have this variable event handler on the server

"runThis" addPublicVariableEventHandler
{
	(_this select 1) params ["_message"];
  	_message remoteExec ["hint", 0, true];
};

 

then you have this on someones client

runThis = "This is my message";

publicVariableServer "runThis";

 when the publicVariableServer runs, it sends This is my message to the publicVariableEVentHandler and then it hints This is my message to everyone on the server.

 

for a video tut, go to tutorial 6

 

  • Like 1

Share this post


Link to post
Share on other sites
//Civilian:
//variable name: rocivbar1

//Stop the AI from moving so they cannot follow their waypoint
this disableAI "move";

//Add talk action
talk1 = this addAction ["Tell civilians to move behind barrier",{

	//Spawn some code so we can sleep
	_thread = _this spawn {
		params[ "_target" ];

		//Show player who uses action title texts
		titleText ["You: You are not allow to stand here, please move back to the barrier","PLAIN DOWN"]; 10;
		sleep 8;
		titleText ["Civilian: Alright, ill go.","PLAIN DOWN"]; 10;

		//ExecVM the script where the AI that this action is on is local 
		[ _this, "Scripts\interaction\Civi\CivBar1.sqf" ] remoteExec[ "BIS_fnc_execVM", _target ];
	};
}];
//Scripts\interaction\Civi\CivBar1.sqf

//Passed addAction params
params[ "_target", "_caller", "_ID", "_args" ];

//Play animation, as playMove is AL( Argument Local ) EG( Effect Global )
//AI is the Argument so must be played where they are Local
//The Effect is the animation, as it is Global everyone will see it
_target playMove "AidlPercSnonWnonDnon_talk1";

//Enable AI move so he will follow his waypoint
//Again this command is AL EG
_target enableAI "move";

//Remove the action from all clients and JIP( because it is added in the AI's init )
[ _target, _id ] remoteExec[ "removeAction", 0, _target ];

No trigger needed. The fact that they have their Move disable will stop them from following their waypoint. TEST_MISSION

  • Like 2
  • Thanks 1

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

×