Jump to content
kerozen

Addaction to specific player

Recommended Posts

I'm trying to do a co-op mission where 1 player is the translator and everyone else doesn't know the language.

 

Lets call everyone who doesn't know the language Ignorants and the other can be Translator

 

I have everything set up for the Ignorants. They try to interrogate the local and they don't understand the language but now i don't know how to make it so that when a specific player (Translator) comes up to the same local and asks stuff he can see other text.

 

I've messed around with the IF statement to no avail.

 

 

 

This is what the ignorants see when they click the addaction on the civilian (Scripts called Int1)

line1 = ["Local Resident", "hnak nafaq fi almawqie, w hnak aledyd min taliban fi almintaqat."];
line2 = ["Local Resident", "yakhdae lihirasat alnnafaq min qibal eadad kabir min junud taliban."];
[[line1,line2],"CIV",0.15,false] execVM "Interrogation\fn_simpleConv.sqf";

This is what i want the translator to see (Script called Int2)

line1 = ["Local Resident", "There is a tunnel in location, there are many taliban in the area."];
line2 = ["Local Resident", "The tunnel is guarded by a large number of taliban soldiers."];
[[line1,line2],"CIV",0.15,false] execVM "Interrogation\fn_simpleConv.sqf";

Its probably really simple but how can i make that happen?

 

 

Share this post


Link to post
Share on other sites

Well there are 2 methods.

 

1. Add all addactions to the civs and show proper action for proper unit using addaction condition

2. Pass unit called the addaction to the script and set some if or case statements inside.

Share this post


Link to post
Share on other sites

Well there are 2 methods.

 

1. Add all addactions to the civs and show proper action for proper unit using addaction condition

2. Pass unit called the addaction to the script and set some if or case statements inside.

 

Tried using conditions but always got syntax erros, i don't know how to properly use it

Share this post


Link to post
Share on other sites

Try setting a global variable via setVariable to the translator,

_unit setVariable ["translator", true, true]; // 2nd true only needed if the script isn't running on the player, makes it public.

then in the if condition,

if (_caller getVariable ["translator", false]) then {
// translated code
}else{
// ignorants code
};

Share this post


Link to post
Share on other sites

 

Try setting a global variable via setVariable to the translator,

_unit setVariable ["translator", true, true]; // 2nd true only needed if the script isn't running on the player, makes it public.

then in the if condition,

if (_caller getVariable ["translator", false]) then {
// translated code
}else{
// ignorants code
};

 

 

So i tried that.

 

I get this error when loading the mission:

 

Xuhp9uP.png

 

And this when i click the add action

 

XUYwppT.png

 

Unit init

Int1 setVariable ["translator", true, true];

and the script

if (Int1 getVariable ["translator", false]) then {
line1 = ["Local Resident", "There is a tunnel in location, there are many taliban in the area."];
line2 = ["Local Resident", "The tunnel is guarded by a large number of taliban soldiers."];
[[line1,line2],"CIV",0.15,false] execVM "Interrogation\fn_simpleConv.sqf";
}else{
line1 = ["Local Resident", "hnak nafaq fi almawqie, w hnak aledyd min taliban fi almintaqat."];
line2 = ["Local Resident", "yakhdae lihirasat alnnafaq min qibal eadad kabir min junud taliban."];
[[line1,line2],"CIV",0.15,false] execVM "Interrogation\fn_simpleConv.sqf";
};

Share this post


Link to post
Share on other sites

Tried using conditions but always got syntax erros, i don't know how to properly use it

 

Do you have analyzed the addaction syntax?

 

Check that and define which part are you not understand.

Share this post


Link to post
Share on other sites

Seems like you are adding the Variable to a number? like davidoss said check if you used the right variable for the player/unit.

Share this post


Link to post
Share on other sites

Resolved.

 

Thanks Davidoss for the help  :)

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

×