Jump to content
Sign in to follow this  
dragon zen

MP work: how to check who call the dialog??

Recommended Posts

Hello friends:

Now I try to write MP missions. Since there are many players, how can I check who call a dialog??

A simple example: player call dialog and choose their skill or type (just hit a button), how can I know who use this function now? In many MP mission, there are dialog of buy weapon, respawn. How does those work??

A deeper and abstract question is: how to discriminate different player's control in MP mission???

It's the first time I try to edit MP mission, thanks for your help.

Dragon Zen

Share this post


Link to post
Share on other sites

if dialog is open or not

how to "discriminate":

_VIP_list = [unit1,unit2,unit3];

if (player in _VIP_list) then {
if (dialog) then {
	waitUntil {!dialog};
	hint "you have closed dialog in your own time";
};
} else {
if (dialog) then {
	sleep 5;
	if (dialog) then {
		hint "you scoundrel, you can not have dialogs open more than 5 seconds, dialog is auto closing";
		closeDialog 0;
	};
};
};

Share this post


Link to post
Share on other sites

Sorry sir, I can't understand what these code for, maybe I didn't write my problem correctly.

I want to ask: If somebody call dialog and buy a car, I don't know how to decrease HIS money, rather than others. I just need to find a way to connect the function with certain player.

Does variable "player" in dialog can connect to certain clientside?

For example,

if(group player==grp1)then{variable1=variable1-money;};

if(group player==grp2)then{variable2=variable2-money;};

????

Edited by Dragon Zen

Share this post


Link to post
Share on other sites

As long as the script is called only on his client, then 'player' will work for you. How are you starting the dialog?

Share this post


Link to post
Share on other sites
As long as the script is called only on his client, then 'player' will work for you. How are you starting the dialog?

Starting a dialog by radio.

If the "player" can confirm the clientside who use it, that's OK.

Share this post


Link to post
Share on other sites
As long as the script is called only on his client, then 'player' will work for you. How are you starting the dialog?

Sorry sir, I have new question about that: what is the mean of "the script is called only on his client"??

I use radio to call sqf. To clarify, I give you the short example:

===============================

====use radio to call dialog====

Rbuy=createTrigger["EmptyDetector",[100,100,0]];

Rbuy setTriggerActivation["BRAVO","PRESENT",true];

Rbuy setTriggerStatements["","nul=[]execVM'supply\buymenu.sqf';",""];

Rbuy setTriggerText "Buy Menu";

====buymenu.sqf is this:====

createDialog "StandardBuy";

waitUntil {dialog};

blahblahblah........

====dialog "StandardBuy" like this:====

class StandardBuy {

....

class buy : RscButton {

action = "nul=[player]execVM'buy\buystandard\StandardAddS.sqf';";

text = "Buy Soldier";};

....

====StandardAddS.sqf like this:====

_caller=_this select 0;

=======================

My question is:

Are these code confirm the "player" only refer to him, and the dialog will only show only on his screen, rather than All players??

And, If I use "nul=[]execVM.... "in Dialog and use "_caller=player;" in StandardAddS, is that still OK??

First time to try MP mission, thanks for your help!:p

==============

In addition:

If I use global variable to save the value in control, such as onToolBoxSelChanged = "Variable1 = (_this select 1)"; Does it will crash between different players?? I just don't know what variable is used across the net, all global variable??

Edited by Dragon Zen

Share this post


Link to post
Share on other sites

That should work. Since you're creating the radio on the fly it'll only be on their client. Then when you call the AddS script you're passing it "player" which you refer to as _caller inside the script.

Global variables are global to the client until you publicVariable them. Meaning different scripts on the client will know what the value is, but different players could have different values. If you publicVariable it though, then everyone will share the same value.

Share this post


Link to post
Share on other sites
That should work. Since you're creating the radio on the fly it'll only be on their client. Then when you call the AddS script you're passing it "player" which you refer to as _caller inside the script.

Global variables are global to the client until you publicVariable them. Meaning different scripts on the client will know what the value is, but different players could have different values. If you publicVariable it though, then everyone will share the same value.

OK. that's it. Now 2 question in addition:

1,

Use radio to call sqf make sure the certain player. However, if mission give a dialog or a hint to certain player (player open the dialog passively), how to make sure it is he, rather than others, open a dialog or receive a hint??

In all: What make sure a sqf is actived on certain client-side??:confused:

2,

Does object (such as car, missile) "public"? If a client-side called sqf create a soldier or artillery fire, other players also create the same thing, is that right??

Then, if I use EventHandler "Killed", and killer will gain some money (MoneyP1=MoneyP1+_money). How should I set the variable "MoneyP1"? Set it as global variable (then every client run EH-Killed at same time, and each client do their own "MoneyP1=MoneyP1+_money"), or set it PublicVariable (then Server run "MoneyP1=MoneyP1+_money")? [note: I want player to be able to look at P1's money, not only theirselves.]

In all: Since many computers run same mission, I just don't understand which part of calculation is done by Server, and which part by Client-Side. And, how to define who run a function? :butbut:

THANKS

Edited by Dragon Zen

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  

×