Jump to content
  • 0

Triggering server side script from a client?


kaotix

Question

I have certain events I'd like to trigger from my server but I don't want 'zones' or anything like that, I want to have client triggered events but from scripts that currently run server side.

For now, the AI mission system runs server side and cannot be executed from a client.

I'd like to have an action (or similar) on certain players (admins using UID) to be able to kick off an AI mission event.

 

My current train of thought is this:

Have some kind of trigger waiting on the server looking for a client that has a certain variable set (mission = true)

From the client, in game, have the client press the 'mission' action to change their mission variable to true.

The server now sees this variable and triggers the required script on the server as it would do normally.

 

Is this possible or am I clutching at straws or going about it the wrong way?

 

Thanks

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

That is easier than you might think: publicVariableServer is the answer, it will just send anything you want to the server (and only the server) and then you can use addPublicVariableEventHandler on the server to do whatever you want with the data from the client. :)

Please don't do any weird loops or triggers, in most cases there is a good and simple solution :)

Link to comment
Share on other sites

  • 0

I'd rather not go into much detail either ;)

But it's pretty basic, just executing some pre-existing server side things based on timed events which I'd rather not have timed and only triggered when an admin decides to do so. Because of this, I need a client (admin) to tell the server it's ok to execute a piece of code.

Link to comment
Share on other sites

  • 0

Java as in external code outside of arma? Now this is like the sound of...please PM me some details if you don't want to go into anything further in public ;)

It's ok, nothing secret and wasn't my idea, well I had the same idea but someone already made it happen before I had the chance haha

Anyway I guess you don't know that Take On Helicopters (from the same guys that made ArmA) has an official Java API? ArmA3 should get the same java support, but as of now it still does not! :(

Whatever that doesn't help you with ArmA2, but you can still do something similar to it with the native extensions, so you are able to call your own extension (DLL) from any SQF-script.. that is how DayZ does the database interactions with the HiveExt.dll in case you didn't know that.. if you want java support you can just start a JVM from the dll and do whatever you want, if you are familiar with JNI (java native interface).. if not just use this and have fun: http://forums.bistudio.com/showthread.php?167749-Java-Extension-for-Arma-3-(jni-dll) (it says ArmA3 but it works fine with ArmA2 since they have the same scripts and extension interface, I've tested it with ArmA2 myself) sorry for the "long"  post I just wanted to give you some background in that, there is also a .NET (C#) lib for the same use case, to call a managed .NET DLL from ArmA script code, can come in handy but it's not that easy: https://bitbucket.org/Scott_NZ/arma2net/overview (seems to be very mature)

Link to comment
Share on other sites

  • 0

Appreciate the long post. This has given me some good food for thought. I'm pretty new to arma scripting but not new to programming or anything of that nature so it's just a small learning curve to find out what's available to developers and how things can be done. I'll be looking into this more, thanks Axe Cop!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...