Jump to content
Sign in to follow this  
snkman

What do i have to do? Script don't work on Server!

Recommended Posts

Hey guy's,

well i created a very big MOD and i always tested it in the Editor and on a local hosted MP session and it always works very well.

Now i tested it on a Server and nothing works.... The Debug ( Hint ) messages didn't work too....

help.gif Someone can give me a hint what do i have to pay attention for to make sure a script is working on a Server?

Share this post


Link to post
Share on other sites

If I was a real estate agent I'd probably say it like this "location, location location." smile_o.gif

But seriously SNK it sounds like you are running into problems with the locality of where your scripts are running.

I found after weeks, actually months, of testing my revive script that some scripts need to be run locally on the clients machines and some on the server.  In fact I found that in some instances, some local scripts that only affect individual players need to be run locally on all clients machines so that there isn't desync between what each player sees happening in game.

You probably already know this but some ways to make scripts local to certain machines is to use code like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if (local server) then ...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (local player) then ... or

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (local _unit) then ... .

Somethings to remember are that a players avatar/character is local to the players machine, AI grouped with the player who is their leader is also local to the players machine and AI not grouped with players is local to the server as are respawning or empty vehicles.

The only way I found to check what scripts were running where was to get the scripts to hint when a certain event happened and then try and keep track of on which machines the hints were showing up.  

I've also found that, and I may have this wrong, if you set up a local server and then have  a second instance of ArmA running and then connect to that local MP server that it gives you an idea of what was going on both a dedicated server and clients machine.  For instance, the local server would show hints of what was happening on the server and the second instance would show up what was happening on the clients machines.  

To get this to work on a local server you will need to disconnect from the internet, create a local server and load your mission until you get the "The no message received from master server" prompt.  Once this happens you can then reconnect to the internet and start up a second instance of ArmA either on the same PC or another one where you have ArmA installed.  If you don't disable your internet when you create a local server then you'll get the duplicate CD key error and won't be allowed to join your own local server.

I've found this easier than testing on a dedicated server as you can easily edit your scripts in the mission selection screen and then reload the mission with the changes you've made rather than having to constantly pbo your missions and copy them to the MPmission directory where you have ArmA installed.

I hope this makes sense.

Share this post


Link to post
Share on other sites

Hey norrin, smile_o.gif

Thank you very much for the replay.

Yeah thouse local and not local stuff still gives me a lot to think.

I know about the if (local server) then command and all this stuff but so far i don't really understand what exactly does it do.

But with your examples i get a bit understanding how this should work.

I'm pretty new to scripting and i think i just overdid it with what i did now smile_o.gif but anyway time will show.

WoW this thing with connect two times on the same pc really work's this way?

I remember in OFP and ArmA 1.02 i always could do this but since i think 1.05 i always get this damn duplicate CD key error message.

But pretty nice to know there is a way to do this again. wink_o.gif

Well i have to test some more stuff and hope it will work very soon becouse i spend more then 2 month every free secound on coding this.

So thank's a lot norrin.

Share this post


Link to post
Share on other sites

Hey Q,

thanks but the links are broken. smile_o.gif Anyway i found everything by browsing the BIKI.

Well yesterday i found out, why the script did not broadcast events happend after a EventHandler "Fired" was triggered.

In GL2Plus ( Group Link 2 Plus! ) at the beginning of GroupLink2.sqs there is a line, telling the script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Check if this is the server (host), if not then exit

? !(local Server) : exit

Well after disabling this line everything works just fine. But now im not sure, if i get lag with it, becouse if i understand everything right now the script will run on the Server too. Right?

? !(local Server) means if the Game Logic called Server is not Local then the script will exit.

Are there any way's how to find out, what exactly need to be local and what not? To me it's really hard to understand what exactly all this locallity stuff means.

Most of my knowledge is based on OFP ECP becouse if i need something to know i always check how the ECP guy's did it, and there i saw they have some scripts checking the server side and the player.

Well i need to read some more stuff about this may if someone knows a tutorital or willed to post some more infos and/or way's about Local and not lacal i would be very happy.

smile_o.gif

Share this post


Link to post
Share on other sites

Hey norrin,

well i have to say THANK YOU VERY MUCH for the how to create a local hosted game and connect with 2 ArmA instances hint.

With this i could slove 90% of my problems. biggrin_o.gif

All effects are working on MP now.

ArmA starts lagging a bit after 5 min. but this should be the smallest problem.

I think it's becouse some scripts are still running on the client's and Server but i will solove this too. wink_o.gif

Well thank you very much norrin. thumbs-up.gif

Share this post


Link to post
Share on other sites

NP SNK smile_o.gif Sounds like you're really close m8. I found it even better if you have a second PC or laptop hooked up as you can actually see whats happening on the server and the client at the same time without having to alt-tab all the time.

With the lag maybe try increasing the rests in loops if possible (eg. either with ~1 or sleep 1 depending on syntax) as this can make a huge difference to how much strain is placed upon the cpu (ie. cpu resources are used) by a looping script.

Share this post


Link to post
Share on other sites

fixed links smile_o.gif

Share this post


Link to post
Share on other sites

Hey norrin,

sorry just one more question:

As you talked about the connect with 2 ArmA instances thing you meaned over LAN?

Becouse to me it only works in LAN mode.

I start ArmA without internet connection, then i go to Multiplayer, New, choose a island and a map and then i wait till i get the "no message received from master server" message.

Then i connect to the internet and start a new ArmA instance on the same pc but the i only have a hosted game on LAN, where i can connect to, on internet there is no game hosted by my self.

Is this correct?

Well with the lan connection and with two ArmA instances all things are working for bouth but then if i test it with the arma_server.exe most things again don't work... crazy_o.gif

I COULD RUFF MY HAIRS OUT!!!!! banghead.gif

Share this post


Link to post
Share on other sites

SNK. There are a couple of ways of testing things which you probably already know about.

1. On a dedicated server: To do this you need to make sure you have kickduplicate=0; in your server config otherwise you'll get kicked when you try to join with your second instance. Then when you're finished make changes to the script pbo the file and place in the mpmission dir where you have the game installed, then join the ded server with two instance of arma and test. Although there is no other way to truly check whats going on in the ded server its a hassle to have to re-pbo and copy and past a mission file to the mpmission dir every time you make a small change and you end up with 100s of versions of the same mission in this dirtectory.

2. On a local server: Since I realised that a second instance of ArmA can join a local server if the server is started without an internet connection I've been using this setup to test nearly all my edited versions. In my experience what happens on the clients machine ( the second instance, not local server) is similar to what happens on a clients pc on a dedicated server so you really need to make sure that its all working on the second instance. Unfortunately you still need to run your script on a dedicated server as a final check just incase there is some arcane difference between what happens on a clients PC on a dedicated and local server.

One other thing about this is once you've got the "no message received from master server" message you can reconnect to the internet and you can join a second instance via lan if for instance you have a second computer that you want to connect to the the local server for testing.

This last bit I'm not 100% sure about but in this case although the game will not show up on the multiplayer/internet server screen if you know the IP of the local server you should be able either search for it or connect directly to it from a second machine that is some where else on the net.

If you need some one else to look at the mod I'd be happy to take a look at it for you m8, theres a good chance I won't be able to help but you never know.

Share this post


Link to post
Share on other sites

Hey norrin,

thanks for all your help and good hint's it really helped me a lot. smile_o.gif

Well i think from day to day i understand a bit more on how all this "SHOULD" work. biggrin_o.gif

But theory and practice are two different pairs of shouse.

Damn it... I always thougt everything should run fine on bouth local ArmA versions... whistle.gif

Well most stuff is running good on the secound ( Not server ) instance of ArmA so this should be good for the beginning.

The mod is very big and some parts are scripted very complicated i also use parts of the ECP DGAS architecture what make's everything extremly complicated, if you haven't script it by yourself.

Well if i can't get it to work in the next few days i will create a little mission with the basics on what's not working and send it to you.

So once again THX norrin. smile_o.gif

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  

×