Jump to content
Sign in to follow this  
galzohar

proper way to make a client send something to the server?

Recommended Posts

So I know publicVariable to send stuff from the server to the client, but how can the client tell/ask the server to do anything? The only way I know so far is if he activates a speicfic trigger that activates for everyone, but I want to be able to have a script that runs locally tell the server to do something. Can this be done with publicVariable or is it restricted to the server, and if it's restricted, what other solutions are there?

Either way, how would you also tell the server who made the request? At least publicVariable can't send references to local objects, so I guess I can't publicVariable an array that includes a reference to the calling player unit in any way?

This shouldn't be something that complicated, it's simple client-server communication... What am I missing?

Share this post


Link to post
Share on other sites

Have a look at the MP Framework

http://community.bistudio.com/wiki/Multiplayer_framework

Format

_nic = [nil_or_caller, nil_or_target_object,"loc", script_to_execute, par0, par1...] call RE;

_nic = [nil_or_caller, nil_or_target_object,"per", script_to_execute, par0, par1...] call RE;

_nic = [nil_or_caller, nil_or_target_object,"loc" + "per", script_to_execute, par0, par1...] call RE;

might that suit your needs ??

Share this post


Link to post
Share on other sites

If I understand it correctly, the publicVariable sends the variable to ALL machines regardless of where its firing, including the server.

Share this post


Link to post
Share on other sites

Anyone have any functional demos of how these RE commands work?

The framework wiki just confuses me. :)

Share this post


Link to post
Share on other sites

Congratulations Shiva, after four years registered here; your first post! :bounce3:

Share this post


Link to post
Share on other sites
Have a look at the MP Framework

http://community.bistudio.com/wiki/Multiplayer_framework

Format

_nic = [nil_or_caller, nil_or_target_object,"loc", script_to_execute, par0, par1...] call RE;

_nic = [nil_or_caller, nil_or_target_object,"per", script_to_execute, par0, par1...] call RE;

_nic = [nil_or_caller, nil_or_target_object,"loc" + "per", script_to_execute, par0, par1...] call RE;

might that suit your needs ??

Seems like it, though I don't fully understand how to make it work. Is there any sample mission anywhere (or at least a known mission that uses it)?

Share this post


Link to post
Share on other sites

At this moment I am as far as you are i think.

I did manage to use this in a simple manner, just to send stuff around for objectives like this;

In a trigger:

Cond: this

OnAct:_nic = [nil,nil,rHINT,"You have safely delivered a crate. Good work!"] call RE; _nic = [nil,nil,"per",rexecVM,"scripts\crate_4.sqf"] call RE;

When the trigger activates all current connected clients get to see the hint and runs the script. Any client who connects after the triggers activation will only run the script

tskObj4 settaskstate "SUCCEEDED";
crate_4_done = true; 
publicVariable "crate_4_done";
exit;

still toying with the caller and target parameters though, haven't been able to test it yet in a MP enviroment.

hope this helps.

---------- Post added at 05:40 PM ---------- Previous post was at 05:30 PM ----------

Congratulations Shiva, after four years registered here; your first post! :bounce3:

I tend to be the silent and searching type :rolleyes:

Edited by NoN_Shiva
Typo in code

Share this post


Link to post
Share on other sites
Congratulations Shiva, after four years registered here; your first post! :bounce3:

At least it wasn't a simple "no..." :rolleyes:

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  

×